admin-gen.go 476 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449
  1. // Package admin provides access to the Admin Directory API.
  2. //
  3. // See https://developers.google.com/admin-sdk/directory/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/admin/directory/v1"
  8. // ...
  9. // adminService, err := admin.New(oauthHttpClient)
  10. package admin // import "google.golang.org/api/admin/directory/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "admin:directory_v1"
  41. const apiName = "admin"
  42. const apiVersion = "directory_v1"
  43. const basePath = "https://www.googleapis.com/admin/directory/v1/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage customer related information
  47. AdminDirectoryCustomerScope = "https://www.googleapis.com/auth/admin.directory.customer"
  48. // View customer related information
  49. AdminDirectoryCustomerReadonlyScope = "https://www.googleapis.com/auth/admin.directory.customer.readonly"
  50. // View and manage your Chrome OS devices' metadata
  51. AdminDirectoryDeviceChromeosScope = "https://www.googleapis.com/auth/admin.directory.device.chromeos"
  52. // View your Chrome OS devices' metadata
  53. AdminDirectoryDeviceChromeosReadonlyScope = "https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly"
  54. // View and manage your mobile devices' metadata
  55. AdminDirectoryDeviceMobileScope = "https://www.googleapis.com/auth/admin.directory.device.mobile"
  56. // Manage your mobile devices by performing administrative tasks
  57. AdminDirectoryDeviceMobileActionScope = "https://www.googleapis.com/auth/admin.directory.device.mobile.action"
  58. // View your mobile devices' metadata
  59. AdminDirectoryDeviceMobileReadonlyScope = "https://www.googleapis.com/auth/admin.directory.device.mobile.readonly"
  60. // View and manage the provisioning of domains for your customers
  61. AdminDirectoryDomainScope = "https://www.googleapis.com/auth/admin.directory.domain"
  62. // View domains related to your customers
  63. AdminDirectoryDomainReadonlyScope = "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  64. // View and manage the provisioning of groups on your domain
  65. AdminDirectoryGroupScope = "https://www.googleapis.com/auth/admin.directory.group"
  66. // View and manage group subscriptions on your domain
  67. AdminDirectoryGroupMemberScope = "https://www.googleapis.com/auth/admin.directory.group.member"
  68. // View group subscriptions on your domain
  69. AdminDirectoryGroupMemberReadonlyScope = "https://www.googleapis.com/auth/admin.directory.group.member.readonly"
  70. // View groups on your domain
  71. AdminDirectoryGroupReadonlyScope = "https://www.googleapis.com/auth/admin.directory.group.readonly"
  72. // View and manage notifications received on your domain
  73. AdminDirectoryNotificationsScope = "https://www.googleapis.com/auth/admin.directory.notifications"
  74. // View and manage organization units on your domain
  75. AdminDirectoryOrgunitScope = "https://www.googleapis.com/auth/admin.directory.orgunit"
  76. // View organization units on your domain
  77. AdminDirectoryOrgunitReadonlyScope = "https://www.googleapis.com/auth/admin.directory.orgunit.readonly"
  78. // View and manage the provisioning of calendar resources on your domain
  79. AdminDirectoryResourceCalendarScope = "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  80. // View calendar resources on your domain
  81. AdminDirectoryResourceCalendarReadonlyScope = "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  82. // Manage delegated admin roles for your domain
  83. AdminDirectoryRolemanagementScope = "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  84. // View delegated admin roles for your domain
  85. AdminDirectoryRolemanagementReadonlyScope = "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  86. // View and manage the provisioning of users on your domain
  87. AdminDirectoryUserScope = "https://www.googleapis.com/auth/admin.directory.user"
  88. // View and manage user aliases on your domain
  89. AdminDirectoryUserAliasScope = "https://www.googleapis.com/auth/admin.directory.user.alias"
  90. // View user aliases on your domain
  91. AdminDirectoryUserAliasReadonlyScope = "https://www.googleapis.com/auth/admin.directory.user.alias.readonly"
  92. // View users on your domain
  93. AdminDirectoryUserReadonlyScope = "https://www.googleapis.com/auth/admin.directory.user.readonly"
  94. // Manage data access permissions for users on your domain
  95. AdminDirectoryUserSecurityScope = "https://www.googleapis.com/auth/admin.directory.user.security"
  96. // View and manage the provisioning of user schemas on your domain
  97. AdminDirectoryUserschemaScope = "https://www.googleapis.com/auth/admin.directory.userschema"
  98. // View user schemas on your domain
  99. AdminDirectoryUserschemaReadonlyScope = "https://www.googleapis.com/auth/admin.directory.userschema.readonly"
  100. )
  101. func New(client *http.Client) (*Service, error) {
  102. if client == nil {
  103. return nil, errors.New("client is nil")
  104. }
  105. s := &Service{client: client, BasePath: basePath}
  106. s.Asps = NewAspsService(s)
  107. s.Channels = NewChannelsService(s)
  108. s.Chromeosdevices = NewChromeosdevicesService(s)
  109. s.Customers = NewCustomersService(s)
  110. s.DomainAliases = NewDomainAliasesService(s)
  111. s.Domains = NewDomainsService(s)
  112. s.Groups = NewGroupsService(s)
  113. s.Members = NewMembersService(s)
  114. s.Mobiledevices = NewMobiledevicesService(s)
  115. s.Notifications = NewNotificationsService(s)
  116. s.Orgunits = NewOrgunitsService(s)
  117. s.Privileges = NewPrivilegesService(s)
  118. s.Resources = NewResourcesService(s)
  119. s.RoleAssignments = NewRoleAssignmentsService(s)
  120. s.Roles = NewRolesService(s)
  121. s.Schemas = NewSchemasService(s)
  122. s.Tokens = NewTokensService(s)
  123. s.Users = NewUsersService(s)
  124. s.VerificationCodes = NewVerificationCodesService(s)
  125. return s, nil
  126. }
  127. type Service struct {
  128. client *http.Client
  129. BasePath string // API endpoint base URL
  130. UserAgent string // optional additional User-Agent fragment
  131. Asps *AspsService
  132. Channels *ChannelsService
  133. Chromeosdevices *ChromeosdevicesService
  134. Customers *CustomersService
  135. DomainAliases *DomainAliasesService
  136. Domains *DomainsService
  137. Groups *GroupsService
  138. Members *MembersService
  139. Mobiledevices *MobiledevicesService
  140. Notifications *NotificationsService
  141. Orgunits *OrgunitsService
  142. Privileges *PrivilegesService
  143. Resources *ResourcesService
  144. RoleAssignments *RoleAssignmentsService
  145. Roles *RolesService
  146. Schemas *SchemasService
  147. Tokens *TokensService
  148. Users *UsersService
  149. VerificationCodes *VerificationCodesService
  150. }
  151. func (s *Service) userAgent() string {
  152. if s.UserAgent == "" {
  153. return googleapi.UserAgent
  154. }
  155. return googleapi.UserAgent + " " + s.UserAgent
  156. }
  157. func NewAspsService(s *Service) *AspsService {
  158. rs := &AspsService{s: s}
  159. return rs
  160. }
  161. type AspsService struct {
  162. s *Service
  163. }
  164. func NewChannelsService(s *Service) *ChannelsService {
  165. rs := &ChannelsService{s: s}
  166. return rs
  167. }
  168. type ChannelsService struct {
  169. s *Service
  170. }
  171. func NewChromeosdevicesService(s *Service) *ChromeosdevicesService {
  172. rs := &ChromeosdevicesService{s: s}
  173. return rs
  174. }
  175. type ChromeosdevicesService struct {
  176. s *Service
  177. }
  178. func NewCustomersService(s *Service) *CustomersService {
  179. rs := &CustomersService{s: s}
  180. return rs
  181. }
  182. type CustomersService struct {
  183. s *Service
  184. }
  185. func NewDomainAliasesService(s *Service) *DomainAliasesService {
  186. rs := &DomainAliasesService{s: s}
  187. return rs
  188. }
  189. type DomainAliasesService struct {
  190. s *Service
  191. }
  192. func NewDomainsService(s *Service) *DomainsService {
  193. rs := &DomainsService{s: s}
  194. return rs
  195. }
  196. type DomainsService struct {
  197. s *Service
  198. }
  199. func NewGroupsService(s *Service) *GroupsService {
  200. rs := &GroupsService{s: s}
  201. rs.Aliases = NewGroupsAliasesService(s)
  202. return rs
  203. }
  204. type GroupsService struct {
  205. s *Service
  206. Aliases *GroupsAliasesService
  207. }
  208. func NewGroupsAliasesService(s *Service) *GroupsAliasesService {
  209. rs := &GroupsAliasesService{s: s}
  210. return rs
  211. }
  212. type GroupsAliasesService struct {
  213. s *Service
  214. }
  215. func NewMembersService(s *Service) *MembersService {
  216. rs := &MembersService{s: s}
  217. return rs
  218. }
  219. type MembersService struct {
  220. s *Service
  221. }
  222. func NewMobiledevicesService(s *Service) *MobiledevicesService {
  223. rs := &MobiledevicesService{s: s}
  224. return rs
  225. }
  226. type MobiledevicesService struct {
  227. s *Service
  228. }
  229. func NewNotificationsService(s *Service) *NotificationsService {
  230. rs := &NotificationsService{s: s}
  231. return rs
  232. }
  233. type NotificationsService struct {
  234. s *Service
  235. }
  236. func NewOrgunitsService(s *Service) *OrgunitsService {
  237. rs := &OrgunitsService{s: s}
  238. return rs
  239. }
  240. type OrgunitsService struct {
  241. s *Service
  242. }
  243. func NewPrivilegesService(s *Service) *PrivilegesService {
  244. rs := &PrivilegesService{s: s}
  245. return rs
  246. }
  247. type PrivilegesService struct {
  248. s *Service
  249. }
  250. func NewResourcesService(s *Service) *ResourcesService {
  251. rs := &ResourcesService{s: s}
  252. rs.Calendars = NewResourcesCalendarsService(s)
  253. return rs
  254. }
  255. type ResourcesService struct {
  256. s *Service
  257. Calendars *ResourcesCalendarsService
  258. }
  259. func NewResourcesCalendarsService(s *Service) *ResourcesCalendarsService {
  260. rs := &ResourcesCalendarsService{s: s}
  261. return rs
  262. }
  263. type ResourcesCalendarsService struct {
  264. s *Service
  265. }
  266. func NewRoleAssignmentsService(s *Service) *RoleAssignmentsService {
  267. rs := &RoleAssignmentsService{s: s}
  268. return rs
  269. }
  270. type RoleAssignmentsService struct {
  271. s *Service
  272. }
  273. func NewRolesService(s *Service) *RolesService {
  274. rs := &RolesService{s: s}
  275. return rs
  276. }
  277. type RolesService struct {
  278. s *Service
  279. }
  280. func NewSchemasService(s *Service) *SchemasService {
  281. rs := &SchemasService{s: s}
  282. return rs
  283. }
  284. type SchemasService struct {
  285. s *Service
  286. }
  287. func NewTokensService(s *Service) *TokensService {
  288. rs := &TokensService{s: s}
  289. return rs
  290. }
  291. type TokensService struct {
  292. s *Service
  293. }
  294. func NewUsersService(s *Service) *UsersService {
  295. rs := &UsersService{s: s}
  296. rs.Aliases = NewUsersAliasesService(s)
  297. rs.Photos = NewUsersPhotosService(s)
  298. return rs
  299. }
  300. type UsersService struct {
  301. s *Service
  302. Aliases *UsersAliasesService
  303. Photos *UsersPhotosService
  304. }
  305. func NewUsersAliasesService(s *Service) *UsersAliasesService {
  306. rs := &UsersAliasesService{s: s}
  307. return rs
  308. }
  309. type UsersAliasesService struct {
  310. s *Service
  311. }
  312. func NewUsersPhotosService(s *Service) *UsersPhotosService {
  313. rs := &UsersPhotosService{s: s}
  314. return rs
  315. }
  316. type UsersPhotosService struct {
  317. s *Service
  318. }
  319. func NewVerificationCodesService(s *Service) *VerificationCodesService {
  320. rs := &VerificationCodesService{s: s}
  321. return rs
  322. }
  323. type VerificationCodesService struct {
  324. s *Service
  325. }
  326. // Alias: JSON template for Alias object in Directory API.
  327. type Alias struct {
  328. // Alias: A alias email
  329. Alias string `json:"alias,omitempty"`
  330. // Etag: ETag of the resource.
  331. Etag string `json:"etag,omitempty"`
  332. // Id: Unique id of the group (Read-only) Unique id of the user
  333. // (Read-only)
  334. Id string `json:"id,omitempty"`
  335. // Kind: Kind of resource this is.
  336. Kind string `json:"kind,omitempty"`
  337. // PrimaryEmail: Group's primary email (Read-only) User's primary email
  338. // (Read-only)
  339. PrimaryEmail string `json:"primaryEmail,omitempty"`
  340. // ServerResponse contains the HTTP response code and headers from the
  341. // server.
  342. googleapi.ServerResponse `json:"-"`
  343. // ForceSendFields is a list of field names (e.g. "Alias") to
  344. // unconditionally include in API requests. By default, fields with
  345. // empty values are omitted from API requests. However, any non-pointer,
  346. // non-interface field appearing in ForceSendFields will be sent to the
  347. // server regardless of whether the field is empty or not. This may be
  348. // used to include empty fields in Patch requests.
  349. ForceSendFields []string `json:"-"`
  350. }
  351. func (s *Alias) MarshalJSON() ([]byte, error) {
  352. type noMethod Alias
  353. raw := noMethod(*s)
  354. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  355. }
  356. // Aliases: JSON response template to list aliases in Directory API.
  357. type Aliases struct {
  358. // Aliases: List of alias objects.
  359. Aliases []*Alias `json:"aliases,omitempty"`
  360. // Etag: ETag of the resource.
  361. Etag string `json:"etag,omitempty"`
  362. // Kind: Kind of resource this is.
  363. Kind string `json:"kind,omitempty"`
  364. // ServerResponse contains the HTTP response code and headers from the
  365. // server.
  366. googleapi.ServerResponse `json:"-"`
  367. // ForceSendFields is a list of field names (e.g. "Aliases") to
  368. // unconditionally include in API requests. By default, fields with
  369. // empty values are omitted from API requests. However, any non-pointer,
  370. // non-interface field appearing in ForceSendFields will be sent to the
  371. // server regardless of whether the field is empty or not. This may be
  372. // used to include empty fields in Patch requests.
  373. ForceSendFields []string `json:"-"`
  374. }
  375. func (s *Aliases) MarshalJSON() ([]byte, error) {
  376. type noMethod Aliases
  377. raw := noMethod(*s)
  378. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  379. }
  380. // Asp: The template that returns individual ASP (Access Code) data.
  381. type Asp struct {
  382. // CodeId: The unique ID of the ASP.
  383. CodeId int64 `json:"codeId,omitempty"`
  384. // CreationTime: The time when the ASP was created. Expressed in Unix
  385. // time format.
  386. CreationTime int64 `json:"creationTime,omitempty,string"`
  387. // Etag: ETag of the ASP.
  388. Etag string `json:"etag,omitempty"`
  389. // Kind: The type of the API resource. This is always
  390. // admin#directory#asp.
  391. Kind string `json:"kind,omitempty"`
  392. // LastTimeUsed: The time when the ASP was last used. Expressed in Unix
  393. // time format.
  394. LastTimeUsed int64 `json:"lastTimeUsed,omitempty,string"`
  395. // Name: The name of the application that the user, represented by their
  396. // userId, entered when the ASP was created.
  397. Name string `json:"name,omitempty"`
  398. // UserKey: The unique ID of the user who issued the ASP.
  399. UserKey string `json:"userKey,omitempty"`
  400. // ServerResponse contains the HTTP response code and headers from the
  401. // server.
  402. googleapi.ServerResponse `json:"-"`
  403. // ForceSendFields is a list of field names (e.g. "CodeId") to
  404. // unconditionally include in API requests. By default, fields with
  405. // empty values are omitted from API requests. However, any non-pointer,
  406. // non-interface field appearing in ForceSendFields will be sent to the
  407. // server regardless of whether the field is empty or not. This may be
  408. // used to include empty fields in Patch requests.
  409. ForceSendFields []string `json:"-"`
  410. }
  411. func (s *Asp) MarshalJSON() ([]byte, error) {
  412. type noMethod Asp
  413. raw := noMethod(*s)
  414. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  415. }
  416. type Asps struct {
  417. // Etag: ETag of the resource.
  418. Etag string `json:"etag,omitempty"`
  419. // Items: A list of ASP resources.
  420. Items []*Asp `json:"items,omitempty"`
  421. // Kind: The type of the API resource. This is always
  422. // admin#directory#aspList.
  423. Kind string `json:"kind,omitempty"`
  424. // ServerResponse contains the HTTP response code and headers from the
  425. // server.
  426. googleapi.ServerResponse `json:"-"`
  427. // ForceSendFields is a list of field names (e.g. "Etag") to
  428. // unconditionally include in API requests. By default, fields with
  429. // empty values are omitted from API requests. However, any non-pointer,
  430. // non-interface field appearing in ForceSendFields will be sent to the
  431. // server regardless of whether the field is empty or not. This may be
  432. // used to include empty fields in Patch requests.
  433. ForceSendFields []string `json:"-"`
  434. }
  435. func (s *Asps) MarshalJSON() ([]byte, error) {
  436. type noMethod Asps
  437. raw := noMethod(*s)
  438. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  439. }
  440. // CalendarResource: JSON template for Calendar Resource object in
  441. // Directory API.
  442. type CalendarResource struct {
  443. // Etags: ETag of the resource.
  444. Etags string `json:"etags,omitempty"`
  445. // Kind: The type of the resource. For calendar resources, the value is
  446. // admin#directory#resources#calendars#CalendarResource.
  447. Kind string `json:"kind,omitempty"`
  448. // ResourceDescription: The brief description of the calendar resource.
  449. ResourceDescription string `json:"resourceDescription,omitempty"`
  450. // ResourceEmail: The read-only email ID for the calendar resource.
  451. // Generated as part of creating a new calendar resource.
  452. ResourceEmail string `json:"resourceEmail,omitempty"`
  453. // ResourceId: The unique ID for the calendar resource.
  454. ResourceId string `json:"resourceId,omitempty"`
  455. // ResourceName: The name of the calendar resource. For example,
  456. // Training Room 1A
  457. ResourceName string `json:"resourceName,omitempty"`
  458. // ResourceType: The type of the calendar resource. Used for grouping
  459. // resources in the calendar user interface.
  460. ResourceType string `json:"resourceType,omitempty"`
  461. // ServerResponse contains the HTTP response code and headers from the
  462. // server.
  463. googleapi.ServerResponse `json:"-"`
  464. // ForceSendFields is a list of field names (e.g. "Etags") to
  465. // unconditionally include in API requests. By default, fields with
  466. // empty values are omitted from API requests. However, any non-pointer,
  467. // non-interface field appearing in ForceSendFields will be sent to the
  468. // server regardless of whether the field is empty or not. This may be
  469. // used to include empty fields in Patch requests.
  470. ForceSendFields []string `json:"-"`
  471. }
  472. func (s *CalendarResource) MarshalJSON() ([]byte, error) {
  473. type noMethod CalendarResource
  474. raw := noMethod(*s)
  475. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  476. }
  477. // CalendarResources: JSON template for Calendar Resource List Response
  478. // object in Directory API.
  479. type CalendarResources struct {
  480. // Etag: ETag of the resource.
  481. Etag string `json:"etag,omitempty"`
  482. // Items: The CalendarResources in this page of results.
  483. Items []*CalendarResource `json:"items,omitempty"`
  484. // Kind: Identifies this as a collection of CalendarResources. This is
  485. // always admin#directory#resources#calendars#calendarResourcesList.
  486. Kind string `json:"kind,omitempty"`
  487. // NextPageToken: The continuation token, used to page through large
  488. // result sets. Provide this value in a subsequent request to return the
  489. // next page of results.
  490. NextPageToken string `json:"nextPageToken,omitempty"`
  491. // ServerResponse contains the HTTP response code and headers from the
  492. // server.
  493. googleapi.ServerResponse `json:"-"`
  494. // ForceSendFields is a list of field names (e.g. "Etag") to
  495. // unconditionally include in API requests. By default, fields with
  496. // empty values are omitted from API requests. However, any non-pointer,
  497. // non-interface field appearing in ForceSendFields will be sent to the
  498. // server regardless of whether the field is empty or not. This may be
  499. // used to include empty fields in Patch requests.
  500. ForceSendFields []string `json:"-"`
  501. }
  502. func (s *CalendarResources) MarshalJSON() ([]byte, error) {
  503. type noMethod CalendarResources
  504. raw := noMethod(*s)
  505. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  506. }
  507. // Channel: An notification channel used to watch for resource changes.
  508. type Channel struct {
  509. // Address: The address where notifications are delivered for this
  510. // channel.
  511. Address string `json:"address,omitempty"`
  512. // Expiration: Date and time of notification channel expiration,
  513. // expressed as a Unix timestamp, in milliseconds. Optional.
  514. Expiration int64 `json:"expiration,omitempty,string"`
  515. // Id: A UUID or similar unique string that identifies this channel.
  516. Id string `json:"id,omitempty"`
  517. // Kind: Identifies this as a notification channel used to watch for
  518. // changes to a resource. Value: the fixed string "api#channel".
  519. Kind string `json:"kind,omitempty"`
  520. // Params: Additional parameters controlling delivery channel behavior.
  521. // Optional.
  522. Params map[string]string `json:"params,omitempty"`
  523. // Payload: A Boolean value to indicate whether payload is wanted.
  524. // Optional.
  525. Payload bool `json:"payload,omitempty"`
  526. // ResourceId: An opaque ID that identifies the resource being watched
  527. // on this channel. Stable across different API versions.
  528. ResourceId string `json:"resourceId,omitempty"`
  529. // ResourceUri: A version-specific identifier for the watched resource.
  530. ResourceUri string `json:"resourceUri,omitempty"`
  531. // Token: An arbitrary string delivered to the target address with each
  532. // notification delivered over this channel. Optional.
  533. Token string `json:"token,omitempty"`
  534. // Type: The type of delivery mechanism used for this channel.
  535. Type string `json:"type,omitempty"`
  536. // ServerResponse contains the HTTP response code and headers from the
  537. // server.
  538. googleapi.ServerResponse `json:"-"`
  539. // ForceSendFields is a list of field names (e.g. "Address") to
  540. // unconditionally include in API requests. By default, fields with
  541. // empty values are omitted from API requests. However, any non-pointer,
  542. // non-interface field appearing in ForceSendFields will be sent to the
  543. // server regardless of whether the field is empty or not. This may be
  544. // used to include empty fields in Patch requests.
  545. ForceSendFields []string `json:"-"`
  546. }
  547. func (s *Channel) MarshalJSON() ([]byte, error) {
  548. type noMethod Channel
  549. raw := noMethod(*s)
  550. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  551. }
  552. // ChromeOsDevice: JSON template for Chrome Os Device resource in
  553. // Directory API.
  554. type ChromeOsDevice struct {
  555. // ActiveTimeRanges: List of active time ranges (Read-only)
  556. ActiveTimeRanges []*ChromeOsDeviceActiveTimeRanges `json:"activeTimeRanges,omitempty"`
  557. // AnnotatedAssetId: AssetId specified during enrollment or through
  558. // later annotation
  559. AnnotatedAssetId string `json:"annotatedAssetId,omitempty"`
  560. // AnnotatedLocation: Address or location of the device as noted by the
  561. // administrator
  562. AnnotatedLocation string `json:"annotatedLocation,omitempty"`
  563. // AnnotatedUser: User of the device
  564. AnnotatedUser string `json:"annotatedUser,omitempty"`
  565. // BootMode: Chromebook boot mode (Read-only)
  566. BootMode string `json:"bootMode,omitempty"`
  567. // DeviceId: Unique identifier of Chrome OS Device (Read-only)
  568. DeviceId string `json:"deviceId,omitempty"`
  569. // Etag: ETag of the resource.
  570. Etag string `json:"etag,omitempty"`
  571. // EthernetMacAddress: Chromebook Mac Address on ethernet network
  572. // interface (Read-only)
  573. EthernetMacAddress string `json:"ethernetMacAddress,omitempty"`
  574. // FirmwareVersion: Chromebook firmware version (Read-only)
  575. FirmwareVersion string `json:"firmwareVersion,omitempty"`
  576. // Kind: Kind of resource this is.
  577. Kind string `json:"kind,omitempty"`
  578. // LastEnrollmentTime: Date and time the device was last enrolled
  579. // (Read-only)
  580. LastEnrollmentTime string `json:"lastEnrollmentTime,omitempty"`
  581. // LastSync: Date and time the device was last synchronized with the
  582. // policy settings in the Google Apps administrator control panel
  583. // (Read-only)
  584. LastSync string `json:"lastSync,omitempty"`
  585. // MacAddress: Chromebook Mac Address on wifi network interface
  586. // (Read-only)
  587. MacAddress string `json:"macAddress,omitempty"`
  588. // Meid: Mobile Equipment identifier for the 3G mobile card in the
  589. // Chromebook (Read-only)
  590. Meid string `json:"meid,omitempty"`
  591. // Model: Chromebook Model (Read-only)
  592. Model string `json:"model,omitempty"`
  593. // Notes: Notes added by the administrator
  594. Notes string `json:"notes,omitempty"`
  595. // OrderNumber: Chromebook order number (Read-only)
  596. OrderNumber string `json:"orderNumber,omitempty"`
  597. // OrgUnitPath: OrgUnit of the device
  598. OrgUnitPath string `json:"orgUnitPath,omitempty"`
  599. // OsVersion: Chromebook Os Version (Read-only)
  600. OsVersion string `json:"osVersion,omitempty"`
  601. // PlatformVersion: Chromebook platform version (Read-only)
  602. PlatformVersion string `json:"platformVersion,omitempty"`
  603. // RecentUsers: List of recent device users, in descending order by last
  604. // login time (Read-only)
  605. RecentUsers []*ChromeOsDeviceRecentUsers `json:"recentUsers,omitempty"`
  606. // SerialNumber: Chromebook serial number (Read-only)
  607. SerialNumber string `json:"serialNumber,omitempty"`
  608. // Status: status of the device (Read-only)
  609. Status string `json:"status,omitempty"`
  610. // SupportEndDate: Final date the device will be supported (Read-only)
  611. SupportEndDate string `json:"supportEndDate,omitempty"`
  612. // WillAutoRenew: Will Chromebook auto renew after support end date
  613. // (Read-only)
  614. WillAutoRenew bool `json:"willAutoRenew,omitempty"`
  615. // ServerResponse contains the HTTP response code and headers from the
  616. // server.
  617. googleapi.ServerResponse `json:"-"`
  618. // ForceSendFields is a list of field names (e.g. "ActiveTimeRanges") to
  619. // unconditionally include in API requests. By default, fields with
  620. // empty values are omitted from API requests. However, any non-pointer,
  621. // non-interface field appearing in ForceSendFields will be sent to the
  622. // server regardless of whether the field is empty or not. This may be
  623. // used to include empty fields in Patch requests.
  624. ForceSendFields []string `json:"-"`
  625. }
  626. func (s *ChromeOsDevice) MarshalJSON() ([]byte, error) {
  627. type noMethod ChromeOsDevice
  628. raw := noMethod(*s)
  629. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  630. }
  631. type ChromeOsDeviceActiveTimeRanges struct {
  632. // ActiveTime: Duration in milliseconds
  633. ActiveTime int64 `json:"activeTime,omitempty"`
  634. // Date: Date of usage
  635. Date string `json:"date,omitempty"`
  636. // ForceSendFields is a list of field names (e.g. "ActiveTime") to
  637. // unconditionally include in API requests. By default, fields with
  638. // empty values are omitted from API requests. However, any non-pointer,
  639. // non-interface field appearing in ForceSendFields will be sent to the
  640. // server regardless of whether the field is empty or not. This may be
  641. // used to include empty fields in Patch requests.
  642. ForceSendFields []string `json:"-"`
  643. }
  644. func (s *ChromeOsDeviceActiveTimeRanges) MarshalJSON() ([]byte, error) {
  645. type noMethod ChromeOsDeviceActiveTimeRanges
  646. raw := noMethod(*s)
  647. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  648. }
  649. type ChromeOsDeviceRecentUsers struct {
  650. // Email: Email address of the user. Present only if the user type is
  651. // managed
  652. Email string `json:"email,omitempty"`
  653. // Type: The type of the user
  654. Type string `json:"type,omitempty"`
  655. // ForceSendFields is a list of field names (e.g. "Email") to
  656. // unconditionally include in API requests. By default, fields with
  657. // empty values are omitted from API requests. However, any non-pointer,
  658. // non-interface field appearing in ForceSendFields will be sent to the
  659. // server regardless of whether the field is empty or not. This may be
  660. // used to include empty fields in Patch requests.
  661. ForceSendFields []string `json:"-"`
  662. }
  663. func (s *ChromeOsDeviceRecentUsers) MarshalJSON() ([]byte, error) {
  664. type noMethod ChromeOsDeviceRecentUsers
  665. raw := noMethod(*s)
  666. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  667. }
  668. // ChromeOsDevices: JSON response template for List Chrome OS Devices
  669. // operation in Directory API.
  670. type ChromeOsDevices struct {
  671. // Chromeosdevices: List of Chrome OS Device objects.
  672. Chromeosdevices []*ChromeOsDevice `json:"chromeosdevices,omitempty"`
  673. // Etag: ETag of the resource.
  674. Etag string `json:"etag,omitempty"`
  675. // Kind: Kind of resource this is.
  676. Kind string `json:"kind,omitempty"`
  677. // NextPageToken: Token used to access next page of this result.
  678. NextPageToken string `json:"nextPageToken,omitempty"`
  679. // ServerResponse contains the HTTP response code and headers from the
  680. // server.
  681. googleapi.ServerResponse `json:"-"`
  682. // ForceSendFields is a list of field names (e.g. "Chromeosdevices") to
  683. // unconditionally include in API requests. By default, fields with
  684. // empty values are omitted from API requests. However, any non-pointer,
  685. // non-interface field appearing in ForceSendFields will be sent to the
  686. // server regardless of whether the field is empty or not. This may be
  687. // used to include empty fields in Patch requests.
  688. ForceSendFields []string `json:"-"`
  689. }
  690. func (s *ChromeOsDevices) MarshalJSON() ([]byte, error) {
  691. type noMethod ChromeOsDevices
  692. raw := noMethod(*s)
  693. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  694. }
  695. // Customer: JSON template for Customer Resource object in Directory
  696. // API.
  697. type Customer struct {
  698. // AlternateEmail: The customer's secondary contact email address. This
  699. // email address cannot be on the same domain as the customerDomain
  700. AlternateEmail string `json:"alternateEmail,omitempty"`
  701. // CustomerCreationTime: The customer's creation time (Readonly)
  702. CustomerCreationTime string `json:"customerCreationTime,omitempty"`
  703. // CustomerDomain: The customer's primary domain name string. Do not
  704. // include the www prefix when creating a new customer.
  705. CustomerDomain string `json:"customerDomain,omitempty"`
  706. // Etag: ETag of the resource.
  707. Etag string `json:"etag,omitempty"`
  708. // Id: The unique ID for the customer's Google account. (Readonly)
  709. Id string `json:"id,omitempty"`
  710. // Kind: Identifies the resource as a customer. Value:
  711. // admin#directory#customer
  712. Kind string `json:"kind,omitempty"`
  713. // Language: The customer's ISO 639-2 language code. The default value
  714. // is en-US
  715. Language string `json:"language,omitempty"`
  716. // PhoneNumber: The customer's contact phone number in E.164 format.
  717. PhoneNumber string `json:"phoneNumber,omitempty"`
  718. // PostalAddress: The customer's postal address information.
  719. PostalAddress *CustomerPostalAddress `json:"postalAddress,omitempty"`
  720. // ServerResponse contains the HTTP response code and headers from the
  721. // server.
  722. googleapi.ServerResponse `json:"-"`
  723. // ForceSendFields is a list of field names (e.g. "AlternateEmail") to
  724. // unconditionally include in API requests. By default, fields with
  725. // empty values are omitted from API requests. However, any non-pointer,
  726. // non-interface field appearing in ForceSendFields will be sent to the
  727. // server regardless of whether the field is empty or not. This may be
  728. // used to include empty fields in Patch requests.
  729. ForceSendFields []string `json:"-"`
  730. }
  731. func (s *Customer) MarshalJSON() ([]byte, error) {
  732. type noMethod Customer
  733. raw := noMethod(*s)
  734. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  735. }
  736. // CustomerPostalAddress: JSON template for postal address of a
  737. // customer.
  738. type CustomerPostalAddress struct {
  739. // AddressLine1: A customer's physical address. The address can be
  740. // composed of one to three lines.
  741. AddressLine1 string `json:"addressLine1,omitempty"`
  742. // AddressLine2: Address line 2 of the address.
  743. AddressLine2 string `json:"addressLine2,omitempty"`
  744. // AddressLine3: Address line 3 of the address.
  745. AddressLine3 string `json:"addressLine3,omitempty"`
  746. // ContactName: The customer contact's name.
  747. ContactName string `json:"contactName,omitempty"`
  748. // CountryCode: This is a required property. For countryCode information
  749. // see the ISO 3166 country code elements.
  750. CountryCode string `json:"countryCode,omitempty"`
  751. // Locality: Name of the locality. An example of a locality value is the
  752. // city of San Francisco.
  753. Locality string `json:"locality,omitempty"`
  754. // OrganizationName: The company or company division name.
  755. OrganizationName string `json:"organizationName,omitempty"`
  756. // PostalCode: The postal code. A postalCode example is a postal zip
  757. // code such as 10009. This is in accordance with -
  758. // http://portablecontacts.net/draft-spec.html#address_element.
  759. PostalCode string `json:"postalCode,omitempty"`
  760. // Region: Name of the region. An example of a region value is NY for
  761. // the state of New York.
  762. Region string `json:"region,omitempty"`
  763. // ForceSendFields is a list of field names (e.g. "AddressLine1") to
  764. // unconditionally include in API requests. By default, fields with
  765. // empty values are omitted from API requests. However, any non-pointer,
  766. // non-interface field appearing in ForceSendFields will be sent to the
  767. // server regardless of whether the field is empty or not. This may be
  768. // used to include empty fields in Patch requests.
  769. ForceSendFields []string `json:"-"`
  770. }
  771. func (s *CustomerPostalAddress) MarshalJSON() ([]byte, error) {
  772. type noMethod CustomerPostalAddress
  773. raw := noMethod(*s)
  774. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  775. }
  776. // DomainAlias: JSON template for Domain Alias object in Directory API.
  777. type DomainAlias struct {
  778. // CreationTime: The creation time of the domain alias. (Read-only).
  779. CreationTime int64 `json:"creationTime,omitempty,string"`
  780. // DomainAliasName: The domain alias name.
  781. DomainAliasName string `json:"domainAliasName,omitempty"`
  782. // Etag: ETag of the resource.
  783. Etag string `json:"etag,omitempty"`
  784. // Kind: Kind of resource this is.
  785. Kind string `json:"kind,omitempty"`
  786. // ParentDomainName: The parent domain name that the domain alias is
  787. // associated with. This can either be a primary or secondary domain
  788. // name within a customer.
  789. ParentDomainName string `json:"parentDomainName,omitempty"`
  790. // Verified: Indicates the verification state of a domain alias.
  791. // (Read-only)
  792. Verified bool `json:"verified,omitempty"`
  793. // ServerResponse contains the HTTP response code and headers from the
  794. // server.
  795. googleapi.ServerResponse `json:"-"`
  796. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  797. // unconditionally include in API requests. By default, fields with
  798. // empty values are omitted from API requests. However, any non-pointer,
  799. // non-interface field appearing in ForceSendFields will be sent to the
  800. // server regardless of whether the field is empty or not. This may be
  801. // used to include empty fields in Patch requests.
  802. ForceSendFields []string `json:"-"`
  803. }
  804. func (s *DomainAlias) MarshalJSON() ([]byte, error) {
  805. type noMethod DomainAlias
  806. raw := noMethod(*s)
  807. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  808. }
  809. // DomainAliases: JSON response template to list domain aliases in
  810. // Directory API.
  811. type DomainAliases struct {
  812. // DomainAliases: List of domain alias objects.
  813. DomainAliases []*DomainAlias `json:"domainAliases,omitempty"`
  814. // Etag: ETag of the resource.
  815. Etag string `json:"etag,omitempty"`
  816. // Kind: Kind of resource this is.
  817. Kind string `json:"kind,omitempty"`
  818. // ServerResponse contains the HTTP response code and headers from the
  819. // server.
  820. googleapi.ServerResponse `json:"-"`
  821. // ForceSendFields is a list of field names (e.g. "DomainAliases") to
  822. // unconditionally include in API requests. By default, fields with
  823. // empty values are omitted from API requests. However, any non-pointer,
  824. // non-interface field appearing in ForceSendFields will be sent to the
  825. // server regardless of whether the field is empty or not. This may be
  826. // used to include empty fields in Patch requests.
  827. ForceSendFields []string `json:"-"`
  828. }
  829. func (s *DomainAliases) MarshalJSON() ([]byte, error) {
  830. type noMethod DomainAliases
  831. raw := noMethod(*s)
  832. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  833. }
  834. // Domains: JSON template for Domain object in Directory API.
  835. type Domains struct {
  836. // CreationTime: Creation time of the domain. (Read-only).
  837. CreationTime int64 `json:"creationTime,omitempty,string"`
  838. // DomainAliases: List of domain alias objects. (Read-only)
  839. DomainAliases []*DomainAlias `json:"domainAliases,omitempty"`
  840. // DomainName: The domain name of the customer.
  841. DomainName string `json:"domainName,omitempty"`
  842. // Etag: ETag of the resource.
  843. Etag string `json:"etag,omitempty"`
  844. // IsPrimary: Indicates if the domain is a primary domain (Read-only).
  845. IsPrimary bool `json:"isPrimary,omitempty"`
  846. // Kind: Kind of resource this is.
  847. Kind string `json:"kind,omitempty"`
  848. // Verified: Indicates the verification state of a domain. (Read-only).
  849. Verified bool `json:"verified,omitempty"`
  850. // ServerResponse contains the HTTP response code and headers from the
  851. // server.
  852. googleapi.ServerResponse `json:"-"`
  853. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  854. // unconditionally include in API requests. By default, fields with
  855. // empty values are omitted from API requests. However, any non-pointer,
  856. // non-interface field appearing in ForceSendFields will be sent to the
  857. // server regardless of whether the field is empty or not. This may be
  858. // used to include empty fields in Patch requests.
  859. ForceSendFields []string `json:"-"`
  860. }
  861. func (s *Domains) MarshalJSON() ([]byte, error) {
  862. type noMethod Domains
  863. raw := noMethod(*s)
  864. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  865. }
  866. // Domains2: JSON response template to list Domains in Directory API.
  867. type Domains2 struct {
  868. // Domains: List of domain objects.
  869. Domains []*Domains `json:"domains,omitempty"`
  870. // Etag: ETag of the resource.
  871. Etag string `json:"etag,omitempty"`
  872. // Kind: Kind of resource this is.
  873. Kind string `json:"kind,omitempty"`
  874. // ServerResponse contains the HTTP response code and headers from the
  875. // server.
  876. googleapi.ServerResponse `json:"-"`
  877. // ForceSendFields is a list of field names (e.g. "Domains") to
  878. // unconditionally include in API requests. By default, fields with
  879. // empty values are omitted from API requests. However, any non-pointer,
  880. // non-interface field appearing in ForceSendFields will be sent to the
  881. // server regardless of whether the field is empty or not. This may be
  882. // used to include empty fields in Patch requests.
  883. ForceSendFields []string `json:"-"`
  884. }
  885. func (s *Domains2) MarshalJSON() ([]byte, error) {
  886. type noMethod Domains2
  887. raw := noMethod(*s)
  888. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  889. }
  890. // Group: JSON template for Group resource in Directory API.
  891. type Group struct {
  892. // AdminCreated: Is the group created by admin (Read-only) *
  893. AdminCreated bool `json:"adminCreated,omitempty"`
  894. // Aliases: List of aliases (Read-only)
  895. Aliases []string `json:"aliases,omitempty"`
  896. // Description: Description of the group
  897. Description string `json:"description,omitempty"`
  898. // DirectMembersCount: Group direct members count
  899. DirectMembersCount int64 `json:"directMembersCount,omitempty,string"`
  900. // Email: Email of Group
  901. Email string `json:"email,omitempty"`
  902. // Etag: ETag of the resource.
  903. Etag string `json:"etag,omitempty"`
  904. // Id: Unique identifier of Group (Read-only)
  905. Id string `json:"id,omitempty"`
  906. // Kind: Kind of resource this is.
  907. Kind string `json:"kind,omitempty"`
  908. // Name: Group name
  909. Name string `json:"name,omitempty"`
  910. // NonEditableAliases: List of non editable aliases (Read-only)
  911. NonEditableAliases []string `json:"nonEditableAliases,omitempty"`
  912. // ServerResponse contains the HTTP response code and headers from the
  913. // server.
  914. googleapi.ServerResponse `json:"-"`
  915. // ForceSendFields is a list of field names (e.g. "AdminCreated") to
  916. // unconditionally include in API requests. By default, fields with
  917. // empty values are omitted from API requests. However, any non-pointer,
  918. // non-interface field appearing in ForceSendFields will be sent to the
  919. // server regardless of whether the field is empty or not. This may be
  920. // used to include empty fields in Patch requests.
  921. ForceSendFields []string `json:"-"`
  922. }
  923. func (s *Group) MarshalJSON() ([]byte, error) {
  924. type noMethod Group
  925. raw := noMethod(*s)
  926. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  927. }
  928. // Groups: JSON response template for List Groups operation in Directory
  929. // API.
  930. type Groups struct {
  931. // Etag: ETag of the resource.
  932. Etag string `json:"etag,omitempty"`
  933. // Groups: List of group objects.
  934. Groups []*Group `json:"groups,omitempty"`
  935. // Kind: Kind of resource this is.
  936. Kind string `json:"kind,omitempty"`
  937. // NextPageToken: Token used to access next page of this result.
  938. NextPageToken string `json:"nextPageToken,omitempty"`
  939. // ServerResponse contains the HTTP response code and headers from the
  940. // server.
  941. googleapi.ServerResponse `json:"-"`
  942. // ForceSendFields is a list of field names (e.g. "Etag") to
  943. // unconditionally include in API requests. By default, fields with
  944. // empty values are omitted from API requests. However, any non-pointer,
  945. // non-interface field appearing in ForceSendFields will be sent to the
  946. // server regardless of whether the field is empty or not. This may be
  947. // used to include empty fields in Patch requests.
  948. ForceSendFields []string `json:"-"`
  949. }
  950. func (s *Groups) MarshalJSON() ([]byte, error) {
  951. type noMethod Groups
  952. raw := noMethod(*s)
  953. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  954. }
  955. // Member: JSON template for Member resource in Directory API.
  956. type Member struct {
  957. // Email: Email of member (Read-only)
  958. Email string `json:"email,omitempty"`
  959. // Etag: ETag of the resource.
  960. Etag string `json:"etag,omitempty"`
  961. // Id: Unique identifier of customer member (Read-only) Unique
  962. // identifier of group (Read-only) Unique identifier of member
  963. // (Read-only)
  964. Id string `json:"id,omitempty"`
  965. // Kind: Kind of resource this is.
  966. Kind string `json:"kind,omitempty"`
  967. // Role: Role of member
  968. Role string `json:"role,omitempty"`
  969. // Type: Type of member (Immutable)
  970. Type string `json:"type,omitempty"`
  971. // ServerResponse contains the HTTP response code and headers from the
  972. // server.
  973. googleapi.ServerResponse `json:"-"`
  974. // ForceSendFields is a list of field names (e.g. "Email") to
  975. // unconditionally include in API requests. By default, fields with
  976. // empty values are omitted from API requests. However, any non-pointer,
  977. // non-interface field appearing in ForceSendFields will be sent to the
  978. // server regardless of whether the field is empty or not. This may be
  979. // used to include empty fields in Patch requests.
  980. ForceSendFields []string `json:"-"`
  981. }
  982. func (s *Member) MarshalJSON() ([]byte, error) {
  983. type noMethod Member
  984. raw := noMethod(*s)
  985. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  986. }
  987. // Members: JSON response template for List Members operation in
  988. // Directory API.
  989. type Members struct {
  990. // Etag: ETag of the resource.
  991. Etag string `json:"etag,omitempty"`
  992. // Kind: Kind of resource this is.
  993. Kind string `json:"kind,omitempty"`
  994. // Members: List of member objects.
  995. Members []*Member `json:"members,omitempty"`
  996. // NextPageToken: Token used to access next page of this result.
  997. NextPageToken string `json:"nextPageToken,omitempty"`
  998. // ServerResponse contains the HTTP response code and headers from the
  999. // server.
  1000. googleapi.ServerResponse `json:"-"`
  1001. // ForceSendFields is a list of field names (e.g. "Etag") to
  1002. // unconditionally include in API requests. By default, fields with
  1003. // empty values are omitted from API requests. However, any non-pointer,
  1004. // non-interface field appearing in ForceSendFields will be sent to the
  1005. // server regardless of whether the field is empty or not. This may be
  1006. // used to include empty fields in Patch requests.
  1007. ForceSendFields []string `json:"-"`
  1008. }
  1009. func (s *Members) MarshalJSON() ([]byte, error) {
  1010. type noMethod Members
  1011. raw := noMethod(*s)
  1012. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1013. }
  1014. // MobileDevice: JSON template for Mobile Device resource in Directory
  1015. // API.
  1016. type MobileDevice struct {
  1017. // AdbStatus: Adb (USB debugging) enabled or disabled on device
  1018. // (Read-only)
  1019. AdbStatus bool `json:"adbStatus,omitempty"`
  1020. // Applications: List of applications installed on Mobile Device
  1021. Applications []*MobileDeviceApplications `json:"applications,omitempty"`
  1022. // BasebandVersion: Mobile Device Baseband version (Read-only)
  1023. BasebandVersion string `json:"basebandVersion,omitempty"`
  1024. // BuildNumber: Mobile Device Build number (Read-only)
  1025. BuildNumber string `json:"buildNumber,omitempty"`
  1026. // DefaultLanguage: The default locale used on the Mobile Device
  1027. // (Read-only)
  1028. DefaultLanguage string `json:"defaultLanguage,omitempty"`
  1029. // DeveloperOptionsStatus: Developer options enabled or disabled on
  1030. // device (Read-only)
  1031. DeveloperOptionsStatus bool `json:"developerOptionsStatus,omitempty"`
  1032. // DeviceCompromisedStatus: Mobile Device compromised status (Read-only)
  1033. DeviceCompromisedStatus string `json:"deviceCompromisedStatus,omitempty"`
  1034. // DeviceId: Mobile Device serial number (Read-only)
  1035. DeviceId string `json:"deviceId,omitempty"`
  1036. // Email: List of owner user's email addresses (Read-only)
  1037. Email []string `json:"email,omitempty"`
  1038. // Etag: ETag of the resource.
  1039. Etag string `json:"etag,omitempty"`
  1040. // FirstSync: Date and time the device was first synchronized with the
  1041. // policy settings in the Google Apps administrator control panel
  1042. // (Read-only)
  1043. FirstSync string `json:"firstSync,omitempty"`
  1044. // HardwareId: Mobile Device Hardware Id (Read-only)
  1045. HardwareId string `json:"hardwareId,omitempty"`
  1046. // Imei: Mobile Device IMEI number (Read-only)
  1047. Imei string `json:"imei,omitempty"`
  1048. // KernelVersion: Mobile Device Kernel version (Read-only)
  1049. KernelVersion string `json:"kernelVersion,omitempty"`
  1050. // Kind: Kind of resource this is.
  1051. Kind string `json:"kind,omitempty"`
  1052. // LastSync: Date and time the device was last synchronized with the
  1053. // policy settings in the Google Apps administrator control panel
  1054. // (Read-only)
  1055. LastSync string `json:"lastSync,omitempty"`
  1056. // ManagedAccountIsOnOwnerProfile: Boolean indicating if this account is
  1057. // on owner/primary profile or not (Read-only)
  1058. ManagedAccountIsOnOwnerProfile bool `json:"managedAccountIsOnOwnerProfile,omitempty"`
  1059. // Meid: Mobile Device MEID number (Read-only)
  1060. Meid string `json:"meid,omitempty"`
  1061. // Model: Name of the model of the device
  1062. Model string `json:"model,omitempty"`
  1063. // Name: List of owner user's names (Read-only)
  1064. Name []string `json:"name,omitempty"`
  1065. // NetworkOperator: Mobile Device mobile or network operator (if
  1066. // available) (Read-only)
  1067. NetworkOperator string `json:"networkOperator,omitempty"`
  1068. // Os: Name of the mobile operating system
  1069. Os string `json:"os,omitempty"`
  1070. // OtherAccountsInfo: List of accounts added on device (Read-only)
  1071. OtherAccountsInfo []string `json:"otherAccountsInfo,omitempty"`
  1072. // ResourceId: Unique identifier of Mobile Device (Read-only)
  1073. ResourceId string `json:"resourceId,omitempty"`
  1074. // SerialNumber: Mobile Device SSN or Serial Number (Read-only)
  1075. SerialNumber string `json:"serialNumber,omitempty"`
  1076. // Status: Status of the device (Read-only)
  1077. Status string `json:"status,omitempty"`
  1078. // SupportsWorkProfile: Work profile supported on device (Read-only)
  1079. SupportsWorkProfile bool `json:"supportsWorkProfile,omitempty"`
  1080. // Type: The type of device (Read-only)
  1081. Type string `json:"type,omitempty"`
  1082. // UnknownSourcesStatus: Unknown sources enabled or disabled on device
  1083. // (Read-only)
  1084. UnknownSourcesStatus bool `json:"unknownSourcesStatus,omitempty"`
  1085. // UserAgent: Mobile Device user agent
  1086. UserAgent string `json:"userAgent,omitempty"`
  1087. // WifiMacAddress: Mobile Device WiFi MAC address (Read-only)
  1088. WifiMacAddress string `json:"wifiMacAddress,omitempty"`
  1089. // ServerResponse contains the HTTP response code and headers from the
  1090. // server.
  1091. googleapi.ServerResponse `json:"-"`
  1092. // ForceSendFields is a list of field names (e.g. "AdbStatus") to
  1093. // unconditionally include in API requests. By default, fields with
  1094. // empty values are omitted from API requests. However, any non-pointer,
  1095. // non-interface field appearing in ForceSendFields will be sent to the
  1096. // server regardless of whether the field is empty or not. This may be
  1097. // used to include empty fields in Patch requests.
  1098. ForceSendFields []string `json:"-"`
  1099. }
  1100. func (s *MobileDevice) MarshalJSON() ([]byte, error) {
  1101. type noMethod MobileDevice
  1102. raw := noMethod(*s)
  1103. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1104. }
  1105. type MobileDeviceApplications struct {
  1106. // DisplayName: Display name of application
  1107. DisplayName string `json:"displayName,omitempty"`
  1108. // PackageName: Package name of application
  1109. PackageName string `json:"packageName,omitempty"`
  1110. // Permission: List of Permissions for application
  1111. Permission []string `json:"permission,omitempty"`
  1112. // VersionCode: Version code of application
  1113. VersionCode int64 `json:"versionCode,omitempty"`
  1114. // VersionName: Version name of application
  1115. VersionName string `json:"versionName,omitempty"`
  1116. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  1117. // unconditionally include in API requests. By default, fields with
  1118. // empty values are omitted from API requests. However, any non-pointer,
  1119. // non-interface field appearing in ForceSendFields will be sent to the
  1120. // server regardless of whether the field is empty or not. This may be
  1121. // used to include empty fields in Patch requests.
  1122. ForceSendFields []string `json:"-"`
  1123. }
  1124. func (s *MobileDeviceApplications) MarshalJSON() ([]byte, error) {
  1125. type noMethod MobileDeviceApplications
  1126. raw := noMethod(*s)
  1127. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1128. }
  1129. // MobileDeviceAction: JSON request template for firing commands on
  1130. // Mobile Device in Directory Devices API.
  1131. type MobileDeviceAction struct {
  1132. // Action: Action to be taken on the Mobile Device
  1133. Action string `json:"action,omitempty"`
  1134. // ForceSendFields is a list of field names (e.g. "Action") to
  1135. // unconditionally include in API requests. By default, fields with
  1136. // empty values are omitted from API requests. However, any non-pointer,
  1137. // non-interface field appearing in ForceSendFields will be sent to the
  1138. // server regardless of whether the field is empty or not. This may be
  1139. // used to include empty fields in Patch requests.
  1140. ForceSendFields []string `json:"-"`
  1141. }
  1142. func (s *MobileDeviceAction) MarshalJSON() ([]byte, error) {
  1143. type noMethod MobileDeviceAction
  1144. raw := noMethod(*s)
  1145. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1146. }
  1147. // MobileDevices: JSON response template for List Mobile Devices
  1148. // operation in Directory API.
  1149. type MobileDevices struct {
  1150. // Etag: ETag of the resource.
  1151. Etag string `json:"etag,omitempty"`
  1152. // Kind: Kind of resource this is.
  1153. Kind string `json:"kind,omitempty"`
  1154. // Mobiledevices: List of Mobile Device objects.
  1155. Mobiledevices []*MobileDevice `json:"mobiledevices,omitempty"`
  1156. // NextPageToken: Token used to access next page of this result.
  1157. NextPageToken string `json:"nextPageToken,omitempty"`
  1158. // ServerResponse contains the HTTP response code and headers from the
  1159. // server.
  1160. googleapi.ServerResponse `json:"-"`
  1161. // ForceSendFields is a list of field names (e.g. "Etag") to
  1162. // unconditionally include in API requests. By default, fields with
  1163. // empty values are omitted from API requests. However, any non-pointer,
  1164. // non-interface field appearing in ForceSendFields will be sent to the
  1165. // server regardless of whether the field is empty or not. This may be
  1166. // used to include empty fields in Patch requests.
  1167. ForceSendFields []string `json:"-"`
  1168. }
  1169. func (s *MobileDevices) MarshalJSON() ([]byte, error) {
  1170. type noMethod MobileDevices
  1171. raw := noMethod(*s)
  1172. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1173. }
  1174. // Notification: Template for a notification resource.
  1175. type Notification struct {
  1176. // Body: Body of the notification (Read-only)
  1177. Body string `json:"body,omitempty"`
  1178. // Etag: ETag of the resource.
  1179. Etag string `json:"etag,omitempty"`
  1180. // FromAddress: Address from which the notification is received
  1181. // (Read-only)
  1182. FromAddress string `json:"fromAddress,omitempty"`
  1183. // IsUnread: Boolean indicating whether the notification is unread or
  1184. // not.
  1185. IsUnread bool `json:"isUnread,omitempty"`
  1186. // Kind: The type of the resource.
  1187. Kind string `json:"kind,omitempty"`
  1188. NotificationId string `json:"notificationId,omitempty"`
  1189. // SendTime: Time at which notification was sent (Read-only)
  1190. SendTime string `json:"sendTime,omitempty"`
  1191. // Subject: Subject of the notification (Read-only)
  1192. Subject string `json:"subject,omitempty"`
  1193. // ServerResponse contains the HTTP response code and headers from the
  1194. // server.
  1195. googleapi.ServerResponse `json:"-"`
  1196. // ForceSendFields is a list of field names (e.g. "Body") to
  1197. // unconditionally include in API requests. By default, fields with
  1198. // empty values are omitted from API requests. However, any non-pointer,
  1199. // non-interface field appearing in ForceSendFields will be sent to the
  1200. // server regardless of whether the field is empty or not. This may be
  1201. // used to include empty fields in Patch requests.
  1202. ForceSendFields []string `json:"-"`
  1203. }
  1204. func (s *Notification) MarshalJSON() ([]byte, error) {
  1205. type noMethod Notification
  1206. raw := noMethod(*s)
  1207. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1208. }
  1209. // Notifications: Template for notifications list response.
  1210. type Notifications struct {
  1211. // Etag: ETag of the resource.
  1212. Etag string `json:"etag,omitempty"`
  1213. // Items: List of notifications in this page.
  1214. Items []*Notification `json:"items,omitempty"`
  1215. // Kind: The type of the resource.
  1216. Kind string `json:"kind,omitempty"`
  1217. // NextPageToken: Token for fetching the next page of notifications.
  1218. NextPageToken string `json:"nextPageToken,omitempty"`
  1219. // UnreadNotificationsCount: Number of unread notification for the
  1220. // domain.
  1221. UnreadNotificationsCount int64 `json:"unreadNotificationsCount,omitempty"`
  1222. // ServerResponse contains the HTTP response code and headers from the
  1223. // server.
  1224. googleapi.ServerResponse `json:"-"`
  1225. // ForceSendFields is a list of field names (e.g. "Etag") to
  1226. // unconditionally include in API requests. By default, fields with
  1227. // empty values are omitted from API requests. However, any non-pointer,
  1228. // non-interface field appearing in ForceSendFields will be sent to the
  1229. // server regardless of whether the field is empty or not. This may be
  1230. // used to include empty fields in Patch requests.
  1231. ForceSendFields []string `json:"-"`
  1232. }
  1233. func (s *Notifications) MarshalJSON() ([]byte, error) {
  1234. type noMethod Notifications
  1235. raw := noMethod(*s)
  1236. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1237. }
  1238. // OrgUnit: JSON template for Org Unit resource in Directory API.
  1239. type OrgUnit struct {
  1240. // BlockInheritance: Should block inheritance
  1241. BlockInheritance bool `json:"blockInheritance,omitempty"`
  1242. // Description: Description of OrgUnit
  1243. Description string `json:"description,omitempty"`
  1244. // Etag: ETag of the resource.
  1245. Etag string `json:"etag,omitempty"`
  1246. // Kind: Kind of resource this is.
  1247. Kind string `json:"kind,omitempty"`
  1248. // Name: Name of OrgUnit
  1249. Name string `json:"name,omitempty"`
  1250. // OrgUnitId: Id of OrgUnit
  1251. OrgUnitId string `json:"orgUnitId,omitempty"`
  1252. // OrgUnitPath: Path of OrgUnit
  1253. OrgUnitPath string `json:"orgUnitPath,omitempty"`
  1254. // ParentOrgUnitId: Id of parent OrgUnit
  1255. ParentOrgUnitId string `json:"parentOrgUnitId,omitempty"`
  1256. // ParentOrgUnitPath: Path of parent OrgUnit
  1257. ParentOrgUnitPath string `json:"parentOrgUnitPath,omitempty"`
  1258. // ServerResponse contains the HTTP response code and headers from the
  1259. // server.
  1260. googleapi.ServerResponse `json:"-"`
  1261. // ForceSendFields is a list of field names (e.g. "BlockInheritance") to
  1262. // unconditionally include in API requests. By default, fields with
  1263. // empty values are omitted from API requests. However, any non-pointer,
  1264. // non-interface field appearing in ForceSendFields will be sent to the
  1265. // server regardless of whether the field is empty or not. This may be
  1266. // used to include empty fields in Patch requests.
  1267. ForceSendFields []string `json:"-"`
  1268. }
  1269. func (s *OrgUnit) MarshalJSON() ([]byte, error) {
  1270. type noMethod OrgUnit
  1271. raw := noMethod(*s)
  1272. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1273. }
  1274. // OrgUnits: JSON response template for List Organization Units
  1275. // operation in Directory API.
  1276. type OrgUnits struct {
  1277. // Etag: ETag of the resource.
  1278. Etag string `json:"etag,omitempty"`
  1279. // Kind: Kind of resource this is.
  1280. Kind string `json:"kind,omitempty"`
  1281. // OrganizationUnits: List of user objects.
  1282. OrganizationUnits []*OrgUnit `json:"organizationUnits,omitempty"`
  1283. // ServerResponse contains the HTTP response code and headers from the
  1284. // server.
  1285. googleapi.ServerResponse `json:"-"`
  1286. // ForceSendFields is a list of field names (e.g. "Etag") to
  1287. // unconditionally include in API requests. By default, fields with
  1288. // empty values are omitted from API requests. However, any non-pointer,
  1289. // non-interface field appearing in ForceSendFields will be sent to the
  1290. // server regardless of whether the field is empty or not. This may be
  1291. // used to include empty fields in Patch requests.
  1292. ForceSendFields []string `json:"-"`
  1293. }
  1294. func (s *OrgUnits) MarshalJSON() ([]byte, error) {
  1295. type noMethod OrgUnits
  1296. raw := noMethod(*s)
  1297. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1298. }
  1299. // Privilege: JSON template for privilege resource in Directory API.
  1300. type Privilege struct {
  1301. // ChildPrivileges: A list of child privileges. Privileges for a service
  1302. // form a tree. Each privilege can have a list of child privileges; this
  1303. // list is empty for a leaf privilege.
  1304. ChildPrivileges []*Privilege `json:"childPrivileges,omitempty"`
  1305. // Etag: ETag of the resource.
  1306. Etag string `json:"etag,omitempty"`
  1307. // IsOuScopable: If the privilege can be restricted to an organization
  1308. // unit.
  1309. IsOuScopable bool `json:"isOuScopable,omitempty"`
  1310. // Kind: The type of the API resource. This is always
  1311. // admin#directory#privilege.
  1312. Kind string `json:"kind,omitempty"`
  1313. // PrivilegeName: The name of the privilege.
  1314. PrivilegeName string `json:"privilegeName,omitempty"`
  1315. // ServiceId: The obfuscated ID of the service this privilege is for.
  1316. ServiceId string `json:"serviceId,omitempty"`
  1317. // ServiceName: The name of the service this privilege is for.
  1318. ServiceName string `json:"serviceName,omitempty"`
  1319. // ForceSendFields is a list of field names (e.g. "ChildPrivileges") to
  1320. // unconditionally include in API requests. By default, fields with
  1321. // empty values are omitted from API requests. However, any non-pointer,
  1322. // non-interface field appearing in ForceSendFields will be sent to the
  1323. // server regardless of whether the field is empty or not. This may be
  1324. // used to include empty fields in Patch requests.
  1325. ForceSendFields []string `json:"-"`
  1326. }
  1327. func (s *Privilege) MarshalJSON() ([]byte, error) {
  1328. type noMethod Privilege
  1329. raw := noMethod(*s)
  1330. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1331. }
  1332. // Privileges: JSON response template for List privileges operation in
  1333. // Directory API.
  1334. type Privileges struct {
  1335. // Etag: ETag of the resource.
  1336. Etag string `json:"etag,omitempty"`
  1337. // Items: A list of Privilege resources.
  1338. Items []*Privilege `json:"items,omitempty"`
  1339. // Kind: The type of the API resource. This is always
  1340. // admin#directory#privileges.
  1341. Kind string `json:"kind,omitempty"`
  1342. // ServerResponse contains the HTTP response code and headers from the
  1343. // server.
  1344. googleapi.ServerResponse `json:"-"`
  1345. // ForceSendFields is a list of field names (e.g. "Etag") to
  1346. // unconditionally include in API requests. By default, fields with
  1347. // empty values are omitted from API requests. However, any non-pointer,
  1348. // non-interface field appearing in ForceSendFields will be sent to the
  1349. // server regardless of whether the field is empty or not. This may be
  1350. // used to include empty fields in Patch requests.
  1351. ForceSendFields []string `json:"-"`
  1352. }
  1353. func (s *Privileges) MarshalJSON() ([]byte, error) {
  1354. type noMethod Privileges
  1355. raw := noMethod(*s)
  1356. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1357. }
  1358. // Role: JSON template for role resource in Directory API.
  1359. type Role struct {
  1360. // Etag: ETag of the resource.
  1361. Etag string `json:"etag,omitempty"`
  1362. // IsSuperAdminRole: Returns true if the role is a super admin role.
  1363. IsSuperAdminRole bool `json:"isSuperAdminRole,omitempty"`
  1364. // IsSystemRole: Returns true if this is a pre-defined system role.
  1365. IsSystemRole bool `json:"isSystemRole,omitempty"`
  1366. // Kind: The type of the API resource. This is always
  1367. // admin#directory#role.
  1368. Kind string `json:"kind,omitempty"`
  1369. // RoleDescription: A short description of the role.
  1370. RoleDescription string `json:"roleDescription,omitempty"`
  1371. // RoleId: ID of the role.
  1372. RoleId int64 `json:"roleId,omitempty,string"`
  1373. // RoleName: Name of the role.
  1374. RoleName string `json:"roleName,omitempty"`
  1375. // RolePrivileges: The set of privileges that are granted to this role.
  1376. RolePrivileges []*RoleRolePrivileges `json:"rolePrivileges,omitempty"`
  1377. // ServerResponse contains the HTTP response code and headers from the
  1378. // server.
  1379. googleapi.ServerResponse `json:"-"`
  1380. // ForceSendFields is a list of field names (e.g. "Etag") to
  1381. // unconditionally include in API requests. By default, fields with
  1382. // empty values are omitted from API requests. However, any non-pointer,
  1383. // non-interface field appearing in ForceSendFields will be sent to the
  1384. // server regardless of whether the field is empty or not. This may be
  1385. // used to include empty fields in Patch requests.
  1386. ForceSendFields []string `json:"-"`
  1387. }
  1388. func (s *Role) MarshalJSON() ([]byte, error) {
  1389. type noMethod Role
  1390. raw := noMethod(*s)
  1391. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1392. }
  1393. type RoleRolePrivileges struct {
  1394. // PrivilegeName: The name of the privilege.
  1395. PrivilegeName string `json:"privilegeName,omitempty"`
  1396. // ServiceId: The obfuscated ID of the service this privilege is for.
  1397. ServiceId string `json:"serviceId,omitempty"`
  1398. // ForceSendFields is a list of field names (e.g. "PrivilegeName") to
  1399. // unconditionally include in API requests. By default, fields with
  1400. // empty values are omitted from API requests. However, any non-pointer,
  1401. // non-interface field appearing in ForceSendFields will be sent to the
  1402. // server regardless of whether the field is empty or not. This may be
  1403. // used to include empty fields in Patch requests.
  1404. ForceSendFields []string `json:"-"`
  1405. }
  1406. func (s *RoleRolePrivileges) MarshalJSON() ([]byte, error) {
  1407. type noMethod RoleRolePrivileges
  1408. raw := noMethod(*s)
  1409. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1410. }
  1411. // RoleAssignment: JSON template for roleAssignment resource in
  1412. // Directory API.
  1413. type RoleAssignment struct {
  1414. // AssignedTo: The unique ID of the user this role is assigned to.
  1415. AssignedTo string `json:"assignedTo,omitempty"`
  1416. // Etag: ETag of the resource.
  1417. Etag string `json:"etag,omitempty"`
  1418. // Kind: The type of the API resource. This is always
  1419. // admin#directory#roleAssignment.
  1420. Kind string `json:"kind,omitempty"`
  1421. // OrgUnitId: If the role is restricted to an organization unit, this
  1422. // contains the ID for the organization unit the exercise of this role
  1423. // is restricted to.
  1424. OrgUnitId string `json:"orgUnitId,omitempty"`
  1425. // RoleAssignmentId: ID of this roleAssignment.
  1426. RoleAssignmentId int64 `json:"roleAssignmentId,omitempty,string"`
  1427. // RoleId: The ID of the role that is assigned.
  1428. RoleId int64 `json:"roleId,omitempty,string"`
  1429. // ScopeType: The scope in which this role is assigned. Possible values
  1430. // are:
  1431. // - CUSTOMER
  1432. // - ORG_UNIT
  1433. ScopeType string `json:"scopeType,omitempty"`
  1434. // ServerResponse contains the HTTP response code and headers from the
  1435. // server.
  1436. googleapi.ServerResponse `json:"-"`
  1437. // ForceSendFields is a list of field names (e.g. "AssignedTo") to
  1438. // unconditionally include in API requests. By default, fields with
  1439. // empty values are omitted from API requests. However, any non-pointer,
  1440. // non-interface field appearing in ForceSendFields will be sent to the
  1441. // server regardless of whether the field is empty or not. This may be
  1442. // used to include empty fields in Patch requests.
  1443. ForceSendFields []string `json:"-"`
  1444. }
  1445. func (s *RoleAssignment) MarshalJSON() ([]byte, error) {
  1446. type noMethod RoleAssignment
  1447. raw := noMethod(*s)
  1448. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1449. }
  1450. // RoleAssignments: JSON response template for List roleAssignments
  1451. // operation in Directory API.
  1452. type RoleAssignments struct {
  1453. // Etag: ETag of the resource.
  1454. Etag string `json:"etag,omitempty"`
  1455. // Items: A list of RoleAssignment resources.
  1456. Items []*RoleAssignment `json:"items,omitempty"`
  1457. // Kind: The type of the API resource. This is always
  1458. // admin#directory#roleAssignments.
  1459. Kind string `json:"kind,omitempty"`
  1460. NextPageToken string `json:"nextPageToken,omitempty"`
  1461. // ServerResponse contains the HTTP response code and headers from the
  1462. // server.
  1463. googleapi.ServerResponse `json:"-"`
  1464. // ForceSendFields is a list of field names (e.g. "Etag") to
  1465. // unconditionally include in API requests. By default, fields with
  1466. // empty values are omitted from API requests. However, any non-pointer,
  1467. // non-interface field appearing in ForceSendFields will be sent to the
  1468. // server regardless of whether the field is empty or not. This may be
  1469. // used to include empty fields in Patch requests.
  1470. ForceSendFields []string `json:"-"`
  1471. }
  1472. func (s *RoleAssignments) MarshalJSON() ([]byte, error) {
  1473. type noMethod RoleAssignments
  1474. raw := noMethod(*s)
  1475. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1476. }
  1477. // Roles: JSON response template for List roles operation in Directory
  1478. // API.
  1479. type Roles struct {
  1480. // Etag: ETag of the resource.
  1481. Etag string `json:"etag,omitempty"`
  1482. // Items: A list of Role resources.
  1483. Items []*Role `json:"items,omitempty"`
  1484. // Kind: The type of the API resource. This is always
  1485. // admin#directory#roles.
  1486. Kind string `json:"kind,omitempty"`
  1487. NextPageToken string `json:"nextPageToken,omitempty"`
  1488. // ServerResponse contains the HTTP response code and headers from the
  1489. // server.
  1490. googleapi.ServerResponse `json:"-"`
  1491. // ForceSendFields is a list of field names (e.g. "Etag") to
  1492. // unconditionally include in API requests. By default, fields with
  1493. // empty values are omitted from API requests. However, any non-pointer,
  1494. // non-interface field appearing in ForceSendFields will be sent to the
  1495. // server regardless of whether the field is empty or not. This may be
  1496. // used to include empty fields in Patch requests.
  1497. ForceSendFields []string `json:"-"`
  1498. }
  1499. func (s *Roles) MarshalJSON() ([]byte, error) {
  1500. type noMethod Roles
  1501. raw := noMethod(*s)
  1502. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1503. }
  1504. // Schema: JSON template for Schema resource in Directory API.
  1505. type Schema struct {
  1506. // Etag: ETag of the resource.
  1507. Etag string `json:"etag,omitempty"`
  1508. // Fields: Fields of Schema
  1509. Fields []*SchemaFieldSpec `json:"fields,omitempty"`
  1510. // Kind: Kind of resource this is.
  1511. Kind string `json:"kind,omitempty"`
  1512. // SchemaId: Unique identifier of Schema (Read-only)
  1513. SchemaId string `json:"schemaId,omitempty"`
  1514. // SchemaName: Schema name
  1515. SchemaName string `json:"schemaName,omitempty"`
  1516. // ServerResponse contains the HTTP response code and headers from the
  1517. // server.
  1518. googleapi.ServerResponse `json:"-"`
  1519. // ForceSendFields is a list of field names (e.g. "Etag") to
  1520. // unconditionally include in API requests. By default, fields with
  1521. // empty values are omitted from API requests. However, any non-pointer,
  1522. // non-interface field appearing in ForceSendFields will be sent to the
  1523. // server regardless of whether the field is empty or not. This may be
  1524. // used to include empty fields in Patch requests.
  1525. ForceSendFields []string `json:"-"`
  1526. }
  1527. func (s *Schema) MarshalJSON() ([]byte, error) {
  1528. type noMethod Schema
  1529. raw := noMethod(*s)
  1530. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1531. }
  1532. // SchemaFieldSpec: JSON template for FieldSpec resource for Schemas in
  1533. // Directory API.
  1534. type SchemaFieldSpec struct {
  1535. // Etag: ETag of the resource.
  1536. Etag string `json:"etag,omitempty"`
  1537. // FieldId: Unique identifier of Field (Read-only)
  1538. FieldId string `json:"fieldId,omitempty"`
  1539. // FieldName: Name of the field.
  1540. FieldName string `json:"fieldName,omitempty"`
  1541. // FieldType: Type of the field.
  1542. FieldType string `json:"fieldType,omitempty"`
  1543. // Indexed: Boolean specifying whether the field is indexed or not.
  1544. //
  1545. // Default: true
  1546. Indexed *bool `json:"indexed,omitempty"`
  1547. // Kind: Kind of resource this is.
  1548. Kind string `json:"kind,omitempty"`
  1549. // MultiValued: Boolean specifying whether this is a multi-valued field
  1550. // or not.
  1551. MultiValued bool `json:"multiValued,omitempty"`
  1552. // NumericIndexingSpec: Indexing spec for a numeric field. By default,
  1553. // only exact match queries will be supported for numeric fields.
  1554. // Setting the numericIndexingSpec allows range queries to be supported.
  1555. NumericIndexingSpec *SchemaFieldSpecNumericIndexingSpec `json:"numericIndexingSpec,omitempty"`
  1556. // ReadAccessType: Read ACLs on the field specifying who can view values
  1557. // of this field. Valid values are "ALL_DOMAIN_USERS" and
  1558. // "ADMINS_AND_SELF".
  1559. ReadAccessType string `json:"readAccessType,omitempty"`
  1560. // ForceSendFields is a list of field names (e.g. "Etag") to
  1561. // unconditionally include in API requests. By default, fields with
  1562. // empty values are omitted from API requests. However, any non-pointer,
  1563. // non-interface field appearing in ForceSendFields will be sent to the
  1564. // server regardless of whether the field is empty or not. This may be
  1565. // used to include empty fields in Patch requests.
  1566. ForceSendFields []string `json:"-"`
  1567. }
  1568. func (s *SchemaFieldSpec) MarshalJSON() ([]byte, error) {
  1569. type noMethod SchemaFieldSpec
  1570. raw := noMethod(*s)
  1571. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1572. }
  1573. // SchemaFieldSpecNumericIndexingSpec: Indexing spec for a numeric
  1574. // field. By default, only exact match queries will be supported for
  1575. // numeric fields. Setting the numericIndexingSpec allows range queries
  1576. // to be supported.
  1577. type SchemaFieldSpecNumericIndexingSpec struct {
  1578. // MaxValue: Maximum value of this field. This is meant to be indicative
  1579. // rather than enforced. Values outside this range will still be
  1580. // indexed, but search may not be as performant.
  1581. MaxValue float64 `json:"maxValue,omitempty"`
  1582. // MinValue: Minimum value of this field. This is meant to be indicative
  1583. // rather than enforced. Values outside this range will still be
  1584. // indexed, but search may not be as performant.
  1585. MinValue float64 `json:"minValue,omitempty"`
  1586. // ForceSendFields is a list of field names (e.g. "MaxValue") to
  1587. // unconditionally include in API requests. By default, fields with
  1588. // empty values are omitted from API requests. However, any non-pointer,
  1589. // non-interface field appearing in ForceSendFields will be sent to the
  1590. // server regardless of whether the field is empty or not. This may be
  1591. // used to include empty fields in Patch requests.
  1592. ForceSendFields []string `json:"-"`
  1593. }
  1594. func (s *SchemaFieldSpecNumericIndexingSpec) MarshalJSON() ([]byte, error) {
  1595. type noMethod SchemaFieldSpecNumericIndexingSpec
  1596. raw := noMethod(*s)
  1597. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1598. }
  1599. // Schemas: JSON response template for List Schema operation in
  1600. // Directory API.
  1601. type Schemas struct {
  1602. // Etag: ETag of the resource.
  1603. Etag string `json:"etag,omitempty"`
  1604. // Kind: Kind of resource this is.
  1605. Kind string `json:"kind,omitempty"`
  1606. // Schemas: List of UserSchema objects.
  1607. Schemas []*Schema `json:"schemas,omitempty"`
  1608. // ServerResponse contains the HTTP response code and headers from the
  1609. // server.
  1610. googleapi.ServerResponse `json:"-"`
  1611. // ForceSendFields is a list of field names (e.g. "Etag") to
  1612. // unconditionally include in API requests. By default, fields with
  1613. // empty values are omitted from API requests. However, any non-pointer,
  1614. // non-interface field appearing in ForceSendFields will be sent to the
  1615. // server regardless of whether the field is empty or not. This may be
  1616. // used to include empty fields in Patch requests.
  1617. ForceSendFields []string `json:"-"`
  1618. }
  1619. func (s *Schemas) MarshalJSON() ([]byte, error) {
  1620. type noMethod Schemas
  1621. raw := noMethod(*s)
  1622. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1623. }
  1624. // Token: JSON template for token resource in Directory API.
  1625. type Token struct {
  1626. // Anonymous: Whether the application is registered with Google. The
  1627. // value is true if the application has an anonymous Client ID.
  1628. Anonymous bool `json:"anonymous,omitempty"`
  1629. // ClientId: The Client ID of the application the token is issued to.
  1630. ClientId string `json:"clientId,omitempty"`
  1631. // DisplayText: The displayable name of the application the token is
  1632. // issued to.
  1633. DisplayText string `json:"displayText,omitempty"`
  1634. // Etag: ETag of the resource.
  1635. Etag string `json:"etag,omitempty"`
  1636. // Kind: The type of the API resource. This is always
  1637. // admin#directory#token.
  1638. Kind string `json:"kind,omitempty"`
  1639. // NativeApp: Whether the token is issued to an installed application.
  1640. // The value is true if the application is installed to a desktop or
  1641. // mobile device.
  1642. NativeApp bool `json:"nativeApp,omitempty"`
  1643. // Scopes: A list of authorization scopes the application is granted.
  1644. Scopes []string `json:"scopes,omitempty"`
  1645. // UserKey: The unique ID of the user that issued the token.
  1646. UserKey string `json:"userKey,omitempty"`
  1647. // ServerResponse contains the HTTP response code and headers from the
  1648. // server.
  1649. googleapi.ServerResponse `json:"-"`
  1650. // ForceSendFields is a list of field names (e.g. "Anonymous") to
  1651. // unconditionally include in API requests. By default, fields with
  1652. // empty values are omitted from API requests. However, any non-pointer,
  1653. // non-interface field appearing in ForceSendFields will be sent to the
  1654. // server regardless of whether the field is empty or not. This may be
  1655. // used to include empty fields in Patch requests.
  1656. ForceSendFields []string `json:"-"`
  1657. }
  1658. func (s *Token) MarshalJSON() ([]byte, error) {
  1659. type noMethod Token
  1660. raw := noMethod(*s)
  1661. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1662. }
  1663. // Tokens: JSON response template for List tokens operation in Directory
  1664. // API.
  1665. type Tokens struct {
  1666. // Etag: ETag of the resource.
  1667. Etag string `json:"etag,omitempty"`
  1668. // Items: A list of Token resources.
  1669. Items []*Token `json:"items,omitempty"`
  1670. // Kind: The type of the API resource. This is always
  1671. // admin#directory#tokenList.
  1672. Kind string `json:"kind,omitempty"`
  1673. // ServerResponse contains the HTTP response code and headers from the
  1674. // server.
  1675. googleapi.ServerResponse `json:"-"`
  1676. // ForceSendFields is a list of field names (e.g. "Etag") to
  1677. // unconditionally include in API requests. By default, fields with
  1678. // empty values are omitted from API requests. However, any non-pointer,
  1679. // non-interface field appearing in ForceSendFields will be sent to the
  1680. // server regardless of whether the field is empty or not. This may be
  1681. // used to include empty fields in Patch requests.
  1682. ForceSendFields []string `json:"-"`
  1683. }
  1684. func (s *Tokens) MarshalJSON() ([]byte, error) {
  1685. type noMethod Tokens
  1686. raw := noMethod(*s)
  1687. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1688. }
  1689. // User: JSON template for User object in Directory API.
  1690. type User struct {
  1691. Addresses interface{} `json:"addresses,omitempty"`
  1692. // AgreedToTerms: Indicates if user has agreed to terms (Read-only)
  1693. AgreedToTerms bool `json:"agreedToTerms,omitempty"`
  1694. // Aliases: List of aliases (Read-only)
  1695. Aliases []string `json:"aliases,omitempty"`
  1696. // ChangePasswordAtNextLogin: Boolean indicating if the user should
  1697. // change password in next login
  1698. ChangePasswordAtNextLogin bool `json:"changePasswordAtNextLogin,omitempty"`
  1699. // CreationTime: User's Google account creation time. (Read-only)
  1700. CreationTime string `json:"creationTime,omitempty"`
  1701. // CustomSchemas: Custom fields of the user.
  1702. CustomSchemas map[string]UserCustomProperties `json:"customSchemas,omitempty"`
  1703. // CustomerId: CustomerId of User (Read-only)
  1704. CustomerId string `json:"customerId,omitempty"`
  1705. DeletionTime string `json:"deletionTime,omitempty"`
  1706. Emails interface{} `json:"emails,omitempty"`
  1707. // Etag: ETag of the resource.
  1708. Etag string `json:"etag,omitempty"`
  1709. ExternalIds interface{} `json:"externalIds,omitempty"`
  1710. // HashFunction: Hash function name for password. Supported are MD5,
  1711. // SHA-1 and crypt
  1712. HashFunction string `json:"hashFunction,omitempty"`
  1713. // Id: Unique identifier of User (Read-only)
  1714. Id string `json:"id,omitempty"`
  1715. Ims interface{} `json:"ims,omitempty"`
  1716. // IncludeInGlobalAddressList: Boolean indicating if user is included in
  1717. // Global Address List
  1718. IncludeInGlobalAddressList bool `json:"includeInGlobalAddressList,omitempty"`
  1719. // IpWhitelisted: Boolean indicating if ip is whitelisted
  1720. IpWhitelisted bool `json:"ipWhitelisted,omitempty"`
  1721. // IsAdmin: Boolean indicating if the user is admin (Read-only)
  1722. IsAdmin bool `json:"isAdmin,omitempty"`
  1723. // IsDelegatedAdmin: Boolean indicating if the user is delegated admin
  1724. // (Read-only)
  1725. IsDelegatedAdmin bool `json:"isDelegatedAdmin,omitempty"`
  1726. // IsMailboxSetup: Is mailbox setup (Read-only)
  1727. IsMailboxSetup bool `json:"isMailboxSetup,omitempty"`
  1728. // Kind: Kind of resource this is.
  1729. Kind string `json:"kind,omitempty"`
  1730. // LastLoginTime: User's last login time. (Read-only)
  1731. LastLoginTime string `json:"lastLoginTime,omitempty"`
  1732. // Name: User's name
  1733. Name *UserName `json:"name,omitempty"`
  1734. // NonEditableAliases: List of non editable aliases (Read-only)
  1735. NonEditableAliases []string `json:"nonEditableAliases,omitempty"`
  1736. Notes interface{} `json:"notes,omitempty"`
  1737. // OrgUnitPath: OrgUnit of User
  1738. OrgUnitPath string `json:"orgUnitPath,omitempty"`
  1739. Organizations interface{} `json:"organizations,omitempty"`
  1740. // Password: User's password
  1741. Password string `json:"password,omitempty"`
  1742. Phones interface{} `json:"phones,omitempty"`
  1743. // PrimaryEmail: username of User
  1744. PrimaryEmail string `json:"primaryEmail,omitempty"`
  1745. Relations interface{} `json:"relations,omitempty"`
  1746. // Suspended: Indicates if user is suspended
  1747. Suspended bool `json:"suspended,omitempty"`
  1748. // SuspensionReason: Suspension reason if user is suspended (Read-only)
  1749. SuspensionReason string `json:"suspensionReason,omitempty"`
  1750. // ThumbnailPhotoEtag: ETag of the user's photo (Read-only)
  1751. ThumbnailPhotoEtag string `json:"thumbnailPhotoEtag,omitempty"`
  1752. // ThumbnailPhotoUrl: Photo Url of the user (Read-only)
  1753. ThumbnailPhotoUrl string `json:"thumbnailPhotoUrl,omitempty"`
  1754. Websites interface{} `json:"websites,omitempty"`
  1755. // ServerResponse contains the HTTP response code and headers from the
  1756. // server.
  1757. googleapi.ServerResponse `json:"-"`
  1758. // ForceSendFields is a list of field names (e.g. "Addresses") to
  1759. // unconditionally include in API requests. By default, fields with
  1760. // empty values are omitted from API requests. However, any non-pointer,
  1761. // non-interface field appearing in ForceSendFields will be sent to the
  1762. // server regardless of whether the field is empty or not. This may be
  1763. // used to include empty fields in Patch requests.
  1764. ForceSendFields []string `json:"-"`
  1765. }
  1766. func (s *User) MarshalJSON() ([]byte, error) {
  1767. type noMethod User
  1768. raw := noMethod(*s)
  1769. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1770. }
  1771. // UserAbout: JSON template for About (notes) of a user in Directory
  1772. // API.
  1773. type UserAbout struct {
  1774. // ContentType: About entry can have a type which indicates the content
  1775. // type. It can either be plain or html. By default, notes contents are
  1776. // assumed to contain plain text.
  1777. ContentType string `json:"contentType,omitempty"`
  1778. // Value: Actual value of notes.
  1779. Value string `json:"value,omitempty"`
  1780. // ForceSendFields is a list of field names (e.g. "ContentType") to
  1781. // unconditionally include in API requests. By default, fields with
  1782. // empty values are omitted from API requests. However, any non-pointer,
  1783. // non-interface field appearing in ForceSendFields will be sent to the
  1784. // server regardless of whether the field is empty or not. This may be
  1785. // used to include empty fields in Patch requests.
  1786. ForceSendFields []string `json:"-"`
  1787. }
  1788. func (s *UserAbout) MarshalJSON() ([]byte, error) {
  1789. type noMethod UserAbout
  1790. raw := noMethod(*s)
  1791. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1792. }
  1793. // UserAddress: JSON template for address.
  1794. type UserAddress struct {
  1795. // Country: Country.
  1796. Country string `json:"country,omitempty"`
  1797. // CountryCode: Country code.
  1798. CountryCode string `json:"countryCode,omitempty"`
  1799. // CustomType: Custom type.
  1800. CustomType string `json:"customType,omitempty"`
  1801. // ExtendedAddress: Extended Address.
  1802. ExtendedAddress string `json:"extendedAddress,omitempty"`
  1803. // Formatted: Formatted address.
  1804. Formatted string `json:"formatted,omitempty"`
  1805. // Locality: Locality.
  1806. Locality string `json:"locality,omitempty"`
  1807. // PoBox: Other parts of address.
  1808. PoBox string `json:"poBox,omitempty"`
  1809. // PostalCode: Postal code.
  1810. PostalCode string `json:"postalCode,omitempty"`
  1811. // Primary: If this is user's primary address. Only one entry could be
  1812. // marked as primary.
  1813. Primary bool `json:"primary,omitempty"`
  1814. // Region: Region.
  1815. Region string `json:"region,omitempty"`
  1816. // SourceIsStructured: User supplied address was structured. Structured
  1817. // addresses are NOT supported at this time. You might be able to write
  1818. // structured addresses, but any values will eventually be clobbered.
  1819. SourceIsStructured bool `json:"sourceIsStructured,omitempty"`
  1820. // StreetAddress: Street.
  1821. StreetAddress string `json:"streetAddress,omitempty"`
  1822. // Type: Each entry can have a type which indicates standard values of
  1823. // that entry. For example address could be of home, work etc. In
  1824. // addition to the standard type, an entry can have a custom type and
  1825. // can take any value. Such type should have the CUSTOM value as type
  1826. // and also have a customType value.
  1827. Type string `json:"type,omitempty"`
  1828. // ForceSendFields is a list of field names (e.g. "Country") to
  1829. // unconditionally include in API requests. By default, fields with
  1830. // empty values are omitted from API requests. However, any non-pointer,
  1831. // non-interface field appearing in ForceSendFields will be sent to the
  1832. // server regardless of whether the field is empty or not. This may be
  1833. // used to include empty fields in Patch requests.
  1834. ForceSendFields []string `json:"-"`
  1835. }
  1836. func (s *UserAddress) MarshalJSON() ([]byte, error) {
  1837. type noMethod UserAddress
  1838. raw := noMethod(*s)
  1839. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1840. }
  1841. type UserCustomProperties interface{}
  1842. // UserEmail: JSON template for an email.
  1843. type UserEmail struct {
  1844. // Address: Email id of the user.
  1845. Address string `json:"address,omitempty"`
  1846. // CustomType: Custom Type.
  1847. CustomType string `json:"customType,omitempty"`
  1848. // Primary: If this is user's primary email. Only one entry could be
  1849. // marked as primary.
  1850. Primary bool `json:"primary,omitempty"`
  1851. // Type: Each entry can have a type which indicates standard types of
  1852. // that entry. For example email could be of home, work etc. In addition
  1853. // to the standard type, an entry can have a custom type and can take
  1854. // any value Such types should have the CUSTOM value as type and also
  1855. // have a customType value.
  1856. Type string `json:"type,omitempty"`
  1857. // ForceSendFields is a list of field names (e.g. "Address") to
  1858. // unconditionally include in API requests. By default, fields with
  1859. // empty values are omitted from API requests. However, any non-pointer,
  1860. // non-interface field appearing in ForceSendFields will be sent to the
  1861. // server regardless of whether the field is empty or not. This may be
  1862. // used to include empty fields in Patch requests.
  1863. ForceSendFields []string `json:"-"`
  1864. }
  1865. func (s *UserEmail) MarshalJSON() ([]byte, error) {
  1866. type noMethod UserEmail
  1867. raw := noMethod(*s)
  1868. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1869. }
  1870. // UserExternalId: JSON template for an externalId entry.
  1871. type UserExternalId struct {
  1872. // CustomType: Custom type.
  1873. CustomType string `json:"customType,omitempty"`
  1874. // Type: The type of the Id.
  1875. Type string `json:"type,omitempty"`
  1876. // Value: The value of the id.
  1877. Value string `json:"value,omitempty"`
  1878. // ForceSendFields is a list of field names (e.g. "CustomType") to
  1879. // unconditionally include in API requests. By default, fields with
  1880. // empty values are omitted from API requests. However, any non-pointer,
  1881. // non-interface field appearing in ForceSendFields will be sent to the
  1882. // server regardless of whether the field is empty or not. This may be
  1883. // used to include empty fields in Patch requests.
  1884. ForceSendFields []string `json:"-"`
  1885. }
  1886. func (s *UserExternalId) MarshalJSON() ([]byte, error) {
  1887. type noMethod UserExternalId
  1888. raw := noMethod(*s)
  1889. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1890. }
  1891. // UserIm: JSON template for instant messenger of an user.
  1892. type UserIm struct {
  1893. // CustomProtocol: Custom protocol.
  1894. CustomProtocol string `json:"customProtocol,omitempty"`
  1895. // CustomType: Custom type.
  1896. CustomType string `json:"customType,omitempty"`
  1897. // Im: Instant messenger id.
  1898. Im string `json:"im,omitempty"`
  1899. // Primary: If this is user's primary im. Only one entry could be marked
  1900. // as primary.
  1901. Primary bool `json:"primary,omitempty"`
  1902. // Protocol: Protocol used in the instant messenger. It should be one of
  1903. // the values from ImProtocolTypes map. Similar to type, it can take a
  1904. // CUSTOM value and specify the custom name in customProtocol field.
  1905. Protocol string `json:"protocol,omitempty"`
  1906. // Type: Each entry can have a type which indicates standard types of
  1907. // that entry. For example instant messengers could be of home, work
  1908. // etc. In addition to the standard type, an entry can have a custom
  1909. // type and can take any value. Such types should have the CUSTOM value
  1910. // as type and also have a customType value.
  1911. Type string `json:"type,omitempty"`
  1912. // ForceSendFields is a list of field names (e.g. "CustomProtocol") to
  1913. // unconditionally include in API requests. By default, fields with
  1914. // empty values are omitted from API requests. However, any non-pointer,
  1915. // non-interface field appearing in ForceSendFields will be sent to the
  1916. // server regardless of whether the field is empty or not. This may be
  1917. // used to include empty fields in Patch requests.
  1918. ForceSendFields []string `json:"-"`
  1919. }
  1920. func (s *UserIm) MarshalJSON() ([]byte, error) {
  1921. type noMethod UserIm
  1922. raw := noMethod(*s)
  1923. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1924. }
  1925. // UserMakeAdmin: JSON request template for setting/revoking admin
  1926. // status of a user in Directory API.
  1927. type UserMakeAdmin struct {
  1928. // Status: Boolean indicating new admin status of the user
  1929. Status bool `json:"status,omitempty"`
  1930. // ForceSendFields is a list of field names (e.g. "Status") to
  1931. // unconditionally include in API requests. By default, fields with
  1932. // empty values are omitted from API requests. However, any non-pointer,
  1933. // non-interface field appearing in ForceSendFields will be sent to the
  1934. // server regardless of whether the field is empty or not. This may be
  1935. // used to include empty fields in Patch requests.
  1936. ForceSendFields []string `json:"-"`
  1937. }
  1938. func (s *UserMakeAdmin) MarshalJSON() ([]byte, error) {
  1939. type noMethod UserMakeAdmin
  1940. raw := noMethod(*s)
  1941. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1942. }
  1943. // UserName: JSON template for name of a user in Directory API.
  1944. type UserName struct {
  1945. // FamilyName: Last Name
  1946. FamilyName string `json:"familyName,omitempty"`
  1947. // FullName: Full Name
  1948. FullName string `json:"fullName,omitempty"`
  1949. // GivenName: First Name
  1950. GivenName string `json:"givenName,omitempty"`
  1951. // ForceSendFields is a list of field names (e.g. "FamilyName") to
  1952. // unconditionally include in API requests. By default, fields with
  1953. // empty values are omitted from API requests. However, any non-pointer,
  1954. // non-interface field appearing in ForceSendFields will be sent to the
  1955. // server regardless of whether the field is empty or not. This may be
  1956. // used to include empty fields in Patch requests.
  1957. ForceSendFields []string `json:"-"`
  1958. }
  1959. func (s *UserName) MarshalJSON() ([]byte, error) {
  1960. type noMethod UserName
  1961. raw := noMethod(*s)
  1962. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1963. }
  1964. // UserOrganization: JSON template for an organization entry.
  1965. type UserOrganization struct {
  1966. // CostCenter: The cost center of the users department.
  1967. CostCenter string `json:"costCenter,omitempty"`
  1968. // CustomType: Custom type.
  1969. CustomType string `json:"customType,omitempty"`
  1970. // Department: Department within the organization.
  1971. Department string `json:"department,omitempty"`
  1972. // Description: Description of the organization.
  1973. Description string `json:"description,omitempty"`
  1974. // Domain: The domain to which the organization belongs to.
  1975. Domain string `json:"domain,omitempty"`
  1976. // Location: Location of the organization. This need not be fully
  1977. // qualified address.
  1978. Location string `json:"location,omitempty"`
  1979. // Name: Name of the organization
  1980. Name string `json:"name,omitempty"`
  1981. // Primary: If it user's primary organization.
  1982. Primary bool `json:"primary,omitempty"`
  1983. // Symbol: Symbol of the organization.
  1984. Symbol string `json:"symbol,omitempty"`
  1985. // Title: Title (designation) of the user in the organization.
  1986. Title string `json:"title,omitempty"`
  1987. // Type: Each entry can have a type which indicates standard types of
  1988. // that entry. For example organization could be of school, work etc. In
  1989. // addition to the standard type, an entry can have a custom type and
  1990. // can give it any name. Such types should have the CUSTOM value as type
  1991. // and also have a CustomType value.
  1992. Type string `json:"type,omitempty"`
  1993. // ForceSendFields is a list of field names (e.g. "CostCenter") to
  1994. // unconditionally include in API requests. By default, fields with
  1995. // empty values are omitted from API requests. However, any non-pointer,
  1996. // non-interface field appearing in ForceSendFields will be sent to the
  1997. // server regardless of whether the field is empty or not. This may be
  1998. // used to include empty fields in Patch requests.
  1999. ForceSendFields []string `json:"-"`
  2000. }
  2001. func (s *UserOrganization) MarshalJSON() ([]byte, error) {
  2002. type noMethod UserOrganization
  2003. raw := noMethod(*s)
  2004. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  2005. }
  2006. // UserPhone: JSON template for a phone entry.
  2007. type UserPhone struct {
  2008. // CustomType: Custom Type.
  2009. CustomType string `json:"customType,omitempty"`
  2010. // Primary: If this is user's primary phone or not.
  2011. Primary bool `json:"primary,omitempty"`
  2012. // Type: Each entry can have a type which indicates standard types of
  2013. // that entry. For example phone could be of home_fax, work, mobile etc.
  2014. // In addition to the standard type, an entry can have a custom type and
  2015. // can give it any name. Such types should have the CUSTOM value as type
  2016. // and also have a customType value.
  2017. Type string `json:"type,omitempty"`
  2018. // Value: Phone number.
  2019. Value string `json:"value,omitempty"`
  2020. // ForceSendFields is a list of field names (e.g. "CustomType") to
  2021. // unconditionally include in API requests. By default, fields with
  2022. // empty values are omitted from API requests. However, any non-pointer,
  2023. // non-interface field appearing in ForceSendFields will be sent to the
  2024. // server regardless of whether the field is empty or not. This may be
  2025. // used to include empty fields in Patch requests.
  2026. ForceSendFields []string `json:"-"`
  2027. }
  2028. func (s *UserPhone) MarshalJSON() ([]byte, error) {
  2029. type noMethod UserPhone
  2030. raw := noMethod(*s)
  2031. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  2032. }
  2033. // UserPhoto: JSON template for Photo object in Directory API.
  2034. type UserPhoto struct {
  2035. // Etag: ETag of the resource.
  2036. Etag string `json:"etag,omitempty"`
  2037. // Height: Height in pixels of the photo
  2038. Height int64 `json:"height,omitempty"`
  2039. // Id: Unique identifier of User (Read-only)
  2040. Id string `json:"id,omitempty"`
  2041. // Kind: Kind of resource this is.
  2042. Kind string `json:"kind,omitempty"`
  2043. // MimeType: Mime Type of the photo
  2044. MimeType string `json:"mimeType,omitempty"`
  2045. // PhotoData: Base64 encoded photo data
  2046. PhotoData string `json:"photoData,omitempty"`
  2047. // PrimaryEmail: Primary email of User (Read-only)
  2048. PrimaryEmail string `json:"primaryEmail,omitempty"`
  2049. // Width: Width in pixels of the photo
  2050. Width int64 `json:"width,omitempty"`
  2051. // ServerResponse contains the HTTP response code and headers from the
  2052. // server.
  2053. googleapi.ServerResponse `json:"-"`
  2054. // ForceSendFields is a list of field names (e.g. "Etag") to
  2055. // unconditionally include in API requests. By default, fields with
  2056. // empty values are omitted from API requests. However, any non-pointer,
  2057. // non-interface field appearing in ForceSendFields will be sent to the
  2058. // server regardless of whether the field is empty or not. This may be
  2059. // used to include empty fields in Patch requests.
  2060. ForceSendFields []string `json:"-"`
  2061. }
  2062. func (s *UserPhoto) MarshalJSON() ([]byte, error) {
  2063. type noMethod UserPhoto
  2064. raw := noMethod(*s)
  2065. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  2066. }
  2067. // UserRelation: JSON template for a relation entry.
  2068. type UserRelation struct {
  2069. // CustomType: Custom Type.
  2070. CustomType string `json:"customType,omitempty"`
  2071. // Type: The relation of the user. Some of the possible values are
  2072. // mother, father, sister, brother, manager, assistant, partner.
  2073. Type string `json:"type,omitempty"`
  2074. // Value: The name of the relation.
  2075. Value string `json:"value,omitempty"`
  2076. // ForceSendFields is a list of field names (e.g. "CustomType") to
  2077. // unconditionally include in API requests. By default, fields with
  2078. // empty values are omitted from API requests. However, any non-pointer,
  2079. // non-interface field appearing in ForceSendFields will be sent to the
  2080. // server regardless of whether the field is empty or not. This may be
  2081. // used to include empty fields in Patch requests.
  2082. ForceSendFields []string `json:"-"`
  2083. }
  2084. func (s *UserRelation) MarshalJSON() ([]byte, error) {
  2085. type noMethod UserRelation
  2086. raw := noMethod(*s)
  2087. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  2088. }
  2089. // UserUndelete: JSON request template to undelete a user in Directory
  2090. // API.
  2091. type UserUndelete struct {
  2092. // OrgUnitPath: OrgUnit of User
  2093. OrgUnitPath string `json:"orgUnitPath,omitempty"`
  2094. // ForceSendFields is a list of field names (e.g. "OrgUnitPath") to
  2095. // unconditionally include in API requests. By default, fields with
  2096. // empty values are omitted from API requests. However, any non-pointer,
  2097. // non-interface field appearing in ForceSendFields will be sent to the
  2098. // server regardless of whether the field is empty or not. This may be
  2099. // used to include empty fields in Patch requests.
  2100. ForceSendFields []string `json:"-"`
  2101. }
  2102. func (s *UserUndelete) MarshalJSON() ([]byte, error) {
  2103. type noMethod UserUndelete
  2104. raw := noMethod(*s)
  2105. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  2106. }
  2107. // UserWebsite: JSON template for a website entry.
  2108. type UserWebsite struct {
  2109. // CustomType: Custom Type.
  2110. CustomType string `json:"customType,omitempty"`
  2111. // Primary: If this is user's primary website or not.
  2112. Primary bool `json:"primary,omitempty"`
  2113. // Type: Each entry can have a type which indicates standard types of
  2114. // that entry. For example website could be of home, work, blog etc. In
  2115. // addition to the standard type, an entry can have a custom type and
  2116. // can give it any name. Such types should have the CUSTOM value as type
  2117. // and also have a customType value.
  2118. Type string `json:"type,omitempty"`
  2119. // Value: Website.
  2120. Value string `json:"value,omitempty"`
  2121. // ForceSendFields is a list of field names (e.g. "CustomType") to
  2122. // unconditionally include in API requests. By default, fields with
  2123. // empty values are omitted from API requests. However, any non-pointer,
  2124. // non-interface field appearing in ForceSendFields will be sent to the
  2125. // server regardless of whether the field is empty or not. This may be
  2126. // used to include empty fields in Patch requests.
  2127. ForceSendFields []string `json:"-"`
  2128. }
  2129. func (s *UserWebsite) MarshalJSON() ([]byte, error) {
  2130. type noMethod UserWebsite
  2131. raw := noMethod(*s)
  2132. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  2133. }
  2134. // Users: JSON response template for List Users operation in Apps
  2135. // Directory API.
  2136. type Users struct {
  2137. // Etag: ETag of the resource.
  2138. Etag string `json:"etag,omitempty"`
  2139. // Kind: Kind of resource this is.
  2140. Kind string `json:"kind,omitempty"`
  2141. // NextPageToken: Token used to access next page of this result.
  2142. NextPageToken string `json:"nextPageToken,omitempty"`
  2143. // TriggerEvent: Event that triggered this response (only used in case
  2144. // of Push Response)
  2145. TriggerEvent string `json:"trigger_event,omitempty"`
  2146. // Users: List of user objects.
  2147. Users []*User `json:"users,omitempty"`
  2148. // ServerResponse contains the HTTP response code and headers from the
  2149. // server.
  2150. googleapi.ServerResponse `json:"-"`
  2151. // ForceSendFields is a list of field names (e.g. "Etag") to
  2152. // unconditionally include in API requests. By default, fields with
  2153. // empty values are omitted from API requests. However, any non-pointer,
  2154. // non-interface field appearing in ForceSendFields will be sent to the
  2155. // server regardless of whether the field is empty or not. This may be
  2156. // used to include empty fields in Patch requests.
  2157. ForceSendFields []string `json:"-"`
  2158. }
  2159. func (s *Users) MarshalJSON() ([]byte, error) {
  2160. type noMethod Users
  2161. raw := noMethod(*s)
  2162. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  2163. }
  2164. // VerificationCode: JSON template for verification codes in Directory
  2165. // API.
  2166. type VerificationCode struct {
  2167. // Etag: ETag of the resource.
  2168. Etag string `json:"etag,omitempty"`
  2169. // Kind: The type of the resource. This is always
  2170. // admin#directory#verificationCode.
  2171. Kind string `json:"kind,omitempty"`
  2172. // UserId: The obfuscated unique ID of the user.
  2173. UserId string `json:"userId,omitempty"`
  2174. // VerificationCode: A current verification code for the user.
  2175. // Invalidated or used verification codes are not returned as part of
  2176. // the result.
  2177. VerificationCode string `json:"verificationCode,omitempty"`
  2178. // ForceSendFields is a list of field names (e.g. "Etag") to
  2179. // unconditionally include in API requests. By default, fields with
  2180. // empty values are omitted from API requests. However, any non-pointer,
  2181. // non-interface field appearing in ForceSendFields will be sent to the
  2182. // server regardless of whether the field is empty or not. This may be
  2183. // used to include empty fields in Patch requests.
  2184. ForceSendFields []string `json:"-"`
  2185. }
  2186. func (s *VerificationCode) MarshalJSON() ([]byte, error) {
  2187. type noMethod VerificationCode
  2188. raw := noMethod(*s)
  2189. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  2190. }
  2191. // VerificationCodes: JSON response template for List verification codes
  2192. // operation in Directory API.
  2193. type VerificationCodes struct {
  2194. // Etag: ETag of the resource.
  2195. Etag string `json:"etag,omitempty"`
  2196. // Items: A list of verification code resources.
  2197. Items []*VerificationCode `json:"items,omitempty"`
  2198. // Kind: The type of the resource. This is always
  2199. // admin#directory#verificationCodesList.
  2200. Kind string `json:"kind,omitempty"`
  2201. // ServerResponse contains the HTTP response code and headers from the
  2202. // server.
  2203. googleapi.ServerResponse `json:"-"`
  2204. // ForceSendFields is a list of field names (e.g. "Etag") to
  2205. // unconditionally include in API requests. By default, fields with
  2206. // empty values are omitted from API requests. However, any non-pointer,
  2207. // non-interface field appearing in ForceSendFields will be sent to the
  2208. // server regardless of whether the field is empty or not. This may be
  2209. // used to include empty fields in Patch requests.
  2210. ForceSendFields []string `json:"-"`
  2211. }
  2212. func (s *VerificationCodes) MarshalJSON() ([]byte, error) {
  2213. type noMethod VerificationCodes
  2214. raw := noMethod(*s)
  2215. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  2216. }
  2217. // method id "directory.asps.delete":
  2218. type AspsDeleteCall struct {
  2219. s *Service
  2220. userKey string
  2221. codeId int64
  2222. urlParams_ gensupport.URLParams
  2223. ctx_ context.Context
  2224. }
  2225. // Delete: Delete an ASP issued by a user.
  2226. func (r *AspsService) Delete(userKey string, codeId int64) *AspsDeleteCall {
  2227. c := &AspsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2228. c.userKey = userKey
  2229. c.codeId = codeId
  2230. return c
  2231. }
  2232. // Fields allows partial responses to be retrieved. See
  2233. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2234. // for more information.
  2235. func (c *AspsDeleteCall) Fields(s ...googleapi.Field) *AspsDeleteCall {
  2236. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2237. return c
  2238. }
  2239. // Context sets the context to be used in this call's Do method. Any
  2240. // pending HTTP request will be aborted if the provided context is
  2241. // canceled.
  2242. func (c *AspsDeleteCall) Context(ctx context.Context) *AspsDeleteCall {
  2243. c.ctx_ = ctx
  2244. return c
  2245. }
  2246. func (c *AspsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2247. var body io.Reader = nil
  2248. c.urlParams_.Set("alt", alt)
  2249. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/asps/{codeId}")
  2250. urls += "?" + c.urlParams_.Encode()
  2251. req, _ := http.NewRequest("DELETE", urls, body)
  2252. googleapi.Expand(req.URL, map[string]string{
  2253. "userKey": c.userKey,
  2254. "codeId": strconv.FormatInt(c.codeId, 10),
  2255. })
  2256. req.Header.Set("User-Agent", c.s.userAgent())
  2257. if c.ctx_ != nil {
  2258. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2259. }
  2260. return c.s.client.Do(req)
  2261. }
  2262. // Do executes the "directory.asps.delete" call.
  2263. func (c *AspsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2264. gensupport.SetOptions(c.urlParams_, opts...)
  2265. res, err := c.doRequest("json")
  2266. if err != nil {
  2267. return err
  2268. }
  2269. defer googleapi.CloseBody(res)
  2270. if err := googleapi.CheckResponse(res); err != nil {
  2271. return err
  2272. }
  2273. return nil
  2274. // {
  2275. // "description": "Delete an ASP issued by a user.",
  2276. // "httpMethod": "DELETE",
  2277. // "id": "directory.asps.delete",
  2278. // "parameterOrder": [
  2279. // "userKey",
  2280. // "codeId"
  2281. // ],
  2282. // "parameters": {
  2283. // "codeId": {
  2284. // "description": "The unique ID of the ASP to be deleted.",
  2285. // "format": "int32",
  2286. // "location": "path",
  2287. // "required": true,
  2288. // "type": "integer"
  2289. // },
  2290. // "userKey": {
  2291. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  2292. // "location": "path",
  2293. // "required": true,
  2294. // "type": "string"
  2295. // }
  2296. // },
  2297. // "path": "users/{userKey}/asps/{codeId}",
  2298. // "scopes": [
  2299. // "https://www.googleapis.com/auth/admin.directory.user.security"
  2300. // ]
  2301. // }
  2302. }
  2303. // method id "directory.asps.get":
  2304. type AspsGetCall struct {
  2305. s *Service
  2306. userKey string
  2307. codeId int64
  2308. urlParams_ gensupport.URLParams
  2309. ifNoneMatch_ string
  2310. ctx_ context.Context
  2311. }
  2312. // Get: Get information about an ASP issued by a user.
  2313. func (r *AspsService) Get(userKey string, codeId int64) *AspsGetCall {
  2314. c := &AspsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2315. c.userKey = userKey
  2316. c.codeId = codeId
  2317. return c
  2318. }
  2319. // Fields allows partial responses to be retrieved. See
  2320. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2321. // for more information.
  2322. func (c *AspsGetCall) Fields(s ...googleapi.Field) *AspsGetCall {
  2323. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2324. return c
  2325. }
  2326. // IfNoneMatch sets the optional parameter which makes the operation
  2327. // fail if the object's ETag matches the given value. This is useful for
  2328. // getting updates only after the object has changed since the last
  2329. // request. Use googleapi.IsNotModified to check whether the response
  2330. // error from Do is the result of In-None-Match.
  2331. func (c *AspsGetCall) IfNoneMatch(entityTag string) *AspsGetCall {
  2332. c.ifNoneMatch_ = entityTag
  2333. return c
  2334. }
  2335. // Context sets the context to be used in this call's Do method. Any
  2336. // pending HTTP request will be aborted if the provided context is
  2337. // canceled.
  2338. func (c *AspsGetCall) Context(ctx context.Context) *AspsGetCall {
  2339. c.ctx_ = ctx
  2340. return c
  2341. }
  2342. func (c *AspsGetCall) doRequest(alt string) (*http.Response, error) {
  2343. var body io.Reader = nil
  2344. c.urlParams_.Set("alt", alt)
  2345. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/asps/{codeId}")
  2346. urls += "?" + c.urlParams_.Encode()
  2347. req, _ := http.NewRequest("GET", urls, body)
  2348. googleapi.Expand(req.URL, map[string]string{
  2349. "userKey": c.userKey,
  2350. "codeId": strconv.FormatInt(c.codeId, 10),
  2351. })
  2352. req.Header.Set("User-Agent", c.s.userAgent())
  2353. if c.ifNoneMatch_ != "" {
  2354. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2355. }
  2356. if c.ctx_ != nil {
  2357. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2358. }
  2359. return c.s.client.Do(req)
  2360. }
  2361. // Do executes the "directory.asps.get" call.
  2362. // Exactly one of *Asp or error will be non-nil. Any non-2xx status code
  2363. // is an error. Response headers are in either
  2364. // *Asp.ServerResponse.Header or (if a response was returned at all) in
  2365. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2366. // whether the returned error was because http.StatusNotModified was
  2367. // returned.
  2368. func (c *AspsGetCall) Do(opts ...googleapi.CallOption) (*Asp, error) {
  2369. gensupport.SetOptions(c.urlParams_, opts...)
  2370. res, err := c.doRequest("json")
  2371. if res != nil && res.StatusCode == http.StatusNotModified {
  2372. if res.Body != nil {
  2373. res.Body.Close()
  2374. }
  2375. return nil, &googleapi.Error{
  2376. Code: res.StatusCode,
  2377. Header: res.Header,
  2378. }
  2379. }
  2380. if err != nil {
  2381. return nil, err
  2382. }
  2383. defer googleapi.CloseBody(res)
  2384. if err := googleapi.CheckResponse(res); err != nil {
  2385. return nil, err
  2386. }
  2387. ret := &Asp{
  2388. ServerResponse: googleapi.ServerResponse{
  2389. Header: res.Header,
  2390. HTTPStatusCode: res.StatusCode,
  2391. },
  2392. }
  2393. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2394. return nil, err
  2395. }
  2396. return ret, nil
  2397. // {
  2398. // "description": "Get information about an ASP issued by a user.",
  2399. // "httpMethod": "GET",
  2400. // "id": "directory.asps.get",
  2401. // "parameterOrder": [
  2402. // "userKey",
  2403. // "codeId"
  2404. // ],
  2405. // "parameters": {
  2406. // "codeId": {
  2407. // "description": "The unique ID of the ASP.",
  2408. // "format": "int32",
  2409. // "location": "path",
  2410. // "required": true,
  2411. // "type": "integer"
  2412. // },
  2413. // "userKey": {
  2414. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  2415. // "location": "path",
  2416. // "required": true,
  2417. // "type": "string"
  2418. // }
  2419. // },
  2420. // "path": "users/{userKey}/asps/{codeId}",
  2421. // "response": {
  2422. // "$ref": "Asp"
  2423. // },
  2424. // "scopes": [
  2425. // "https://www.googleapis.com/auth/admin.directory.user.security"
  2426. // ]
  2427. // }
  2428. }
  2429. // method id "directory.asps.list":
  2430. type AspsListCall struct {
  2431. s *Service
  2432. userKey string
  2433. urlParams_ gensupport.URLParams
  2434. ifNoneMatch_ string
  2435. ctx_ context.Context
  2436. }
  2437. // List: List the ASPs issued by a user.
  2438. func (r *AspsService) List(userKey string) *AspsListCall {
  2439. c := &AspsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2440. c.userKey = userKey
  2441. return c
  2442. }
  2443. // Fields allows partial responses to be retrieved. See
  2444. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2445. // for more information.
  2446. func (c *AspsListCall) Fields(s ...googleapi.Field) *AspsListCall {
  2447. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2448. return c
  2449. }
  2450. // IfNoneMatch sets the optional parameter which makes the operation
  2451. // fail if the object's ETag matches the given value. This is useful for
  2452. // getting updates only after the object has changed since the last
  2453. // request. Use googleapi.IsNotModified to check whether the response
  2454. // error from Do is the result of In-None-Match.
  2455. func (c *AspsListCall) IfNoneMatch(entityTag string) *AspsListCall {
  2456. c.ifNoneMatch_ = entityTag
  2457. return c
  2458. }
  2459. // Context sets the context to be used in this call's Do method. Any
  2460. // pending HTTP request will be aborted if the provided context is
  2461. // canceled.
  2462. func (c *AspsListCall) Context(ctx context.Context) *AspsListCall {
  2463. c.ctx_ = ctx
  2464. return c
  2465. }
  2466. func (c *AspsListCall) doRequest(alt string) (*http.Response, error) {
  2467. var body io.Reader = nil
  2468. c.urlParams_.Set("alt", alt)
  2469. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/asps")
  2470. urls += "?" + c.urlParams_.Encode()
  2471. req, _ := http.NewRequest("GET", urls, body)
  2472. googleapi.Expand(req.URL, map[string]string{
  2473. "userKey": c.userKey,
  2474. })
  2475. req.Header.Set("User-Agent", c.s.userAgent())
  2476. if c.ifNoneMatch_ != "" {
  2477. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2478. }
  2479. if c.ctx_ != nil {
  2480. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2481. }
  2482. return c.s.client.Do(req)
  2483. }
  2484. // Do executes the "directory.asps.list" call.
  2485. // Exactly one of *Asps or error will be non-nil. Any non-2xx status
  2486. // code is an error. Response headers are in either
  2487. // *Asps.ServerResponse.Header or (if a response was returned at all) in
  2488. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2489. // whether the returned error was because http.StatusNotModified was
  2490. // returned.
  2491. func (c *AspsListCall) Do(opts ...googleapi.CallOption) (*Asps, error) {
  2492. gensupport.SetOptions(c.urlParams_, opts...)
  2493. res, err := c.doRequest("json")
  2494. if res != nil && res.StatusCode == http.StatusNotModified {
  2495. if res.Body != nil {
  2496. res.Body.Close()
  2497. }
  2498. return nil, &googleapi.Error{
  2499. Code: res.StatusCode,
  2500. Header: res.Header,
  2501. }
  2502. }
  2503. if err != nil {
  2504. return nil, err
  2505. }
  2506. defer googleapi.CloseBody(res)
  2507. if err := googleapi.CheckResponse(res); err != nil {
  2508. return nil, err
  2509. }
  2510. ret := &Asps{
  2511. ServerResponse: googleapi.ServerResponse{
  2512. Header: res.Header,
  2513. HTTPStatusCode: res.StatusCode,
  2514. },
  2515. }
  2516. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2517. return nil, err
  2518. }
  2519. return ret, nil
  2520. // {
  2521. // "description": "List the ASPs issued by a user.",
  2522. // "httpMethod": "GET",
  2523. // "id": "directory.asps.list",
  2524. // "parameterOrder": [
  2525. // "userKey"
  2526. // ],
  2527. // "parameters": {
  2528. // "userKey": {
  2529. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  2530. // "location": "path",
  2531. // "required": true,
  2532. // "type": "string"
  2533. // }
  2534. // },
  2535. // "path": "users/{userKey}/asps",
  2536. // "response": {
  2537. // "$ref": "Asps"
  2538. // },
  2539. // "scopes": [
  2540. // "https://www.googleapis.com/auth/admin.directory.user.security"
  2541. // ]
  2542. // }
  2543. }
  2544. // method id "admin.channels.stop":
  2545. type ChannelsStopCall struct {
  2546. s *Service
  2547. channel *Channel
  2548. urlParams_ gensupport.URLParams
  2549. ctx_ context.Context
  2550. }
  2551. // Stop: Stop watching resources through this channel
  2552. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  2553. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2554. c.channel = channel
  2555. return c
  2556. }
  2557. // Fields allows partial responses to be retrieved. See
  2558. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2559. // for more information.
  2560. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  2561. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2562. return c
  2563. }
  2564. // Context sets the context to be used in this call's Do method. Any
  2565. // pending HTTP request will be aborted if the provided context is
  2566. // canceled.
  2567. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  2568. c.ctx_ = ctx
  2569. return c
  2570. }
  2571. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  2572. var body io.Reader = nil
  2573. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  2574. if err != nil {
  2575. return nil, err
  2576. }
  2577. ctype := "application/json"
  2578. c.urlParams_.Set("alt", alt)
  2579. urls := googleapi.ResolveRelative(c.s.BasePath, "/admin/directory_v1/channels/stop")
  2580. urls += "?" + c.urlParams_.Encode()
  2581. req, _ := http.NewRequest("POST", urls, body)
  2582. googleapi.SetOpaque(req.URL)
  2583. req.Header.Set("Content-Type", ctype)
  2584. req.Header.Set("User-Agent", c.s.userAgent())
  2585. if c.ctx_ != nil {
  2586. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2587. }
  2588. return c.s.client.Do(req)
  2589. }
  2590. // Do executes the "admin.channels.stop" call.
  2591. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  2592. gensupport.SetOptions(c.urlParams_, opts...)
  2593. res, err := c.doRequest("json")
  2594. if err != nil {
  2595. return err
  2596. }
  2597. defer googleapi.CloseBody(res)
  2598. if err := googleapi.CheckResponse(res); err != nil {
  2599. return err
  2600. }
  2601. return nil
  2602. // {
  2603. // "description": "Stop watching resources through this channel",
  2604. // "httpMethod": "POST",
  2605. // "id": "admin.channels.stop",
  2606. // "path": "/admin/directory_v1/channels/stop",
  2607. // "request": {
  2608. // "$ref": "Channel",
  2609. // "parameterName": "resource"
  2610. // },
  2611. // "scopes": [
  2612. // "https://www.googleapis.com/auth/admin.directory.user",
  2613. // "https://www.googleapis.com/auth/admin.directory.user.alias",
  2614. // "https://www.googleapis.com/auth/admin.directory.user.alias.readonly",
  2615. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  2616. // ]
  2617. // }
  2618. }
  2619. // method id "directory.chromeosdevices.get":
  2620. type ChromeosdevicesGetCall struct {
  2621. s *Service
  2622. customerId string
  2623. deviceId string
  2624. urlParams_ gensupport.URLParams
  2625. ifNoneMatch_ string
  2626. ctx_ context.Context
  2627. }
  2628. // Get: Retrieve Chrome OS Device
  2629. func (r *ChromeosdevicesService) Get(customerId string, deviceId string) *ChromeosdevicesGetCall {
  2630. c := &ChromeosdevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2631. c.customerId = customerId
  2632. c.deviceId = deviceId
  2633. return c
  2634. }
  2635. // Projection sets the optional parameter "projection": Restrict
  2636. // information returned to a set of selected fields.
  2637. //
  2638. // Possible values:
  2639. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  2640. // serialNumber, status, and user)
  2641. // "FULL" - Includes all metadata fields
  2642. func (c *ChromeosdevicesGetCall) Projection(projection string) *ChromeosdevicesGetCall {
  2643. c.urlParams_.Set("projection", projection)
  2644. return c
  2645. }
  2646. // Fields allows partial responses to be retrieved. See
  2647. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2648. // for more information.
  2649. func (c *ChromeosdevicesGetCall) Fields(s ...googleapi.Field) *ChromeosdevicesGetCall {
  2650. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2651. return c
  2652. }
  2653. // IfNoneMatch sets the optional parameter which makes the operation
  2654. // fail if the object's ETag matches the given value. This is useful for
  2655. // getting updates only after the object has changed since the last
  2656. // request. Use googleapi.IsNotModified to check whether the response
  2657. // error from Do is the result of In-None-Match.
  2658. func (c *ChromeosdevicesGetCall) IfNoneMatch(entityTag string) *ChromeosdevicesGetCall {
  2659. c.ifNoneMatch_ = entityTag
  2660. return c
  2661. }
  2662. // Context sets the context to be used in this call's Do method. Any
  2663. // pending HTTP request will be aborted if the provided context is
  2664. // canceled.
  2665. func (c *ChromeosdevicesGetCall) Context(ctx context.Context) *ChromeosdevicesGetCall {
  2666. c.ctx_ = ctx
  2667. return c
  2668. }
  2669. func (c *ChromeosdevicesGetCall) doRequest(alt string) (*http.Response, error) {
  2670. var body io.Reader = nil
  2671. c.urlParams_.Set("alt", alt)
  2672. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos/{deviceId}")
  2673. urls += "?" + c.urlParams_.Encode()
  2674. req, _ := http.NewRequest("GET", urls, body)
  2675. googleapi.Expand(req.URL, map[string]string{
  2676. "customerId": c.customerId,
  2677. "deviceId": c.deviceId,
  2678. })
  2679. req.Header.Set("User-Agent", c.s.userAgent())
  2680. if c.ifNoneMatch_ != "" {
  2681. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2682. }
  2683. if c.ctx_ != nil {
  2684. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2685. }
  2686. return c.s.client.Do(req)
  2687. }
  2688. // Do executes the "directory.chromeosdevices.get" call.
  2689. // Exactly one of *ChromeOsDevice or error will be non-nil. Any non-2xx
  2690. // status code is an error. Response headers are in either
  2691. // *ChromeOsDevice.ServerResponse.Header or (if a response was returned
  2692. // at all) in error.(*googleapi.Error).Header. Use
  2693. // googleapi.IsNotModified to check whether the returned error was
  2694. // because http.StatusNotModified was returned.
  2695. func (c *ChromeosdevicesGetCall) Do(opts ...googleapi.CallOption) (*ChromeOsDevice, error) {
  2696. gensupport.SetOptions(c.urlParams_, opts...)
  2697. res, err := c.doRequest("json")
  2698. if res != nil && res.StatusCode == http.StatusNotModified {
  2699. if res.Body != nil {
  2700. res.Body.Close()
  2701. }
  2702. return nil, &googleapi.Error{
  2703. Code: res.StatusCode,
  2704. Header: res.Header,
  2705. }
  2706. }
  2707. if err != nil {
  2708. return nil, err
  2709. }
  2710. defer googleapi.CloseBody(res)
  2711. if err := googleapi.CheckResponse(res); err != nil {
  2712. return nil, err
  2713. }
  2714. ret := &ChromeOsDevice{
  2715. ServerResponse: googleapi.ServerResponse{
  2716. Header: res.Header,
  2717. HTTPStatusCode: res.StatusCode,
  2718. },
  2719. }
  2720. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2721. return nil, err
  2722. }
  2723. return ret, nil
  2724. // {
  2725. // "description": "Retrieve Chrome OS Device",
  2726. // "httpMethod": "GET",
  2727. // "id": "directory.chromeosdevices.get",
  2728. // "parameterOrder": [
  2729. // "customerId",
  2730. // "deviceId"
  2731. // ],
  2732. // "parameters": {
  2733. // "customerId": {
  2734. // "description": "Immutable id of the Google Apps account",
  2735. // "location": "path",
  2736. // "required": true,
  2737. // "type": "string"
  2738. // },
  2739. // "deviceId": {
  2740. // "description": "Immutable id of Chrome OS Device",
  2741. // "location": "path",
  2742. // "required": true,
  2743. // "type": "string"
  2744. // },
  2745. // "projection": {
  2746. // "description": "Restrict information returned to a set of selected fields.",
  2747. // "enum": [
  2748. // "BASIC",
  2749. // "FULL"
  2750. // ],
  2751. // "enumDescriptions": [
  2752. // "Includes only the basic metadata fields (e.g., deviceId, serialNumber, status, and user)",
  2753. // "Includes all metadata fields"
  2754. // ],
  2755. // "location": "query",
  2756. // "type": "string"
  2757. // }
  2758. // },
  2759. // "path": "customer/{customerId}/devices/chromeos/{deviceId}",
  2760. // "response": {
  2761. // "$ref": "ChromeOsDevice"
  2762. // },
  2763. // "scopes": [
  2764. // "https://www.googleapis.com/auth/admin.directory.device.chromeos",
  2765. // "https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly"
  2766. // ]
  2767. // }
  2768. }
  2769. // method id "directory.chromeosdevices.list":
  2770. type ChromeosdevicesListCall struct {
  2771. s *Service
  2772. customerId string
  2773. urlParams_ gensupport.URLParams
  2774. ifNoneMatch_ string
  2775. ctx_ context.Context
  2776. }
  2777. // List: Retrieve all Chrome OS Devices of a customer (paginated)
  2778. func (r *ChromeosdevicesService) List(customerId string) *ChromeosdevicesListCall {
  2779. c := &ChromeosdevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2780. c.customerId = customerId
  2781. return c
  2782. }
  2783. // MaxResults sets the optional parameter "maxResults": Maximum number
  2784. // of results to return. Default is 100
  2785. func (c *ChromeosdevicesListCall) MaxResults(maxResults int64) *ChromeosdevicesListCall {
  2786. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2787. return c
  2788. }
  2789. // OrderBy sets the optional parameter "orderBy": Column to use for
  2790. // sorting results
  2791. //
  2792. // Possible values:
  2793. // "annotatedLocation" - Chromebook location as annotated by the
  2794. // administrator.
  2795. // "annotatedUser" - Chromebook user as annotated by administrator.
  2796. // "lastSync" - Chromebook last sync.
  2797. // "notes" - Chromebook notes as annotated by the administrator.
  2798. // "serialNumber" - Chromebook Serial Number.
  2799. // "status" - Chromebook status.
  2800. // "supportEndDate" - Chromebook support end date.
  2801. func (c *ChromeosdevicesListCall) OrderBy(orderBy string) *ChromeosdevicesListCall {
  2802. c.urlParams_.Set("orderBy", orderBy)
  2803. return c
  2804. }
  2805. // PageToken sets the optional parameter "pageToken": Token to specify
  2806. // next page in the list
  2807. func (c *ChromeosdevicesListCall) PageToken(pageToken string) *ChromeosdevicesListCall {
  2808. c.urlParams_.Set("pageToken", pageToken)
  2809. return c
  2810. }
  2811. // Projection sets the optional parameter "projection": Restrict
  2812. // information returned to a set of selected fields.
  2813. //
  2814. // Possible values:
  2815. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  2816. // serialNumber, status, and user)
  2817. // "FULL" - Includes all metadata fields
  2818. func (c *ChromeosdevicesListCall) Projection(projection string) *ChromeosdevicesListCall {
  2819. c.urlParams_.Set("projection", projection)
  2820. return c
  2821. }
  2822. // Query sets the optional parameter "query": Search string in the
  2823. // format given at
  2824. // http://support.google.com/chromeos/a/bin/answer.py?hl=en&answer=1698333
  2825. func (c *ChromeosdevicesListCall) Query(query string) *ChromeosdevicesListCall {
  2826. c.urlParams_.Set("query", query)
  2827. return c
  2828. }
  2829. // SortOrder sets the optional parameter "sortOrder": Whether to return
  2830. // results in ascending or descending order. Only of use when orderBy is
  2831. // also used
  2832. //
  2833. // Possible values:
  2834. // "ASCENDING" - Ascending order.
  2835. // "DESCENDING" - Descending order.
  2836. func (c *ChromeosdevicesListCall) SortOrder(sortOrder string) *ChromeosdevicesListCall {
  2837. c.urlParams_.Set("sortOrder", sortOrder)
  2838. return c
  2839. }
  2840. // Fields allows partial responses to be retrieved. See
  2841. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2842. // for more information.
  2843. func (c *ChromeosdevicesListCall) Fields(s ...googleapi.Field) *ChromeosdevicesListCall {
  2844. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2845. return c
  2846. }
  2847. // IfNoneMatch sets the optional parameter which makes the operation
  2848. // fail if the object's ETag matches the given value. This is useful for
  2849. // getting updates only after the object has changed since the last
  2850. // request. Use googleapi.IsNotModified to check whether the response
  2851. // error from Do is the result of In-None-Match.
  2852. func (c *ChromeosdevicesListCall) IfNoneMatch(entityTag string) *ChromeosdevicesListCall {
  2853. c.ifNoneMatch_ = entityTag
  2854. return c
  2855. }
  2856. // Context sets the context to be used in this call's Do method. Any
  2857. // pending HTTP request will be aborted if the provided context is
  2858. // canceled.
  2859. func (c *ChromeosdevicesListCall) Context(ctx context.Context) *ChromeosdevicesListCall {
  2860. c.ctx_ = ctx
  2861. return c
  2862. }
  2863. func (c *ChromeosdevicesListCall) doRequest(alt string) (*http.Response, error) {
  2864. var body io.Reader = nil
  2865. c.urlParams_.Set("alt", alt)
  2866. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos")
  2867. urls += "?" + c.urlParams_.Encode()
  2868. req, _ := http.NewRequest("GET", urls, body)
  2869. googleapi.Expand(req.URL, map[string]string{
  2870. "customerId": c.customerId,
  2871. })
  2872. req.Header.Set("User-Agent", c.s.userAgent())
  2873. if c.ifNoneMatch_ != "" {
  2874. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2875. }
  2876. if c.ctx_ != nil {
  2877. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2878. }
  2879. return c.s.client.Do(req)
  2880. }
  2881. // Do executes the "directory.chromeosdevices.list" call.
  2882. // Exactly one of *ChromeOsDevices or error will be non-nil. Any non-2xx
  2883. // status code is an error. Response headers are in either
  2884. // *ChromeOsDevices.ServerResponse.Header or (if a response was returned
  2885. // at all) in error.(*googleapi.Error).Header. Use
  2886. // googleapi.IsNotModified to check whether the returned error was
  2887. // because http.StatusNotModified was returned.
  2888. func (c *ChromeosdevicesListCall) Do(opts ...googleapi.CallOption) (*ChromeOsDevices, error) {
  2889. gensupport.SetOptions(c.urlParams_, opts...)
  2890. res, err := c.doRequest("json")
  2891. if res != nil && res.StatusCode == http.StatusNotModified {
  2892. if res.Body != nil {
  2893. res.Body.Close()
  2894. }
  2895. return nil, &googleapi.Error{
  2896. Code: res.StatusCode,
  2897. Header: res.Header,
  2898. }
  2899. }
  2900. if err != nil {
  2901. return nil, err
  2902. }
  2903. defer googleapi.CloseBody(res)
  2904. if err := googleapi.CheckResponse(res); err != nil {
  2905. return nil, err
  2906. }
  2907. ret := &ChromeOsDevices{
  2908. ServerResponse: googleapi.ServerResponse{
  2909. Header: res.Header,
  2910. HTTPStatusCode: res.StatusCode,
  2911. },
  2912. }
  2913. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2914. return nil, err
  2915. }
  2916. return ret, nil
  2917. // {
  2918. // "description": "Retrieve all Chrome OS Devices of a customer (paginated)",
  2919. // "httpMethod": "GET",
  2920. // "id": "directory.chromeosdevices.list",
  2921. // "parameterOrder": [
  2922. // "customerId"
  2923. // ],
  2924. // "parameters": {
  2925. // "customerId": {
  2926. // "description": "Immutable id of the Google Apps account",
  2927. // "location": "path",
  2928. // "required": true,
  2929. // "type": "string"
  2930. // },
  2931. // "maxResults": {
  2932. // "description": "Maximum number of results to return. Default is 100",
  2933. // "format": "int32",
  2934. // "location": "query",
  2935. // "minimum": "1",
  2936. // "type": "integer"
  2937. // },
  2938. // "orderBy": {
  2939. // "description": "Column to use for sorting results",
  2940. // "enum": [
  2941. // "annotatedLocation",
  2942. // "annotatedUser",
  2943. // "lastSync",
  2944. // "notes",
  2945. // "serialNumber",
  2946. // "status",
  2947. // "supportEndDate"
  2948. // ],
  2949. // "enumDescriptions": [
  2950. // "Chromebook location as annotated by the administrator.",
  2951. // "Chromebook user as annotated by administrator.",
  2952. // "Chromebook last sync.",
  2953. // "Chromebook notes as annotated by the administrator.",
  2954. // "Chromebook Serial Number.",
  2955. // "Chromebook status.",
  2956. // "Chromebook support end date."
  2957. // ],
  2958. // "location": "query",
  2959. // "type": "string"
  2960. // },
  2961. // "pageToken": {
  2962. // "description": "Token to specify next page in the list",
  2963. // "location": "query",
  2964. // "type": "string"
  2965. // },
  2966. // "projection": {
  2967. // "description": "Restrict information returned to a set of selected fields.",
  2968. // "enum": [
  2969. // "BASIC",
  2970. // "FULL"
  2971. // ],
  2972. // "enumDescriptions": [
  2973. // "Includes only the basic metadata fields (e.g., deviceId, serialNumber, status, and user)",
  2974. // "Includes all metadata fields"
  2975. // ],
  2976. // "location": "query",
  2977. // "type": "string"
  2978. // },
  2979. // "query": {
  2980. // "description": "Search string in the format given at http://support.google.com/chromeos/a/bin/answer.py?hl=en\u0026answer=1698333",
  2981. // "location": "query",
  2982. // "type": "string"
  2983. // },
  2984. // "sortOrder": {
  2985. // "description": "Whether to return results in ascending or descending order. Only of use when orderBy is also used",
  2986. // "enum": [
  2987. // "ASCENDING",
  2988. // "DESCENDING"
  2989. // ],
  2990. // "enumDescriptions": [
  2991. // "Ascending order.",
  2992. // "Descending order."
  2993. // ],
  2994. // "location": "query",
  2995. // "type": "string"
  2996. // }
  2997. // },
  2998. // "path": "customer/{customerId}/devices/chromeos",
  2999. // "response": {
  3000. // "$ref": "ChromeOsDevices"
  3001. // },
  3002. // "scopes": [
  3003. // "https://www.googleapis.com/auth/admin.directory.device.chromeos",
  3004. // "https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly"
  3005. // ]
  3006. // }
  3007. }
  3008. // Pages invokes f for each page of results.
  3009. // A non-nil error returned from f will halt the iteration.
  3010. // The provided context supersedes any context provided to the Context method.
  3011. func (c *ChromeosdevicesListCall) Pages(ctx context.Context, f func(*ChromeOsDevices) error) error {
  3012. c.ctx_ = ctx
  3013. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3014. for {
  3015. x, err := c.Do()
  3016. if err != nil {
  3017. return err
  3018. }
  3019. if err := f(x); err != nil {
  3020. return err
  3021. }
  3022. if x.NextPageToken == "" {
  3023. return nil
  3024. }
  3025. c.PageToken(x.NextPageToken)
  3026. }
  3027. }
  3028. // method id "directory.chromeosdevices.patch":
  3029. type ChromeosdevicesPatchCall struct {
  3030. s *Service
  3031. customerId string
  3032. deviceId string
  3033. chromeosdevice *ChromeOsDevice
  3034. urlParams_ gensupport.URLParams
  3035. ctx_ context.Context
  3036. }
  3037. // Patch: Update Chrome OS Device. This method supports patch semantics.
  3038. func (r *ChromeosdevicesService) Patch(customerId string, deviceId string, chromeosdevice *ChromeOsDevice) *ChromeosdevicesPatchCall {
  3039. c := &ChromeosdevicesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3040. c.customerId = customerId
  3041. c.deviceId = deviceId
  3042. c.chromeosdevice = chromeosdevice
  3043. return c
  3044. }
  3045. // Projection sets the optional parameter "projection": Restrict
  3046. // information returned to a set of selected fields.
  3047. //
  3048. // Possible values:
  3049. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  3050. // serialNumber, status, and user)
  3051. // "FULL" - Includes all metadata fields
  3052. func (c *ChromeosdevicesPatchCall) Projection(projection string) *ChromeosdevicesPatchCall {
  3053. c.urlParams_.Set("projection", projection)
  3054. return c
  3055. }
  3056. // Fields allows partial responses to be retrieved. See
  3057. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3058. // for more information.
  3059. func (c *ChromeosdevicesPatchCall) Fields(s ...googleapi.Field) *ChromeosdevicesPatchCall {
  3060. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3061. return c
  3062. }
  3063. // Context sets the context to be used in this call's Do method. Any
  3064. // pending HTTP request will be aborted if the provided context is
  3065. // canceled.
  3066. func (c *ChromeosdevicesPatchCall) Context(ctx context.Context) *ChromeosdevicesPatchCall {
  3067. c.ctx_ = ctx
  3068. return c
  3069. }
  3070. func (c *ChromeosdevicesPatchCall) doRequest(alt string) (*http.Response, error) {
  3071. var body io.Reader = nil
  3072. body, err := googleapi.WithoutDataWrapper.JSONReader(c.chromeosdevice)
  3073. if err != nil {
  3074. return nil, err
  3075. }
  3076. ctype := "application/json"
  3077. c.urlParams_.Set("alt", alt)
  3078. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos/{deviceId}")
  3079. urls += "?" + c.urlParams_.Encode()
  3080. req, _ := http.NewRequest("PATCH", urls, body)
  3081. googleapi.Expand(req.URL, map[string]string{
  3082. "customerId": c.customerId,
  3083. "deviceId": c.deviceId,
  3084. })
  3085. req.Header.Set("Content-Type", ctype)
  3086. req.Header.Set("User-Agent", c.s.userAgent())
  3087. if c.ctx_ != nil {
  3088. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3089. }
  3090. return c.s.client.Do(req)
  3091. }
  3092. // Do executes the "directory.chromeosdevices.patch" call.
  3093. // Exactly one of *ChromeOsDevice or error will be non-nil. Any non-2xx
  3094. // status code is an error. Response headers are in either
  3095. // *ChromeOsDevice.ServerResponse.Header or (if a response was returned
  3096. // at all) in error.(*googleapi.Error).Header. Use
  3097. // googleapi.IsNotModified to check whether the returned error was
  3098. // because http.StatusNotModified was returned.
  3099. func (c *ChromeosdevicesPatchCall) Do(opts ...googleapi.CallOption) (*ChromeOsDevice, error) {
  3100. gensupport.SetOptions(c.urlParams_, opts...)
  3101. res, err := c.doRequest("json")
  3102. if res != nil && res.StatusCode == http.StatusNotModified {
  3103. if res.Body != nil {
  3104. res.Body.Close()
  3105. }
  3106. return nil, &googleapi.Error{
  3107. Code: res.StatusCode,
  3108. Header: res.Header,
  3109. }
  3110. }
  3111. if err != nil {
  3112. return nil, err
  3113. }
  3114. defer googleapi.CloseBody(res)
  3115. if err := googleapi.CheckResponse(res); err != nil {
  3116. return nil, err
  3117. }
  3118. ret := &ChromeOsDevice{
  3119. ServerResponse: googleapi.ServerResponse{
  3120. Header: res.Header,
  3121. HTTPStatusCode: res.StatusCode,
  3122. },
  3123. }
  3124. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3125. return nil, err
  3126. }
  3127. return ret, nil
  3128. // {
  3129. // "description": "Update Chrome OS Device. This method supports patch semantics.",
  3130. // "httpMethod": "PATCH",
  3131. // "id": "directory.chromeosdevices.patch",
  3132. // "parameterOrder": [
  3133. // "customerId",
  3134. // "deviceId"
  3135. // ],
  3136. // "parameters": {
  3137. // "customerId": {
  3138. // "description": "Immutable id of the Google Apps account",
  3139. // "location": "path",
  3140. // "required": true,
  3141. // "type": "string"
  3142. // },
  3143. // "deviceId": {
  3144. // "description": "Immutable id of Chrome OS Device",
  3145. // "location": "path",
  3146. // "required": true,
  3147. // "type": "string"
  3148. // },
  3149. // "projection": {
  3150. // "description": "Restrict information returned to a set of selected fields.",
  3151. // "enum": [
  3152. // "BASIC",
  3153. // "FULL"
  3154. // ],
  3155. // "enumDescriptions": [
  3156. // "Includes only the basic metadata fields (e.g., deviceId, serialNumber, status, and user)",
  3157. // "Includes all metadata fields"
  3158. // ],
  3159. // "location": "query",
  3160. // "type": "string"
  3161. // }
  3162. // },
  3163. // "path": "customer/{customerId}/devices/chromeos/{deviceId}",
  3164. // "request": {
  3165. // "$ref": "ChromeOsDevice"
  3166. // },
  3167. // "response": {
  3168. // "$ref": "ChromeOsDevice"
  3169. // },
  3170. // "scopes": [
  3171. // "https://www.googleapis.com/auth/admin.directory.device.chromeos"
  3172. // ]
  3173. // }
  3174. }
  3175. // method id "directory.chromeosdevices.update":
  3176. type ChromeosdevicesUpdateCall struct {
  3177. s *Service
  3178. customerId string
  3179. deviceId string
  3180. chromeosdevice *ChromeOsDevice
  3181. urlParams_ gensupport.URLParams
  3182. ctx_ context.Context
  3183. }
  3184. // Update: Update Chrome OS Device
  3185. func (r *ChromeosdevicesService) Update(customerId string, deviceId string, chromeosdevice *ChromeOsDevice) *ChromeosdevicesUpdateCall {
  3186. c := &ChromeosdevicesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3187. c.customerId = customerId
  3188. c.deviceId = deviceId
  3189. c.chromeosdevice = chromeosdevice
  3190. return c
  3191. }
  3192. // Projection sets the optional parameter "projection": Restrict
  3193. // information returned to a set of selected fields.
  3194. //
  3195. // Possible values:
  3196. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  3197. // serialNumber, status, and user)
  3198. // "FULL" - Includes all metadata fields
  3199. func (c *ChromeosdevicesUpdateCall) Projection(projection string) *ChromeosdevicesUpdateCall {
  3200. c.urlParams_.Set("projection", projection)
  3201. return c
  3202. }
  3203. // Fields allows partial responses to be retrieved. See
  3204. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3205. // for more information.
  3206. func (c *ChromeosdevicesUpdateCall) Fields(s ...googleapi.Field) *ChromeosdevicesUpdateCall {
  3207. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3208. return c
  3209. }
  3210. // Context sets the context to be used in this call's Do method. Any
  3211. // pending HTTP request will be aborted if the provided context is
  3212. // canceled.
  3213. func (c *ChromeosdevicesUpdateCall) Context(ctx context.Context) *ChromeosdevicesUpdateCall {
  3214. c.ctx_ = ctx
  3215. return c
  3216. }
  3217. func (c *ChromeosdevicesUpdateCall) doRequest(alt string) (*http.Response, error) {
  3218. var body io.Reader = nil
  3219. body, err := googleapi.WithoutDataWrapper.JSONReader(c.chromeosdevice)
  3220. if err != nil {
  3221. return nil, err
  3222. }
  3223. ctype := "application/json"
  3224. c.urlParams_.Set("alt", alt)
  3225. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos/{deviceId}")
  3226. urls += "?" + c.urlParams_.Encode()
  3227. req, _ := http.NewRequest("PUT", urls, body)
  3228. googleapi.Expand(req.URL, map[string]string{
  3229. "customerId": c.customerId,
  3230. "deviceId": c.deviceId,
  3231. })
  3232. req.Header.Set("Content-Type", ctype)
  3233. req.Header.Set("User-Agent", c.s.userAgent())
  3234. if c.ctx_ != nil {
  3235. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3236. }
  3237. return c.s.client.Do(req)
  3238. }
  3239. // Do executes the "directory.chromeosdevices.update" call.
  3240. // Exactly one of *ChromeOsDevice or error will be non-nil. Any non-2xx
  3241. // status code is an error. Response headers are in either
  3242. // *ChromeOsDevice.ServerResponse.Header or (if a response was returned
  3243. // at all) in error.(*googleapi.Error).Header. Use
  3244. // googleapi.IsNotModified to check whether the returned error was
  3245. // because http.StatusNotModified was returned.
  3246. func (c *ChromeosdevicesUpdateCall) Do(opts ...googleapi.CallOption) (*ChromeOsDevice, error) {
  3247. gensupport.SetOptions(c.urlParams_, opts...)
  3248. res, err := c.doRequest("json")
  3249. if res != nil && res.StatusCode == http.StatusNotModified {
  3250. if res.Body != nil {
  3251. res.Body.Close()
  3252. }
  3253. return nil, &googleapi.Error{
  3254. Code: res.StatusCode,
  3255. Header: res.Header,
  3256. }
  3257. }
  3258. if err != nil {
  3259. return nil, err
  3260. }
  3261. defer googleapi.CloseBody(res)
  3262. if err := googleapi.CheckResponse(res); err != nil {
  3263. return nil, err
  3264. }
  3265. ret := &ChromeOsDevice{
  3266. ServerResponse: googleapi.ServerResponse{
  3267. Header: res.Header,
  3268. HTTPStatusCode: res.StatusCode,
  3269. },
  3270. }
  3271. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3272. return nil, err
  3273. }
  3274. return ret, nil
  3275. // {
  3276. // "description": "Update Chrome OS Device",
  3277. // "httpMethod": "PUT",
  3278. // "id": "directory.chromeosdevices.update",
  3279. // "parameterOrder": [
  3280. // "customerId",
  3281. // "deviceId"
  3282. // ],
  3283. // "parameters": {
  3284. // "customerId": {
  3285. // "description": "Immutable id of the Google Apps account",
  3286. // "location": "path",
  3287. // "required": true,
  3288. // "type": "string"
  3289. // },
  3290. // "deviceId": {
  3291. // "description": "Immutable id of Chrome OS Device",
  3292. // "location": "path",
  3293. // "required": true,
  3294. // "type": "string"
  3295. // },
  3296. // "projection": {
  3297. // "description": "Restrict information returned to a set of selected fields.",
  3298. // "enum": [
  3299. // "BASIC",
  3300. // "FULL"
  3301. // ],
  3302. // "enumDescriptions": [
  3303. // "Includes only the basic metadata fields (e.g., deviceId, serialNumber, status, and user)",
  3304. // "Includes all metadata fields"
  3305. // ],
  3306. // "location": "query",
  3307. // "type": "string"
  3308. // }
  3309. // },
  3310. // "path": "customer/{customerId}/devices/chromeos/{deviceId}",
  3311. // "request": {
  3312. // "$ref": "ChromeOsDevice"
  3313. // },
  3314. // "response": {
  3315. // "$ref": "ChromeOsDevice"
  3316. // },
  3317. // "scopes": [
  3318. // "https://www.googleapis.com/auth/admin.directory.device.chromeos"
  3319. // ]
  3320. // }
  3321. }
  3322. // method id "directory.customers.get":
  3323. type CustomersGetCall struct {
  3324. s *Service
  3325. customerKey string
  3326. urlParams_ gensupport.URLParams
  3327. ifNoneMatch_ string
  3328. ctx_ context.Context
  3329. }
  3330. // Get: Retrives a customer.
  3331. func (r *CustomersService) Get(customerKey string) *CustomersGetCall {
  3332. c := &CustomersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3333. c.customerKey = customerKey
  3334. return c
  3335. }
  3336. // Fields allows partial responses to be retrieved. See
  3337. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3338. // for more information.
  3339. func (c *CustomersGetCall) Fields(s ...googleapi.Field) *CustomersGetCall {
  3340. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3341. return c
  3342. }
  3343. // IfNoneMatch sets the optional parameter which makes the operation
  3344. // fail if the object's ETag matches the given value. This is useful for
  3345. // getting updates only after the object has changed since the last
  3346. // request. Use googleapi.IsNotModified to check whether the response
  3347. // error from Do is the result of In-None-Match.
  3348. func (c *CustomersGetCall) IfNoneMatch(entityTag string) *CustomersGetCall {
  3349. c.ifNoneMatch_ = entityTag
  3350. return c
  3351. }
  3352. // Context sets the context to be used in this call's Do method. Any
  3353. // pending HTTP request will be aborted if the provided context is
  3354. // canceled.
  3355. func (c *CustomersGetCall) Context(ctx context.Context) *CustomersGetCall {
  3356. c.ctx_ = ctx
  3357. return c
  3358. }
  3359. func (c *CustomersGetCall) doRequest(alt string) (*http.Response, error) {
  3360. var body io.Reader = nil
  3361. c.urlParams_.Set("alt", alt)
  3362. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerKey}")
  3363. urls += "?" + c.urlParams_.Encode()
  3364. req, _ := http.NewRequest("GET", urls, body)
  3365. googleapi.Expand(req.URL, map[string]string{
  3366. "customerKey": c.customerKey,
  3367. })
  3368. req.Header.Set("User-Agent", c.s.userAgent())
  3369. if c.ifNoneMatch_ != "" {
  3370. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3371. }
  3372. if c.ctx_ != nil {
  3373. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3374. }
  3375. return c.s.client.Do(req)
  3376. }
  3377. // Do executes the "directory.customers.get" call.
  3378. // Exactly one of *Customer or error will be non-nil. Any non-2xx status
  3379. // code is an error. Response headers are in either
  3380. // *Customer.ServerResponse.Header or (if a response was returned at
  3381. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3382. // to check whether the returned error was because
  3383. // http.StatusNotModified was returned.
  3384. func (c *CustomersGetCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  3385. gensupport.SetOptions(c.urlParams_, opts...)
  3386. res, err := c.doRequest("json")
  3387. if res != nil && res.StatusCode == http.StatusNotModified {
  3388. if res.Body != nil {
  3389. res.Body.Close()
  3390. }
  3391. return nil, &googleapi.Error{
  3392. Code: res.StatusCode,
  3393. Header: res.Header,
  3394. }
  3395. }
  3396. if err != nil {
  3397. return nil, err
  3398. }
  3399. defer googleapi.CloseBody(res)
  3400. if err := googleapi.CheckResponse(res); err != nil {
  3401. return nil, err
  3402. }
  3403. ret := &Customer{
  3404. ServerResponse: googleapi.ServerResponse{
  3405. Header: res.Header,
  3406. HTTPStatusCode: res.StatusCode,
  3407. },
  3408. }
  3409. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3410. return nil, err
  3411. }
  3412. return ret, nil
  3413. // {
  3414. // "description": "Retrives a customer.",
  3415. // "httpMethod": "GET",
  3416. // "id": "directory.customers.get",
  3417. // "parameterOrder": [
  3418. // "customerKey"
  3419. // ],
  3420. // "parameters": {
  3421. // "customerKey": {
  3422. // "description": "Id of the customer to be retrieved",
  3423. // "location": "path",
  3424. // "required": true,
  3425. // "type": "string"
  3426. // }
  3427. // },
  3428. // "path": "customers/{customerKey}",
  3429. // "response": {
  3430. // "$ref": "Customer"
  3431. // },
  3432. // "scopes": [
  3433. // "https://www.googleapis.com/auth/admin.directory.customer",
  3434. // "https://www.googleapis.com/auth/admin.directory.customer.readonly"
  3435. // ]
  3436. // }
  3437. }
  3438. // method id "directory.customers.patch":
  3439. type CustomersPatchCall struct {
  3440. s *Service
  3441. customerKey string
  3442. customer *Customer
  3443. urlParams_ gensupport.URLParams
  3444. ctx_ context.Context
  3445. }
  3446. // Patch: Updates a customer. This method supports patch semantics.
  3447. func (r *CustomersService) Patch(customerKey string, customer *Customer) *CustomersPatchCall {
  3448. c := &CustomersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3449. c.customerKey = customerKey
  3450. c.customer = customer
  3451. return c
  3452. }
  3453. // Fields allows partial responses to be retrieved. See
  3454. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3455. // for more information.
  3456. func (c *CustomersPatchCall) Fields(s ...googleapi.Field) *CustomersPatchCall {
  3457. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3458. return c
  3459. }
  3460. // Context sets the context to be used in this call's Do method. Any
  3461. // pending HTTP request will be aborted if the provided context is
  3462. // canceled.
  3463. func (c *CustomersPatchCall) Context(ctx context.Context) *CustomersPatchCall {
  3464. c.ctx_ = ctx
  3465. return c
  3466. }
  3467. func (c *CustomersPatchCall) doRequest(alt string) (*http.Response, error) {
  3468. var body io.Reader = nil
  3469. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
  3470. if err != nil {
  3471. return nil, err
  3472. }
  3473. ctype := "application/json"
  3474. c.urlParams_.Set("alt", alt)
  3475. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerKey}")
  3476. urls += "?" + c.urlParams_.Encode()
  3477. req, _ := http.NewRequest("PATCH", urls, body)
  3478. googleapi.Expand(req.URL, map[string]string{
  3479. "customerKey": c.customerKey,
  3480. })
  3481. req.Header.Set("Content-Type", ctype)
  3482. req.Header.Set("User-Agent", c.s.userAgent())
  3483. if c.ctx_ != nil {
  3484. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3485. }
  3486. return c.s.client.Do(req)
  3487. }
  3488. // Do executes the "directory.customers.patch" call.
  3489. // Exactly one of *Customer or error will be non-nil. Any non-2xx status
  3490. // code is an error. Response headers are in either
  3491. // *Customer.ServerResponse.Header or (if a response was returned at
  3492. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3493. // to check whether the returned error was because
  3494. // http.StatusNotModified was returned.
  3495. func (c *CustomersPatchCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  3496. gensupport.SetOptions(c.urlParams_, opts...)
  3497. res, err := c.doRequest("json")
  3498. if res != nil && res.StatusCode == http.StatusNotModified {
  3499. if res.Body != nil {
  3500. res.Body.Close()
  3501. }
  3502. return nil, &googleapi.Error{
  3503. Code: res.StatusCode,
  3504. Header: res.Header,
  3505. }
  3506. }
  3507. if err != nil {
  3508. return nil, err
  3509. }
  3510. defer googleapi.CloseBody(res)
  3511. if err := googleapi.CheckResponse(res); err != nil {
  3512. return nil, err
  3513. }
  3514. ret := &Customer{
  3515. ServerResponse: googleapi.ServerResponse{
  3516. Header: res.Header,
  3517. HTTPStatusCode: res.StatusCode,
  3518. },
  3519. }
  3520. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3521. return nil, err
  3522. }
  3523. return ret, nil
  3524. // {
  3525. // "description": "Updates a customer. This method supports patch semantics.",
  3526. // "httpMethod": "PATCH",
  3527. // "id": "directory.customers.patch",
  3528. // "parameterOrder": [
  3529. // "customerKey"
  3530. // ],
  3531. // "parameters": {
  3532. // "customerKey": {
  3533. // "description": "Id of the customer to be updated",
  3534. // "location": "path",
  3535. // "required": true,
  3536. // "type": "string"
  3537. // }
  3538. // },
  3539. // "path": "customers/{customerKey}",
  3540. // "request": {
  3541. // "$ref": "Customer"
  3542. // },
  3543. // "response": {
  3544. // "$ref": "Customer"
  3545. // },
  3546. // "scopes": [
  3547. // "https://www.googleapis.com/auth/admin.directory.customer"
  3548. // ]
  3549. // }
  3550. }
  3551. // method id "directory.customers.update":
  3552. type CustomersUpdateCall struct {
  3553. s *Service
  3554. customerKey string
  3555. customer *Customer
  3556. urlParams_ gensupport.URLParams
  3557. ctx_ context.Context
  3558. }
  3559. // Update: Updates a customer.
  3560. func (r *CustomersService) Update(customerKey string, customer *Customer) *CustomersUpdateCall {
  3561. c := &CustomersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3562. c.customerKey = customerKey
  3563. c.customer = customer
  3564. return c
  3565. }
  3566. // Fields allows partial responses to be retrieved. See
  3567. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3568. // for more information.
  3569. func (c *CustomersUpdateCall) Fields(s ...googleapi.Field) *CustomersUpdateCall {
  3570. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3571. return c
  3572. }
  3573. // Context sets the context to be used in this call's Do method. Any
  3574. // pending HTTP request will be aborted if the provided context is
  3575. // canceled.
  3576. func (c *CustomersUpdateCall) Context(ctx context.Context) *CustomersUpdateCall {
  3577. c.ctx_ = ctx
  3578. return c
  3579. }
  3580. func (c *CustomersUpdateCall) doRequest(alt string) (*http.Response, error) {
  3581. var body io.Reader = nil
  3582. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
  3583. if err != nil {
  3584. return nil, err
  3585. }
  3586. ctype := "application/json"
  3587. c.urlParams_.Set("alt", alt)
  3588. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerKey}")
  3589. urls += "?" + c.urlParams_.Encode()
  3590. req, _ := http.NewRequest("PUT", urls, body)
  3591. googleapi.Expand(req.URL, map[string]string{
  3592. "customerKey": c.customerKey,
  3593. })
  3594. req.Header.Set("Content-Type", ctype)
  3595. req.Header.Set("User-Agent", c.s.userAgent())
  3596. if c.ctx_ != nil {
  3597. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3598. }
  3599. return c.s.client.Do(req)
  3600. }
  3601. // Do executes the "directory.customers.update" call.
  3602. // Exactly one of *Customer or error will be non-nil. Any non-2xx status
  3603. // code is an error. Response headers are in either
  3604. // *Customer.ServerResponse.Header or (if a response was returned at
  3605. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3606. // to check whether the returned error was because
  3607. // http.StatusNotModified was returned.
  3608. func (c *CustomersUpdateCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  3609. gensupport.SetOptions(c.urlParams_, opts...)
  3610. res, err := c.doRequest("json")
  3611. if res != nil && res.StatusCode == http.StatusNotModified {
  3612. if res.Body != nil {
  3613. res.Body.Close()
  3614. }
  3615. return nil, &googleapi.Error{
  3616. Code: res.StatusCode,
  3617. Header: res.Header,
  3618. }
  3619. }
  3620. if err != nil {
  3621. return nil, err
  3622. }
  3623. defer googleapi.CloseBody(res)
  3624. if err := googleapi.CheckResponse(res); err != nil {
  3625. return nil, err
  3626. }
  3627. ret := &Customer{
  3628. ServerResponse: googleapi.ServerResponse{
  3629. Header: res.Header,
  3630. HTTPStatusCode: res.StatusCode,
  3631. },
  3632. }
  3633. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3634. return nil, err
  3635. }
  3636. return ret, nil
  3637. // {
  3638. // "description": "Updates a customer.",
  3639. // "httpMethod": "PUT",
  3640. // "id": "directory.customers.update",
  3641. // "parameterOrder": [
  3642. // "customerKey"
  3643. // ],
  3644. // "parameters": {
  3645. // "customerKey": {
  3646. // "description": "Id of the customer to be updated",
  3647. // "location": "path",
  3648. // "required": true,
  3649. // "type": "string"
  3650. // }
  3651. // },
  3652. // "path": "customers/{customerKey}",
  3653. // "request": {
  3654. // "$ref": "Customer"
  3655. // },
  3656. // "response": {
  3657. // "$ref": "Customer"
  3658. // },
  3659. // "scopes": [
  3660. // "https://www.googleapis.com/auth/admin.directory.customer"
  3661. // ]
  3662. // }
  3663. }
  3664. // method id "directory.domainAliases.delete":
  3665. type DomainAliasesDeleteCall struct {
  3666. s *Service
  3667. customer string
  3668. domainAliasName string
  3669. urlParams_ gensupport.URLParams
  3670. ctx_ context.Context
  3671. }
  3672. // Delete: Deletes a Domain Alias of the customer.
  3673. func (r *DomainAliasesService) Delete(customer string, domainAliasName string) *DomainAliasesDeleteCall {
  3674. c := &DomainAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3675. c.customer = customer
  3676. c.domainAliasName = domainAliasName
  3677. return c
  3678. }
  3679. // Fields allows partial responses to be retrieved. See
  3680. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3681. // for more information.
  3682. func (c *DomainAliasesDeleteCall) Fields(s ...googleapi.Field) *DomainAliasesDeleteCall {
  3683. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3684. return c
  3685. }
  3686. // Context sets the context to be used in this call's Do method. Any
  3687. // pending HTTP request will be aborted if the provided context is
  3688. // canceled.
  3689. func (c *DomainAliasesDeleteCall) Context(ctx context.Context) *DomainAliasesDeleteCall {
  3690. c.ctx_ = ctx
  3691. return c
  3692. }
  3693. func (c *DomainAliasesDeleteCall) doRequest(alt string) (*http.Response, error) {
  3694. var body io.Reader = nil
  3695. c.urlParams_.Set("alt", alt)
  3696. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domainaliases/{domainAliasName}")
  3697. urls += "?" + c.urlParams_.Encode()
  3698. req, _ := http.NewRequest("DELETE", urls, body)
  3699. googleapi.Expand(req.URL, map[string]string{
  3700. "customer": c.customer,
  3701. "domainAliasName": c.domainAliasName,
  3702. })
  3703. req.Header.Set("User-Agent", c.s.userAgent())
  3704. if c.ctx_ != nil {
  3705. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3706. }
  3707. return c.s.client.Do(req)
  3708. }
  3709. // Do executes the "directory.domainAliases.delete" call.
  3710. func (c *DomainAliasesDeleteCall) Do(opts ...googleapi.CallOption) error {
  3711. gensupport.SetOptions(c.urlParams_, opts...)
  3712. res, err := c.doRequest("json")
  3713. if err != nil {
  3714. return err
  3715. }
  3716. defer googleapi.CloseBody(res)
  3717. if err := googleapi.CheckResponse(res); err != nil {
  3718. return err
  3719. }
  3720. return nil
  3721. // {
  3722. // "description": "Deletes a Domain Alias of the customer.",
  3723. // "httpMethod": "DELETE",
  3724. // "id": "directory.domainAliases.delete",
  3725. // "parameterOrder": [
  3726. // "customer",
  3727. // "domainAliasName"
  3728. // ],
  3729. // "parameters": {
  3730. // "customer": {
  3731. // "description": "Immutable id of the Google Apps account.",
  3732. // "location": "path",
  3733. // "required": true,
  3734. // "type": "string"
  3735. // },
  3736. // "domainAliasName": {
  3737. // "description": "Name of domain alias to be retrieved.",
  3738. // "location": "path",
  3739. // "required": true,
  3740. // "type": "string"
  3741. // }
  3742. // },
  3743. // "path": "customer/{customer}/domainaliases/{domainAliasName}",
  3744. // "scopes": [
  3745. // "https://www.googleapis.com/auth/admin.directory.domain"
  3746. // ]
  3747. // }
  3748. }
  3749. // method id "directory.domainAliases.get":
  3750. type DomainAliasesGetCall struct {
  3751. s *Service
  3752. customer string
  3753. domainAliasName string
  3754. urlParams_ gensupport.URLParams
  3755. ifNoneMatch_ string
  3756. ctx_ context.Context
  3757. }
  3758. // Get: Retrieves a domain alias of the customer.
  3759. func (r *DomainAliasesService) Get(customer string, domainAliasName string) *DomainAliasesGetCall {
  3760. c := &DomainAliasesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3761. c.customer = customer
  3762. c.domainAliasName = domainAliasName
  3763. return c
  3764. }
  3765. // Fields allows partial responses to be retrieved. See
  3766. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3767. // for more information.
  3768. func (c *DomainAliasesGetCall) Fields(s ...googleapi.Field) *DomainAliasesGetCall {
  3769. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3770. return c
  3771. }
  3772. // IfNoneMatch sets the optional parameter which makes the operation
  3773. // fail if the object's ETag matches the given value. This is useful for
  3774. // getting updates only after the object has changed since the last
  3775. // request. Use googleapi.IsNotModified to check whether the response
  3776. // error from Do is the result of In-None-Match.
  3777. func (c *DomainAliasesGetCall) IfNoneMatch(entityTag string) *DomainAliasesGetCall {
  3778. c.ifNoneMatch_ = entityTag
  3779. return c
  3780. }
  3781. // Context sets the context to be used in this call's Do method. Any
  3782. // pending HTTP request will be aborted if the provided context is
  3783. // canceled.
  3784. func (c *DomainAliasesGetCall) Context(ctx context.Context) *DomainAliasesGetCall {
  3785. c.ctx_ = ctx
  3786. return c
  3787. }
  3788. func (c *DomainAliasesGetCall) doRequest(alt string) (*http.Response, error) {
  3789. var body io.Reader = nil
  3790. c.urlParams_.Set("alt", alt)
  3791. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domainaliases/{domainAliasName}")
  3792. urls += "?" + c.urlParams_.Encode()
  3793. req, _ := http.NewRequest("GET", urls, body)
  3794. googleapi.Expand(req.URL, map[string]string{
  3795. "customer": c.customer,
  3796. "domainAliasName": c.domainAliasName,
  3797. })
  3798. req.Header.Set("User-Agent", c.s.userAgent())
  3799. if c.ifNoneMatch_ != "" {
  3800. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3801. }
  3802. if c.ctx_ != nil {
  3803. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3804. }
  3805. return c.s.client.Do(req)
  3806. }
  3807. // Do executes the "directory.domainAliases.get" call.
  3808. // Exactly one of *DomainAlias or error will be non-nil. Any non-2xx
  3809. // status code is an error. Response headers are in either
  3810. // *DomainAlias.ServerResponse.Header or (if a response was returned at
  3811. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3812. // to check whether the returned error was because
  3813. // http.StatusNotModified was returned.
  3814. func (c *DomainAliasesGetCall) Do(opts ...googleapi.CallOption) (*DomainAlias, error) {
  3815. gensupport.SetOptions(c.urlParams_, opts...)
  3816. res, err := c.doRequest("json")
  3817. if res != nil && res.StatusCode == http.StatusNotModified {
  3818. if res.Body != nil {
  3819. res.Body.Close()
  3820. }
  3821. return nil, &googleapi.Error{
  3822. Code: res.StatusCode,
  3823. Header: res.Header,
  3824. }
  3825. }
  3826. if err != nil {
  3827. return nil, err
  3828. }
  3829. defer googleapi.CloseBody(res)
  3830. if err := googleapi.CheckResponse(res); err != nil {
  3831. return nil, err
  3832. }
  3833. ret := &DomainAlias{
  3834. ServerResponse: googleapi.ServerResponse{
  3835. Header: res.Header,
  3836. HTTPStatusCode: res.StatusCode,
  3837. },
  3838. }
  3839. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3840. return nil, err
  3841. }
  3842. return ret, nil
  3843. // {
  3844. // "description": "Retrieves a domain alias of the customer.",
  3845. // "httpMethod": "GET",
  3846. // "id": "directory.domainAliases.get",
  3847. // "parameterOrder": [
  3848. // "customer",
  3849. // "domainAliasName"
  3850. // ],
  3851. // "parameters": {
  3852. // "customer": {
  3853. // "description": "Immutable id of the Google Apps account.",
  3854. // "location": "path",
  3855. // "required": true,
  3856. // "type": "string"
  3857. // },
  3858. // "domainAliasName": {
  3859. // "description": "Name of domain alias to be retrieved.",
  3860. // "location": "path",
  3861. // "required": true,
  3862. // "type": "string"
  3863. // }
  3864. // },
  3865. // "path": "customer/{customer}/domainaliases/{domainAliasName}",
  3866. // "response": {
  3867. // "$ref": "DomainAlias"
  3868. // },
  3869. // "scopes": [
  3870. // "https://www.googleapis.com/auth/admin.directory.domain",
  3871. // "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  3872. // ]
  3873. // }
  3874. }
  3875. // method id "directory.domainAliases.insert":
  3876. type DomainAliasesInsertCall struct {
  3877. s *Service
  3878. customer string
  3879. domainalias *DomainAlias
  3880. urlParams_ gensupport.URLParams
  3881. ctx_ context.Context
  3882. }
  3883. // Insert: Inserts a Domain alias of the customer.
  3884. func (r *DomainAliasesService) Insert(customer string, domainalias *DomainAlias) *DomainAliasesInsertCall {
  3885. c := &DomainAliasesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3886. c.customer = customer
  3887. c.domainalias = domainalias
  3888. return c
  3889. }
  3890. // Fields allows partial responses to be retrieved. See
  3891. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3892. // for more information.
  3893. func (c *DomainAliasesInsertCall) Fields(s ...googleapi.Field) *DomainAliasesInsertCall {
  3894. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3895. return c
  3896. }
  3897. // Context sets the context to be used in this call's Do method. Any
  3898. // pending HTTP request will be aborted if the provided context is
  3899. // canceled.
  3900. func (c *DomainAliasesInsertCall) Context(ctx context.Context) *DomainAliasesInsertCall {
  3901. c.ctx_ = ctx
  3902. return c
  3903. }
  3904. func (c *DomainAliasesInsertCall) doRequest(alt string) (*http.Response, error) {
  3905. var body io.Reader = nil
  3906. body, err := googleapi.WithoutDataWrapper.JSONReader(c.domainalias)
  3907. if err != nil {
  3908. return nil, err
  3909. }
  3910. ctype := "application/json"
  3911. c.urlParams_.Set("alt", alt)
  3912. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domainaliases")
  3913. urls += "?" + c.urlParams_.Encode()
  3914. req, _ := http.NewRequest("POST", urls, body)
  3915. googleapi.Expand(req.URL, map[string]string{
  3916. "customer": c.customer,
  3917. })
  3918. req.Header.Set("Content-Type", ctype)
  3919. req.Header.Set("User-Agent", c.s.userAgent())
  3920. if c.ctx_ != nil {
  3921. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3922. }
  3923. return c.s.client.Do(req)
  3924. }
  3925. // Do executes the "directory.domainAliases.insert" call.
  3926. // Exactly one of *DomainAlias or error will be non-nil. Any non-2xx
  3927. // status code is an error. Response headers are in either
  3928. // *DomainAlias.ServerResponse.Header or (if a response was returned at
  3929. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3930. // to check whether the returned error was because
  3931. // http.StatusNotModified was returned.
  3932. func (c *DomainAliasesInsertCall) Do(opts ...googleapi.CallOption) (*DomainAlias, error) {
  3933. gensupport.SetOptions(c.urlParams_, opts...)
  3934. res, err := c.doRequest("json")
  3935. if res != nil && res.StatusCode == http.StatusNotModified {
  3936. if res.Body != nil {
  3937. res.Body.Close()
  3938. }
  3939. return nil, &googleapi.Error{
  3940. Code: res.StatusCode,
  3941. Header: res.Header,
  3942. }
  3943. }
  3944. if err != nil {
  3945. return nil, err
  3946. }
  3947. defer googleapi.CloseBody(res)
  3948. if err := googleapi.CheckResponse(res); err != nil {
  3949. return nil, err
  3950. }
  3951. ret := &DomainAlias{
  3952. ServerResponse: googleapi.ServerResponse{
  3953. Header: res.Header,
  3954. HTTPStatusCode: res.StatusCode,
  3955. },
  3956. }
  3957. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3958. return nil, err
  3959. }
  3960. return ret, nil
  3961. // {
  3962. // "description": "Inserts a Domain alias of the customer.",
  3963. // "httpMethod": "POST",
  3964. // "id": "directory.domainAliases.insert",
  3965. // "parameterOrder": [
  3966. // "customer"
  3967. // ],
  3968. // "parameters": {
  3969. // "customer": {
  3970. // "description": "Immutable id of the Google Apps account.",
  3971. // "location": "path",
  3972. // "required": true,
  3973. // "type": "string"
  3974. // }
  3975. // },
  3976. // "path": "customer/{customer}/domainaliases",
  3977. // "request": {
  3978. // "$ref": "DomainAlias"
  3979. // },
  3980. // "response": {
  3981. // "$ref": "DomainAlias"
  3982. // },
  3983. // "scopes": [
  3984. // "https://www.googleapis.com/auth/admin.directory.domain"
  3985. // ]
  3986. // }
  3987. }
  3988. // method id "directory.domainAliases.list":
  3989. type DomainAliasesListCall struct {
  3990. s *Service
  3991. customer string
  3992. urlParams_ gensupport.URLParams
  3993. ifNoneMatch_ string
  3994. ctx_ context.Context
  3995. }
  3996. // List: Lists the domain aliases of the customer.
  3997. func (r *DomainAliasesService) List(customer string) *DomainAliasesListCall {
  3998. c := &DomainAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3999. c.customer = customer
  4000. return c
  4001. }
  4002. // ParentDomainName sets the optional parameter "parentDomainName": Name
  4003. // of the parent domain for which domain aliases are to be fetched.
  4004. func (c *DomainAliasesListCall) ParentDomainName(parentDomainName string) *DomainAliasesListCall {
  4005. c.urlParams_.Set("parentDomainName", parentDomainName)
  4006. return c
  4007. }
  4008. // Fields allows partial responses to be retrieved. See
  4009. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4010. // for more information.
  4011. func (c *DomainAliasesListCall) Fields(s ...googleapi.Field) *DomainAliasesListCall {
  4012. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4013. return c
  4014. }
  4015. // IfNoneMatch sets the optional parameter which makes the operation
  4016. // fail if the object's ETag matches the given value. This is useful for
  4017. // getting updates only after the object has changed since the last
  4018. // request. Use googleapi.IsNotModified to check whether the response
  4019. // error from Do is the result of In-None-Match.
  4020. func (c *DomainAliasesListCall) IfNoneMatch(entityTag string) *DomainAliasesListCall {
  4021. c.ifNoneMatch_ = entityTag
  4022. return c
  4023. }
  4024. // Context sets the context to be used in this call's Do method. Any
  4025. // pending HTTP request will be aborted if the provided context is
  4026. // canceled.
  4027. func (c *DomainAliasesListCall) Context(ctx context.Context) *DomainAliasesListCall {
  4028. c.ctx_ = ctx
  4029. return c
  4030. }
  4031. func (c *DomainAliasesListCall) doRequest(alt string) (*http.Response, error) {
  4032. var body io.Reader = nil
  4033. c.urlParams_.Set("alt", alt)
  4034. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domainaliases")
  4035. urls += "?" + c.urlParams_.Encode()
  4036. req, _ := http.NewRequest("GET", urls, body)
  4037. googleapi.Expand(req.URL, map[string]string{
  4038. "customer": c.customer,
  4039. })
  4040. req.Header.Set("User-Agent", c.s.userAgent())
  4041. if c.ifNoneMatch_ != "" {
  4042. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4043. }
  4044. if c.ctx_ != nil {
  4045. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4046. }
  4047. return c.s.client.Do(req)
  4048. }
  4049. // Do executes the "directory.domainAliases.list" call.
  4050. // Exactly one of *DomainAliases or error will be non-nil. Any non-2xx
  4051. // status code is an error. Response headers are in either
  4052. // *DomainAliases.ServerResponse.Header or (if a response was returned
  4053. // at all) in error.(*googleapi.Error).Header. Use
  4054. // googleapi.IsNotModified to check whether the returned error was
  4055. // because http.StatusNotModified was returned.
  4056. func (c *DomainAliasesListCall) Do(opts ...googleapi.CallOption) (*DomainAliases, error) {
  4057. gensupport.SetOptions(c.urlParams_, opts...)
  4058. res, err := c.doRequest("json")
  4059. if res != nil && res.StatusCode == http.StatusNotModified {
  4060. if res.Body != nil {
  4061. res.Body.Close()
  4062. }
  4063. return nil, &googleapi.Error{
  4064. Code: res.StatusCode,
  4065. Header: res.Header,
  4066. }
  4067. }
  4068. if err != nil {
  4069. return nil, err
  4070. }
  4071. defer googleapi.CloseBody(res)
  4072. if err := googleapi.CheckResponse(res); err != nil {
  4073. return nil, err
  4074. }
  4075. ret := &DomainAliases{
  4076. ServerResponse: googleapi.ServerResponse{
  4077. Header: res.Header,
  4078. HTTPStatusCode: res.StatusCode,
  4079. },
  4080. }
  4081. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4082. return nil, err
  4083. }
  4084. return ret, nil
  4085. // {
  4086. // "description": "Lists the domain aliases of the customer.",
  4087. // "httpMethod": "GET",
  4088. // "id": "directory.domainAliases.list",
  4089. // "parameterOrder": [
  4090. // "customer"
  4091. // ],
  4092. // "parameters": {
  4093. // "customer": {
  4094. // "description": "Immutable id of the Google Apps account.",
  4095. // "location": "path",
  4096. // "required": true,
  4097. // "type": "string"
  4098. // },
  4099. // "parentDomainName": {
  4100. // "description": "Name of the parent domain for which domain aliases are to be fetched.",
  4101. // "location": "query",
  4102. // "type": "string"
  4103. // }
  4104. // },
  4105. // "path": "customer/{customer}/domainaliases",
  4106. // "response": {
  4107. // "$ref": "DomainAliases"
  4108. // },
  4109. // "scopes": [
  4110. // "https://www.googleapis.com/auth/admin.directory.domain",
  4111. // "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  4112. // ]
  4113. // }
  4114. }
  4115. // method id "directory.domains.delete":
  4116. type DomainsDeleteCall struct {
  4117. s *Service
  4118. customer string
  4119. domainName string
  4120. urlParams_ gensupport.URLParams
  4121. ctx_ context.Context
  4122. }
  4123. // Delete: Deletes a domain of the customer.
  4124. func (r *DomainsService) Delete(customer string, domainName string) *DomainsDeleteCall {
  4125. c := &DomainsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4126. c.customer = customer
  4127. c.domainName = domainName
  4128. return c
  4129. }
  4130. // Fields allows partial responses to be retrieved. See
  4131. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4132. // for more information.
  4133. func (c *DomainsDeleteCall) Fields(s ...googleapi.Field) *DomainsDeleteCall {
  4134. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4135. return c
  4136. }
  4137. // Context sets the context to be used in this call's Do method. Any
  4138. // pending HTTP request will be aborted if the provided context is
  4139. // canceled.
  4140. func (c *DomainsDeleteCall) Context(ctx context.Context) *DomainsDeleteCall {
  4141. c.ctx_ = ctx
  4142. return c
  4143. }
  4144. func (c *DomainsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4145. var body io.Reader = nil
  4146. c.urlParams_.Set("alt", alt)
  4147. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domains/{domainName}")
  4148. urls += "?" + c.urlParams_.Encode()
  4149. req, _ := http.NewRequest("DELETE", urls, body)
  4150. googleapi.Expand(req.URL, map[string]string{
  4151. "customer": c.customer,
  4152. "domainName": c.domainName,
  4153. })
  4154. req.Header.Set("User-Agent", c.s.userAgent())
  4155. if c.ctx_ != nil {
  4156. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4157. }
  4158. return c.s.client.Do(req)
  4159. }
  4160. // Do executes the "directory.domains.delete" call.
  4161. func (c *DomainsDeleteCall) Do(opts ...googleapi.CallOption) error {
  4162. gensupport.SetOptions(c.urlParams_, opts...)
  4163. res, err := c.doRequest("json")
  4164. if err != nil {
  4165. return err
  4166. }
  4167. defer googleapi.CloseBody(res)
  4168. if err := googleapi.CheckResponse(res); err != nil {
  4169. return err
  4170. }
  4171. return nil
  4172. // {
  4173. // "description": "Deletes a domain of the customer.",
  4174. // "httpMethod": "DELETE",
  4175. // "id": "directory.domains.delete",
  4176. // "parameterOrder": [
  4177. // "customer",
  4178. // "domainName"
  4179. // ],
  4180. // "parameters": {
  4181. // "customer": {
  4182. // "description": "Immutable id of the Google Apps account.",
  4183. // "location": "path",
  4184. // "required": true,
  4185. // "type": "string"
  4186. // },
  4187. // "domainName": {
  4188. // "description": "Name of domain to be deleted",
  4189. // "location": "path",
  4190. // "required": true,
  4191. // "type": "string"
  4192. // }
  4193. // },
  4194. // "path": "customer/{customer}/domains/{domainName}",
  4195. // "scopes": [
  4196. // "https://www.googleapis.com/auth/admin.directory.domain"
  4197. // ]
  4198. // }
  4199. }
  4200. // method id "directory.domains.get":
  4201. type DomainsGetCall struct {
  4202. s *Service
  4203. customer string
  4204. domainName string
  4205. urlParams_ gensupport.URLParams
  4206. ifNoneMatch_ string
  4207. ctx_ context.Context
  4208. }
  4209. // Get: Retrives a domain of the customer.
  4210. func (r *DomainsService) Get(customer string, domainName string) *DomainsGetCall {
  4211. c := &DomainsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4212. c.customer = customer
  4213. c.domainName = domainName
  4214. return c
  4215. }
  4216. // Fields allows partial responses to be retrieved. See
  4217. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4218. // for more information.
  4219. func (c *DomainsGetCall) Fields(s ...googleapi.Field) *DomainsGetCall {
  4220. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4221. return c
  4222. }
  4223. // IfNoneMatch sets the optional parameter which makes the operation
  4224. // fail if the object's ETag matches the given value. This is useful for
  4225. // getting updates only after the object has changed since the last
  4226. // request. Use googleapi.IsNotModified to check whether the response
  4227. // error from Do is the result of In-None-Match.
  4228. func (c *DomainsGetCall) IfNoneMatch(entityTag string) *DomainsGetCall {
  4229. c.ifNoneMatch_ = entityTag
  4230. return c
  4231. }
  4232. // Context sets the context to be used in this call's Do method. Any
  4233. // pending HTTP request will be aborted if the provided context is
  4234. // canceled.
  4235. func (c *DomainsGetCall) Context(ctx context.Context) *DomainsGetCall {
  4236. c.ctx_ = ctx
  4237. return c
  4238. }
  4239. func (c *DomainsGetCall) doRequest(alt string) (*http.Response, error) {
  4240. var body io.Reader = nil
  4241. c.urlParams_.Set("alt", alt)
  4242. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domains/{domainName}")
  4243. urls += "?" + c.urlParams_.Encode()
  4244. req, _ := http.NewRequest("GET", urls, body)
  4245. googleapi.Expand(req.URL, map[string]string{
  4246. "customer": c.customer,
  4247. "domainName": c.domainName,
  4248. })
  4249. req.Header.Set("User-Agent", c.s.userAgent())
  4250. if c.ifNoneMatch_ != "" {
  4251. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4252. }
  4253. if c.ctx_ != nil {
  4254. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4255. }
  4256. return c.s.client.Do(req)
  4257. }
  4258. // Do executes the "directory.domains.get" call.
  4259. // Exactly one of *Domains or error will be non-nil. Any non-2xx status
  4260. // code is an error. Response headers are in either
  4261. // *Domains.ServerResponse.Header or (if a response was returned at all)
  4262. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4263. // check whether the returned error was because http.StatusNotModified
  4264. // was returned.
  4265. func (c *DomainsGetCall) Do(opts ...googleapi.CallOption) (*Domains, error) {
  4266. gensupport.SetOptions(c.urlParams_, opts...)
  4267. res, err := c.doRequest("json")
  4268. if res != nil && res.StatusCode == http.StatusNotModified {
  4269. if res.Body != nil {
  4270. res.Body.Close()
  4271. }
  4272. return nil, &googleapi.Error{
  4273. Code: res.StatusCode,
  4274. Header: res.Header,
  4275. }
  4276. }
  4277. if err != nil {
  4278. return nil, err
  4279. }
  4280. defer googleapi.CloseBody(res)
  4281. if err := googleapi.CheckResponse(res); err != nil {
  4282. return nil, err
  4283. }
  4284. ret := &Domains{
  4285. ServerResponse: googleapi.ServerResponse{
  4286. Header: res.Header,
  4287. HTTPStatusCode: res.StatusCode,
  4288. },
  4289. }
  4290. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4291. return nil, err
  4292. }
  4293. return ret, nil
  4294. // {
  4295. // "description": "Retrives a domain of the customer.",
  4296. // "httpMethod": "GET",
  4297. // "id": "directory.domains.get",
  4298. // "parameterOrder": [
  4299. // "customer",
  4300. // "domainName"
  4301. // ],
  4302. // "parameters": {
  4303. // "customer": {
  4304. // "description": "Immutable id of the Google Apps account.",
  4305. // "location": "path",
  4306. // "required": true,
  4307. // "type": "string"
  4308. // },
  4309. // "domainName": {
  4310. // "description": "Name of domain to be retrieved",
  4311. // "location": "path",
  4312. // "required": true,
  4313. // "type": "string"
  4314. // }
  4315. // },
  4316. // "path": "customer/{customer}/domains/{domainName}",
  4317. // "response": {
  4318. // "$ref": "Domains"
  4319. // },
  4320. // "scopes": [
  4321. // "https://www.googleapis.com/auth/admin.directory.domain",
  4322. // "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  4323. // ]
  4324. // }
  4325. }
  4326. // method id "directory.domains.insert":
  4327. type DomainsInsertCall struct {
  4328. s *Service
  4329. customer string
  4330. domains *Domains
  4331. urlParams_ gensupport.URLParams
  4332. ctx_ context.Context
  4333. }
  4334. // Insert: Inserts a domain of the customer.
  4335. func (r *DomainsService) Insert(customer string, domains *Domains) *DomainsInsertCall {
  4336. c := &DomainsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4337. c.customer = customer
  4338. c.domains = domains
  4339. return c
  4340. }
  4341. // Fields allows partial responses to be retrieved. See
  4342. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4343. // for more information.
  4344. func (c *DomainsInsertCall) Fields(s ...googleapi.Field) *DomainsInsertCall {
  4345. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4346. return c
  4347. }
  4348. // Context sets the context to be used in this call's Do method. Any
  4349. // pending HTTP request will be aborted if the provided context is
  4350. // canceled.
  4351. func (c *DomainsInsertCall) Context(ctx context.Context) *DomainsInsertCall {
  4352. c.ctx_ = ctx
  4353. return c
  4354. }
  4355. func (c *DomainsInsertCall) doRequest(alt string) (*http.Response, error) {
  4356. var body io.Reader = nil
  4357. body, err := googleapi.WithoutDataWrapper.JSONReader(c.domains)
  4358. if err != nil {
  4359. return nil, err
  4360. }
  4361. ctype := "application/json"
  4362. c.urlParams_.Set("alt", alt)
  4363. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domains")
  4364. urls += "?" + c.urlParams_.Encode()
  4365. req, _ := http.NewRequest("POST", urls, body)
  4366. googleapi.Expand(req.URL, map[string]string{
  4367. "customer": c.customer,
  4368. })
  4369. req.Header.Set("Content-Type", ctype)
  4370. req.Header.Set("User-Agent", c.s.userAgent())
  4371. if c.ctx_ != nil {
  4372. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4373. }
  4374. return c.s.client.Do(req)
  4375. }
  4376. // Do executes the "directory.domains.insert" call.
  4377. // Exactly one of *Domains or error will be non-nil. Any non-2xx status
  4378. // code is an error. Response headers are in either
  4379. // *Domains.ServerResponse.Header or (if a response was returned at all)
  4380. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4381. // check whether the returned error was because http.StatusNotModified
  4382. // was returned.
  4383. func (c *DomainsInsertCall) Do(opts ...googleapi.CallOption) (*Domains, error) {
  4384. gensupport.SetOptions(c.urlParams_, opts...)
  4385. res, err := c.doRequest("json")
  4386. if res != nil && res.StatusCode == http.StatusNotModified {
  4387. if res.Body != nil {
  4388. res.Body.Close()
  4389. }
  4390. return nil, &googleapi.Error{
  4391. Code: res.StatusCode,
  4392. Header: res.Header,
  4393. }
  4394. }
  4395. if err != nil {
  4396. return nil, err
  4397. }
  4398. defer googleapi.CloseBody(res)
  4399. if err := googleapi.CheckResponse(res); err != nil {
  4400. return nil, err
  4401. }
  4402. ret := &Domains{
  4403. ServerResponse: googleapi.ServerResponse{
  4404. Header: res.Header,
  4405. HTTPStatusCode: res.StatusCode,
  4406. },
  4407. }
  4408. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4409. return nil, err
  4410. }
  4411. return ret, nil
  4412. // {
  4413. // "description": "Inserts a domain of the customer.",
  4414. // "httpMethod": "POST",
  4415. // "id": "directory.domains.insert",
  4416. // "parameterOrder": [
  4417. // "customer"
  4418. // ],
  4419. // "parameters": {
  4420. // "customer": {
  4421. // "description": "Immutable id of the Google Apps account.",
  4422. // "location": "path",
  4423. // "required": true,
  4424. // "type": "string"
  4425. // }
  4426. // },
  4427. // "path": "customer/{customer}/domains",
  4428. // "request": {
  4429. // "$ref": "Domains"
  4430. // },
  4431. // "response": {
  4432. // "$ref": "Domains"
  4433. // },
  4434. // "scopes": [
  4435. // "https://www.googleapis.com/auth/admin.directory.domain"
  4436. // ]
  4437. // }
  4438. }
  4439. // method id "directory.domains.list":
  4440. type DomainsListCall struct {
  4441. s *Service
  4442. customer string
  4443. urlParams_ gensupport.URLParams
  4444. ifNoneMatch_ string
  4445. ctx_ context.Context
  4446. }
  4447. // List: Lists the domains of the customer.
  4448. func (r *DomainsService) List(customer string) *DomainsListCall {
  4449. c := &DomainsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4450. c.customer = customer
  4451. return c
  4452. }
  4453. // Fields allows partial responses to be retrieved. See
  4454. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4455. // for more information.
  4456. func (c *DomainsListCall) Fields(s ...googleapi.Field) *DomainsListCall {
  4457. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4458. return c
  4459. }
  4460. // IfNoneMatch sets the optional parameter which makes the operation
  4461. // fail if the object's ETag matches the given value. This is useful for
  4462. // getting updates only after the object has changed since the last
  4463. // request. Use googleapi.IsNotModified to check whether the response
  4464. // error from Do is the result of In-None-Match.
  4465. func (c *DomainsListCall) IfNoneMatch(entityTag string) *DomainsListCall {
  4466. c.ifNoneMatch_ = entityTag
  4467. return c
  4468. }
  4469. // Context sets the context to be used in this call's Do method. Any
  4470. // pending HTTP request will be aborted if the provided context is
  4471. // canceled.
  4472. func (c *DomainsListCall) Context(ctx context.Context) *DomainsListCall {
  4473. c.ctx_ = ctx
  4474. return c
  4475. }
  4476. func (c *DomainsListCall) doRequest(alt string) (*http.Response, error) {
  4477. var body io.Reader = nil
  4478. c.urlParams_.Set("alt", alt)
  4479. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domains")
  4480. urls += "?" + c.urlParams_.Encode()
  4481. req, _ := http.NewRequest("GET", urls, body)
  4482. googleapi.Expand(req.URL, map[string]string{
  4483. "customer": c.customer,
  4484. })
  4485. req.Header.Set("User-Agent", c.s.userAgent())
  4486. if c.ifNoneMatch_ != "" {
  4487. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4488. }
  4489. if c.ctx_ != nil {
  4490. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4491. }
  4492. return c.s.client.Do(req)
  4493. }
  4494. // Do executes the "directory.domains.list" call.
  4495. // Exactly one of *Domains2 or error will be non-nil. Any non-2xx status
  4496. // code is an error. Response headers are in either
  4497. // *Domains2.ServerResponse.Header or (if a response was returned at
  4498. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4499. // to check whether the returned error was because
  4500. // http.StatusNotModified was returned.
  4501. func (c *DomainsListCall) Do(opts ...googleapi.CallOption) (*Domains2, error) {
  4502. gensupport.SetOptions(c.urlParams_, opts...)
  4503. res, err := c.doRequest("json")
  4504. if res != nil && res.StatusCode == http.StatusNotModified {
  4505. if res.Body != nil {
  4506. res.Body.Close()
  4507. }
  4508. return nil, &googleapi.Error{
  4509. Code: res.StatusCode,
  4510. Header: res.Header,
  4511. }
  4512. }
  4513. if err != nil {
  4514. return nil, err
  4515. }
  4516. defer googleapi.CloseBody(res)
  4517. if err := googleapi.CheckResponse(res); err != nil {
  4518. return nil, err
  4519. }
  4520. ret := &Domains2{
  4521. ServerResponse: googleapi.ServerResponse{
  4522. Header: res.Header,
  4523. HTTPStatusCode: res.StatusCode,
  4524. },
  4525. }
  4526. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4527. return nil, err
  4528. }
  4529. return ret, nil
  4530. // {
  4531. // "description": "Lists the domains of the customer.",
  4532. // "httpMethod": "GET",
  4533. // "id": "directory.domains.list",
  4534. // "parameterOrder": [
  4535. // "customer"
  4536. // ],
  4537. // "parameters": {
  4538. // "customer": {
  4539. // "description": "Immutable id of the Google Apps account.",
  4540. // "location": "path",
  4541. // "required": true,
  4542. // "type": "string"
  4543. // }
  4544. // },
  4545. // "path": "customer/{customer}/domains",
  4546. // "response": {
  4547. // "$ref": "Domains2"
  4548. // },
  4549. // "scopes": [
  4550. // "https://www.googleapis.com/auth/admin.directory.domain",
  4551. // "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  4552. // ]
  4553. // }
  4554. }
  4555. // method id "directory.groups.delete":
  4556. type GroupsDeleteCall struct {
  4557. s *Service
  4558. groupKey string
  4559. urlParams_ gensupport.URLParams
  4560. ctx_ context.Context
  4561. }
  4562. // Delete: Delete Group
  4563. func (r *GroupsService) Delete(groupKey string) *GroupsDeleteCall {
  4564. c := &GroupsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4565. c.groupKey = groupKey
  4566. return c
  4567. }
  4568. // Fields allows partial responses to be retrieved. See
  4569. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4570. // for more information.
  4571. func (c *GroupsDeleteCall) Fields(s ...googleapi.Field) *GroupsDeleteCall {
  4572. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4573. return c
  4574. }
  4575. // Context sets the context to be used in this call's Do method. Any
  4576. // pending HTTP request will be aborted if the provided context is
  4577. // canceled.
  4578. func (c *GroupsDeleteCall) Context(ctx context.Context) *GroupsDeleteCall {
  4579. c.ctx_ = ctx
  4580. return c
  4581. }
  4582. func (c *GroupsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4583. var body io.Reader = nil
  4584. c.urlParams_.Set("alt", alt)
  4585. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}")
  4586. urls += "?" + c.urlParams_.Encode()
  4587. req, _ := http.NewRequest("DELETE", urls, body)
  4588. googleapi.Expand(req.URL, map[string]string{
  4589. "groupKey": c.groupKey,
  4590. })
  4591. req.Header.Set("User-Agent", c.s.userAgent())
  4592. if c.ctx_ != nil {
  4593. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4594. }
  4595. return c.s.client.Do(req)
  4596. }
  4597. // Do executes the "directory.groups.delete" call.
  4598. func (c *GroupsDeleteCall) Do(opts ...googleapi.CallOption) error {
  4599. gensupport.SetOptions(c.urlParams_, opts...)
  4600. res, err := c.doRequest("json")
  4601. if err != nil {
  4602. return err
  4603. }
  4604. defer googleapi.CloseBody(res)
  4605. if err := googleapi.CheckResponse(res); err != nil {
  4606. return err
  4607. }
  4608. return nil
  4609. // {
  4610. // "description": "Delete Group",
  4611. // "httpMethod": "DELETE",
  4612. // "id": "directory.groups.delete",
  4613. // "parameterOrder": [
  4614. // "groupKey"
  4615. // ],
  4616. // "parameters": {
  4617. // "groupKey": {
  4618. // "description": "Email or immutable Id of the group",
  4619. // "location": "path",
  4620. // "required": true,
  4621. // "type": "string"
  4622. // }
  4623. // },
  4624. // "path": "groups/{groupKey}",
  4625. // "scopes": [
  4626. // "https://www.googleapis.com/auth/admin.directory.group"
  4627. // ]
  4628. // }
  4629. }
  4630. // method id "directory.groups.get":
  4631. type GroupsGetCall struct {
  4632. s *Service
  4633. groupKey string
  4634. urlParams_ gensupport.URLParams
  4635. ifNoneMatch_ string
  4636. ctx_ context.Context
  4637. }
  4638. // Get: Retrieve Group
  4639. func (r *GroupsService) Get(groupKey string) *GroupsGetCall {
  4640. c := &GroupsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4641. c.groupKey = groupKey
  4642. return c
  4643. }
  4644. // Fields allows partial responses to be retrieved. See
  4645. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4646. // for more information.
  4647. func (c *GroupsGetCall) Fields(s ...googleapi.Field) *GroupsGetCall {
  4648. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4649. return c
  4650. }
  4651. // IfNoneMatch sets the optional parameter which makes the operation
  4652. // fail if the object's ETag matches the given value. This is useful for
  4653. // getting updates only after the object has changed since the last
  4654. // request. Use googleapi.IsNotModified to check whether the response
  4655. // error from Do is the result of In-None-Match.
  4656. func (c *GroupsGetCall) IfNoneMatch(entityTag string) *GroupsGetCall {
  4657. c.ifNoneMatch_ = entityTag
  4658. return c
  4659. }
  4660. // Context sets the context to be used in this call's Do method. Any
  4661. // pending HTTP request will be aborted if the provided context is
  4662. // canceled.
  4663. func (c *GroupsGetCall) Context(ctx context.Context) *GroupsGetCall {
  4664. c.ctx_ = ctx
  4665. return c
  4666. }
  4667. func (c *GroupsGetCall) doRequest(alt string) (*http.Response, error) {
  4668. var body io.Reader = nil
  4669. c.urlParams_.Set("alt", alt)
  4670. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}")
  4671. urls += "?" + c.urlParams_.Encode()
  4672. req, _ := http.NewRequest("GET", urls, body)
  4673. googleapi.Expand(req.URL, map[string]string{
  4674. "groupKey": c.groupKey,
  4675. })
  4676. req.Header.Set("User-Agent", c.s.userAgent())
  4677. if c.ifNoneMatch_ != "" {
  4678. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4679. }
  4680. if c.ctx_ != nil {
  4681. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4682. }
  4683. return c.s.client.Do(req)
  4684. }
  4685. // Do executes the "directory.groups.get" call.
  4686. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  4687. // code is an error. Response headers are in either
  4688. // *Group.ServerResponse.Header or (if a response was returned at all)
  4689. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4690. // check whether the returned error was because http.StatusNotModified
  4691. // was returned.
  4692. func (c *GroupsGetCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  4693. gensupport.SetOptions(c.urlParams_, opts...)
  4694. res, err := c.doRequest("json")
  4695. if res != nil && res.StatusCode == http.StatusNotModified {
  4696. if res.Body != nil {
  4697. res.Body.Close()
  4698. }
  4699. return nil, &googleapi.Error{
  4700. Code: res.StatusCode,
  4701. Header: res.Header,
  4702. }
  4703. }
  4704. if err != nil {
  4705. return nil, err
  4706. }
  4707. defer googleapi.CloseBody(res)
  4708. if err := googleapi.CheckResponse(res); err != nil {
  4709. return nil, err
  4710. }
  4711. ret := &Group{
  4712. ServerResponse: googleapi.ServerResponse{
  4713. Header: res.Header,
  4714. HTTPStatusCode: res.StatusCode,
  4715. },
  4716. }
  4717. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4718. return nil, err
  4719. }
  4720. return ret, nil
  4721. // {
  4722. // "description": "Retrieve Group",
  4723. // "httpMethod": "GET",
  4724. // "id": "directory.groups.get",
  4725. // "parameterOrder": [
  4726. // "groupKey"
  4727. // ],
  4728. // "parameters": {
  4729. // "groupKey": {
  4730. // "description": "Email or immutable Id of the group",
  4731. // "location": "path",
  4732. // "required": true,
  4733. // "type": "string"
  4734. // }
  4735. // },
  4736. // "path": "groups/{groupKey}",
  4737. // "response": {
  4738. // "$ref": "Group"
  4739. // },
  4740. // "scopes": [
  4741. // "https://www.googleapis.com/auth/admin.directory.group",
  4742. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  4743. // ]
  4744. // }
  4745. }
  4746. // method id "directory.groups.insert":
  4747. type GroupsInsertCall struct {
  4748. s *Service
  4749. group *Group
  4750. urlParams_ gensupport.URLParams
  4751. ctx_ context.Context
  4752. }
  4753. // Insert: Create Group
  4754. func (r *GroupsService) Insert(group *Group) *GroupsInsertCall {
  4755. c := &GroupsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4756. c.group = group
  4757. return c
  4758. }
  4759. // Fields allows partial responses to be retrieved. See
  4760. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4761. // for more information.
  4762. func (c *GroupsInsertCall) Fields(s ...googleapi.Field) *GroupsInsertCall {
  4763. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4764. return c
  4765. }
  4766. // Context sets the context to be used in this call's Do method. Any
  4767. // pending HTTP request will be aborted if the provided context is
  4768. // canceled.
  4769. func (c *GroupsInsertCall) Context(ctx context.Context) *GroupsInsertCall {
  4770. c.ctx_ = ctx
  4771. return c
  4772. }
  4773. func (c *GroupsInsertCall) doRequest(alt string) (*http.Response, error) {
  4774. var body io.Reader = nil
  4775. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  4776. if err != nil {
  4777. return nil, err
  4778. }
  4779. ctype := "application/json"
  4780. c.urlParams_.Set("alt", alt)
  4781. urls := googleapi.ResolveRelative(c.s.BasePath, "groups")
  4782. urls += "?" + c.urlParams_.Encode()
  4783. req, _ := http.NewRequest("POST", urls, body)
  4784. googleapi.SetOpaque(req.URL)
  4785. req.Header.Set("Content-Type", ctype)
  4786. req.Header.Set("User-Agent", c.s.userAgent())
  4787. if c.ctx_ != nil {
  4788. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4789. }
  4790. return c.s.client.Do(req)
  4791. }
  4792. // Do executes the "directory.groups.insert" call.
  4793. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  4794. // code is an error. Response headers are in either
  4795. // *Group.ServerResponse.Header or (if a response was returned at all)
  4796. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4797. // check whether the returned error was because http.StatusNotModified
  4798. // was returned.
  4799. func (c *GroupsInsertCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  4800. gensupport.SetOptions(c.urlParams_, opts...)
  4801. res, err := c.doRequest("json")
  4802. if res != nil && res.StatusCode == http.StatusNotModified {
  4803. if res.Body != nil {
  4804. res.Body.Close()
  4805. }
  4806. return nil, &googleapi.Error{
  4807. Code: res.StatusCode,
  4808. Header: res.Header,
  4809. }
  4810. }
  4811. if err != nil {
  4812. return nil, err
  4813. }
  4814. defer googleapi.CloseBody(res)
  4815. if err := googleapi.CheckResponse(res); err != nil {
  4816. return nil, err
  4817. }
  4818. ret := &Group{
  4819. ServerResponse: googleapi.ServerResponse{
  4820. Header: res.Header,
  4821. HTTPStatusCode: res.StatusCode,
  4822. },
  4823. }
  4824. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4825. return nil, err
  4826. }
  4827. return ret, nil
  4828. // {
  4829. // "description": "Create Group",
  4830. // "httpMethod": "POST",
  4831. // "id": "directory.groups.insert",
  4832. // "path": "groups",
  4833. // "request": {
  4834. // "$ref": "Group"
  4835. // },
  4836. // "response": {
  4837. // "$ref": "Group"
  4838. // },
  4839. // "scopes": [
  4840. // "https://www.googleapis.com/auth/admin.directory.group"
  4841. // ]
  4842. // }
  4843. }
  4844. // method id "directory.groups.list":
  4845. type GroupsListCall struct {
  4846. s *Service
  4847. urlParams_ gensupport.URLParams
  4848. ifNoneMatch_ string
  4849. ctx_ context.Context
  4850. }
  4851. // List: Retrieve all groups in a domain (paginated)
  4852. func (r *GroupsService) List() *GroupsListCall {
  4853. c := &GroupsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4854. return c
  4855. }
  4856. // Customer sets the optional parameter "customer": Immutable id of the
  4857. // Google Apps account. In case of multi-domain, to fetch all groups for
  4858. // a customer, fill this field instead of domain.
  4859. func (c *GroupsListCall) Customer(customer string) *GroupsListCall {
  4860. c.urlParams_.Set("customer", customer)
  4861. return c
  4862. }
  4863. // Domain sets the optional parameter "domain": Name of the domain. Fill
  4864. // this field to get groups from only this domain. To return all groups
  4865. // in a multi-domain fill customer field instead.
  4866. func (c *GroupsListCall) Domain(domain string) *GroupsListCall {
  4867. c.urlParams_.Set("domain", domain)
  4868. return c
  4869. }
  4870. // MaxResults sets the optional parameter "maxResults": Maximum number
  4871. // of results to return. Default is 200
  4872. func (c *GroupsListCall) MaxResults(maxResults int64) *GroupsListCall {
  4873. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4874. return c
  4875. }
  4876. // PageToken sets the optional parameter "pageToken": Token to specify
  4877. // next page in the list
  4878. func (c *GroupsListCall) PageToken(pageToken string) *GroupsListCall {
  4879. c.urlParams_.Set("pageToken", pageToken)
  4880. return c
  4881. }
  4882. // UserKey sets the optional parameter "userKey": Email or immutable Id
  4883. // of the user if only those groups are to be listed, the given user is
  4884. // a member of. If Id, it should match with id of user object
  4885. func (c *GroupsListCall) UserKey(userKey string) *GroupsListCall {
  4886. c.urlParams_.Set("userKey", userKey)
  4887. return c
  4888. }
  4889. // Fields allows partial responses to be retrieved. See
  4890. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4891. // for more information.
  4892. func (c *GroupsListCall) Fields(s ...googleapi.Field) *GroupsListCall {
  4893. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4894. return c
  4895. }
  4896. // IfNoneMatch sets the optional parameter which makes the operation
  4897. // fail if the object's ETag matches the given value. This is useful for
  4898. // getting updates only after the object has changed since the last
  4899. // request. Use googleapi.IsNotModified to check whether the response
  4900. // error from Do is the result of In-None-Match.
  4901. func (c *GroupsListCall) IfNoneMatch(entityTag string) *GroupsListCall {
  4902. c.ifNoneMatch_ = entityTag
  4903. return c
  4904. }
  4905. // Context sets the context to be used in this call's Do method. Any
  4906. // pending HTTP request will be aborted if the provided context is
  4907. // canceled.
  4908. func (c *GroupsListCall) Context(ctx context.Context) *GroupsListCall {
  4909. c.ctx_ = ctx
  4910. return c
  4911. }
  4912. func (c *GroupsListCall) doRequest(alt string) (*http.Response, error) {
  4913. var body io.Reader = nil
  4914. c.urlParams_.Set("alt", alt)
  4915. urls := googleapi.ResolveRelative(c.s.BasePath, "groups")
  4916. urls += "?" + c.urlParams_.Encode()
  4917. req, _ := http.NewRequest("GET", urls, body)
  4918. googleapi.SetOpaque(req.URL)
  4919. req.Header.Set("User-Agent", c.s.userAgent())
  4920. if c.ifNoneMatch_ != "" {
  4921. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4922. }
  4923. if c.ctx_ != nil {
  4924. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4925. }
  4926. return c.s.client.Do(req)
  4927. }
  4928. // Do executes the "directory.groups.list" call.
  4929. // Exactly one of *Groups or error will be non-nil. Any non-2xx status
  4930. // code is an error. Response headers are in either
  4931. // *Groups.ServerResponse.Header or (if a response was returned at all)
  4932. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4933. // check whether the returned error was because http.StatusNotModified
  4934. // was returned.
  4935. func (c *GroupsListCall) Do(opts ...googleapi.CallOption) (*Groups, error) {
  4936. gensupport.SetOptions(c.urlParams_, opts...)
  4937. res, err := c.doRequest("json")
  4938. if res != nil && res.StatusCode == http.StatusNotModified {
  4939. if res.Body != nil {
  4940. res.Body.Close()
  4941. }
  4942. return nil, &googleapi.Error{
  4943. Code: res.StatusCode,
  4944. Header: res.Header,
  4945. }
  4946. }
  4947. if err != nil {
  4948. return nil, err
  4949. }
  4950. defer googleapi.CloseBody(res)
  4951. if err := googleapi.CheckResponse(res); err != nil {
  4952. return nil, err
  4953. }
  4954. ret := &Groups{
  4955. ServerResponse: googleapi.ServerResponse{
  4956. Header: res.Header,
  4957. HTTPStatusCode: res.StatusCode,
  4958. },
  4959. }
  4960. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4961. return nil, err
  4962. }
  4963. return ret, nil
  4964. // {
  4965. // "description": "Retrieve all groups in a domain (paginated)",
  4966. // "httpMethod": "GET",
  4967. // "id": "directory.groups.list",
  4968. // "parameters": {
  4969. // "customer": {
  4970. // "description": "Immutable id of the Google Apps account. In case of multi-domain, to fetch all groups for a customer, fill this field instead of domain.",
  4971. // "location": "query",
  4972. // "type": "string"
  4973. // },
  4974. // "domain": {
  4975. // "description": "Name of the domain. Fill this field to get groups from only this domain. To return all groups in a multi-domain fill customer field instead.",
  4976. // "location": "query",
  4977. // "type": "string"
  4978. // },
  4979. // "maxResults": {
  4980. // "description": "Maximum number of results to return. Default is 200",
  4981. // "format": "int32",
  4982. // "location": "query",
  4983. // "minimum": "1",
  4984. // "type": "integer"
  4985. // },
  4986. // "pageToken": {
  4987. // "description": "Token to specify next page in the list",
  4988. // "location": "query",
  4989. // "type": "string"
  4990. // },
  4991. // "userKey": {
  4992. // "description": "Email or immutable Id of the user if only those groups are to be listed, the given user is a member of. If Id, it should match with id of user object",
  4993. // "location": "query",
  4994. // "type": "string"
  4995. // }
  4996. // },
  4997. // "path": "groups",
  4998. // "response": {
  4999. // "$ref": "Groups"
  5000. // },
  5001. // "scopes": [
  5002. // "https://www.googleapis.com/auth/admin.directory.group",
  5003. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  5004. // ]
  5005. // }
  5006. }
  5007. // Pages invokes f for each page of results.
  5008. // A non-nil error returned from f will halt the iteration.
  5009. // The provided context supersedes any context provided to the Context method.
  5010. func (c *GroupsListCall) Pages(ctx context.Context, f func(*Groups) error) error {
  5011. c.ctx_ = ctx
  5012. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5013. for {
  5014. x, err := c.Do()
  5015. if err != nil {
  5016. return err
  5017. }
  5018. if err := f(x); err != nil {
  5019. return err
  5020. }
  5021. if x.NextPageToken == "" {
  5022. return nil
  5023. }
  5024. c.PageToken(x.NextPageToken)
  5025. }
  5026. }
  5027. // method id "directory.groups.patch":
  5028. type GroupsPatchCall struct {
  5029. s *Service
  5030. groupKey string
  5031. group *Group
  5032. urlParams_ gensupport.URLParams
  5033. ctx_ context.Context
  5034. }
  5035. // Patch: Update Group. This method supports patch semantics.
  5036. func (r *GroupsService) Patch(groupKey string, group *Group) *GroupsPatchCall {
  5037. c := &GroupsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5038. c.groupKey = groupKey
  5039. c.group = group
  5040. return c
  5041. }
  5042. // Fields allows partial responses to be retrieved. See
  5043. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5044. // for more information.
  5045. func (c *GroupsPatchCall) Fields(s ...googleapi.Field) *GroupsPatchCall {
  5046. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5047. return c
  5048. }
  5049. // Context sets the context to be used in this call's Do method. Any
  5050. // pending HTTP request will be aborted if the provided context is
  5051. // canceled.
  5052. func (c *GroupsPatchCall) Context(ctx context.Context) *GroupsPatchCall {
  5053. c.ctx_ = ctx
  5054. return c
  5055. }
  5056. func (c *GroupsPatchCall) doRequest(alt string) (*http.Response, error) {
  5057. var body io.Reader = nil
  5058. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  5059. if err != nil {
  5060. return nil, err
  5061. }
  5062. ctype := "application/json"
  5063. c.urlParams_.Set("alt", alt)
  5064. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}")
  5065. urls += "?" + c.urlParams_.Encode()
  5066. req, _ := http.NewRequest("PATCH", urls, body)
  5067. googleapi.Expand(req.URL, map[string]string{
  5068. "groupKey": c.groupKey,
  5069. })
  5070. req.Header.Set("Content-Type", ctype)
  5071. req.Header.Set("User-Agent", c.s.userAgent())
  5072. if c.ctx_ != nil {
  5073. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5074. }
  5075. return c.s.client.Do(req)
  5076. }
  5077. // Do executes the "directory.groups.patch" call.
  5078. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  5079. // code is an error. Response headers are in either
  5080. // *Group.ServerResponse.Header or (if a response was returned at all)
  5081. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5082. // check whether the returned error was because http.StatusNotModified
  5083. // was returned.
  5084. func (c *GroupsPatchCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  5085. gensupport.SetOptions(c.urlParams_, opts...)
  5086. res, err := c.doRequest("json")
  5087. if res != nil && res.StatusCode == http.StatusNotModified {
  5088. if res.Body != nil {
  5089. res.Body.Close()
  5090. }
  5091. return nil, &googleapi.Error{
  5092. Code: res.StatusCode,
  5093. Header: res.Header,
  5094. }
  5095. }
  5096. if err != nil {
  5097. return nil, err
  5098. }
  5099. defer googleapi.CloseBody(res)
  5100. if err := googleapi.CheckResponse(res); err != nil {
  5101. return nil, err
  5102. }
  5103. ret := &Group{
  5104. ServerResponse: googleapi.ServerResponse{
  5105. Header: res.Header,
  5106. HTTPStatusCode: res.StatusCode,
  5107. },
  5108. }
  5109. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5110. return nil, err
  5111. }
  5112. return ret, nil
  5113. // {
  5114. // "description": "Update Group. This method supports patch semantics.",
  5115. // "httpMethod": "PATCH",
  5116. // "id": "directory.groups.patch",
  5117. // "parameterOrder": [
  5118. // "groupKey"
  5119. // ],
  5120. // "parameters": {
  5121. // "groupKey": {
  5122. // "description": "Email or immutable Id of the group. If Id, it should match with id of group object",
  5123. // "location": "path",
  5124. // "required": true,
  5125. // "type": "string"
  5126. // }
  5127. // },
  5128. // "path": "groups/{groupKey}",
  5129. // "request": {
  5130. // "$ref": "Group"
  5131. // },
  5132. // "response": {
  5133. // "$ref": "Group"
  5134. // },
  5135. // "scopes": [
  5136. // "https://www.googleapis.com/auth/admin.directory.group"
  5137. // ]
  5138. // }
  5139. }
  5140. // method id "directory.groups.update":
  5141. type GroupsUpdateCall struct {
  5142. s *Service
  5143. groupKey string
  5144. group *Group
  5145. urlParams_ gensupport.URLParams
  5146. ctx_ context.Context
  5147. }
  5148. // Update: Update Group
  5149. func (r *GroupsService) Update(groupKey string, group *Group) *GroupsUpdateCall {
  5150. c := &GroupsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5151. c.groupKey = groupKey
  5152. c.group = group
  5153. return c
  5154. }
  5155. // Fields allows partial responses to be retrieved. See
  5156. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5157. // for more information.
  5158. func (c *GroupsUpdateCall) Fields(s ...googleapi.Field) *GroupsUpdateCall {
  5159. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5160. return c
  5161. }
  5162. // Context sets the context to be used in this call's Do method. Any
  5163. // pending HTTP request will be aborted if the provided context is
  5164. // canceled.
  5165. func (c *GroupsUpdateCall) Context(ctx context.Context) *GroupsUpdateCall {
  5166. c.ctx_ = ctx
  5167. return c
  5168. }
  5169. func (c *GroupsUpdateCall) doRequest(alt string) (*http.Response, error) {
  5170. var body io.Reader = nil
  5171. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  5172. if err != nil {
  5173. return nil, err
  5174. }
  5175. ctype := "application/json"
  5176. c.urlParams_.Set("alt", alt)
  5177. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}")
  5178. urls += "?" + c.urlParams_.Encode()
  5179. req, _ := http.NewRequest("PUT", urls, body)
  5180. googleapi.Expand(req.URL, map[string]string{
  5181. "groupKey": c.groupKey,
  5182. })
  5183. req.Header.Set("Content-Type", ctype)
  5184. req.Header.Set("User-Agent", c.s.userAgent())
  5185. if c.ctx_ != nil {
  5186. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5187. }
  5188. return c.s.client.Do(req)
  5189. }
  5190. // Do executes the "directory.groups.update" call.
  5191. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  5192. // code is an error. Response headers are in either
  5193. // *Group.ServerResponse.Header or (if a response was returned at all)
  5194. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5195. // check whether the returned error was because http.StatusNotModified
  5196. // was returned.
  5197. func (c *GroupsUpdateCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  5198. gensupport.SetOptions(c.urlParams_, opts...)
  5199. res, err := c.doRequest("json")
  5200. if res != nil && res.StatusCode == http.StatusNotModified {
  5201. if res.Body != nil {
  5202. res.Body.Close()
  5203. }
  5204. return nil, &googleapi.Error{
  5205. Code: res.StatusCode,
  5206. Header: res.Header,
  5207. }
  5208. }
  5209. if err != nil {
  5210. return nil, err
  5211. }
  5212. defer googleapi.CloseBody(res)
  5213. if err := googleapi.CheckResponse(res); err != nil {
  5214. return nil, err
  5215. }
  5216. ret := &Group{
  5217. ServerResponse: googleapi.ServerResponse{
  5218. Header: res.Header,
  5219. HTTPStatusCode: res.StatusCode,
  5220. },
  5221. }
  5222. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5223. return nil, err
  5224. }
  5225. return ret, nil
  5226. // {
  5227. // "description": "Update Group",
  5228. // "httpMethod": "PUT",
  5229. // "id": "directory.groups.update",
  5230. // "parameterOrder": [
  5231. // "groupKey"
  5232. // ],
  5233. // "parameters": {
  5234. // "groupKey": {
  5235. // "description": "Email or immutable Id of the group. If Id, it should match with id of group object",
  5236. // "location": "path",
  5237. // "required": true,
  5238. // "type": "string"
  5239. // }
  5240. // },
  5241. // "path": "groups/{groupKey}",
  5242. // "request": {
  5243. // "$ref": "Group"
  5244. // },
  5245. // "response": {
  5246. // "$ref": "Group"
  5247. // },
  5248. // "scopes": [
  5249. // "https://www.googleapis.com/auth/admin.directory.group"
  5250. // ]
  5251. // }
  5252. }
  5253. // method id "directory.groups.aliases.delete":
  5254. type GroupsAliasesDeleteCall struct {
  5255. s *Service
  5256. groupKey string
  5257. alias string
  5258. urlParams_ gensupport.URLParams
  5259. ctx_ context.Context
  5260. }
  5261. // Delete: Remove a alias for the group
  5262. func (r *GroupsAliasesService) Delete(groupKey string, alias string) *GroupsAliasesDeleteCall {
  5263. c := &GroupsAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5264. c.groupKey = groupKey
  5265. c.alias = alias
  5266. return c
  5267. }
  5268. // Fields allows partial responses to be retrieved. See
  5269. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5270. // for more information.
  5271. func (c *GroupsAliasesDeleteCall) Fields(s ...googleapi.Field) *GroupsAliasesDeleteCall {
  5272. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5273. return c
  5274. }
  5275. // Context sets the context to be used in this call's Do method. Any
  5276. // pending HTTP request will be aborted if the provided context is
  5277. // canceled.
  5278. func (c *GroupsAliasesDeleteCall) Context(ctx context.Context) *GroupsAliasesDeleteCall {
  5279. c.ctx_ = ctx
  5280. return c
  5281. }
  5282. func (c *GroupsAliasesDeleteCall) doRequest(alt string) (*http.Response, error) {
  5283. var body io.Reader = nil
  5284. c.urlParams_.Set("alt", alt)
  5285. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/aliases/{alias}")
  5286. urls += "?" + c.urlParams_.Encode()
  5287. req, _ := http.NewRequest("DELETE", urls, body)
  5288. googleapi.Expand(req.URL, map[string]string{
  5289. "groupKey": c.groupKey,
  5290. "alias": c.alias,
  5291. })
  5292. req.Header.Set("User-Agent", c.s.userAgent())
  5293. if c.ctx_ != nil {
  5294. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5295. }
  5296. return c.s.client.Do(req)
  5297. }
  5298. // Do executes the "directory.groups.aliases.delete" call.
  5299. func (c *GroupsAliasesDeleteCall) Do(opts ...googleapi.CallOption) error {
  5300. gensupport.SetOptions(c.urlParams_, opts...)
  5301. res, err := c.doRequest("json")
  5302. if err != nil {
  5303. return err
  5304. }
  5305. defer googleapi.CloseBody(res)
  5306. if err := googleapi.CheckResponse(res); err != nil {
  5307. return err
  5308. }
  5309. return nil
  5310. // {
  5311. // "description": "Remove a alias for the group",
  5312. // "httpMethod": "DELETE",
  5313. // "id": "directory.groups.aliases.delete",
  5314. // "parameterOrder": [
  5315. // "groupKey",
  5316. // "alias"
  5317. // ],
  5318. // "parameters": {
  5319. // "alias": {
  5320. // "description": "The alias to be removed",
  5321. // "location": "path",
  5322. // "required": true,
  5323. // "type": "string"
  5324. // },
  5325. // "groupKey": {
  5326. // "description": "Email or immutable Id of the group",
  5327. // "location": "path",
  5328. // "required": true,
  5329. // "type": "string"
  5330. // }
  5331. // },
  5332. // "path": "groups/{groupKey}/aliases/{alias}",
  5333. // "scopes": [
  5334. // "https://www.googleapis.com/auth/admin.directory.group"
  5335. // ]
  5336. // }
  5337. }
  5338. // method id "directory.groups.aliases.insert":
  5339. type GroupsAliasesInsertCall struct {
  5340. s *Service
  5341. groupKey string
  5342. alias *Alias
  5343. urlParams_ gensupport.URLParams
  5344. ctx_ context.Context
  5345. }
  5346. // Insert: Add a alias for the group
  5347. func (r *GroupsAliasesService) Insert(groupKey string, alias *Alias) *GroupsAliasesInsertCall {
  5348. c := &GroupsAliasesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5349. c.groupKey = groupKey
  5350. c.alias = alias
  5351. return c
  5352. }
  5353. // Fields allows partial responses to be retrieved. See
  5354. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5355. // for more information.
  5356. func (c *GroupsAliasesInsertCall) Fields(s ...googleapi.Field) *GroupsAliasesInsertCall {
  5357. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5358. return c
  5359. }
  5360. // Context sets the context to be used in this call's Do method. Any
  5361. // pending HTTP request will be aborted if the provided context is
  5362. // canceled.
  5363. func (c *GroupsAliasesInsertCall) Context(ctx context.Context) *GroupsAliasesInsertCall {
  5364. c.ctx_ = ctx
  5365. return c
  5366. }
  5367. func (c *GroupsAliasesInsertCall) doRequest(alt string) (*http.Response, error) {
  5368. var body io.Reader = nil
  5369. body, err := googleapi.WithoutDataWrapper.JSONReader(c.alias)
  5370. if err != nil {
  5371. return nil, err
  5372. }
  5373. ctype := "application/json"
  5374. c.urlParams_.Set("alt", alt)
  5375. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/aliases")
  5376. urls += "?" + c.urlParams_.Encode()
  5377. req, _ := http.NewRequest("POST", urls, body)
  5378. googleapi.Expand(req.URL, map[string]string{
  5379. "groupKey": c.groupKey,
  5380. })
  5381. req.Header.Set("Content-Type", ctype)
  5382. req.Header.Set("User-Agent", c.s.userAgent())
  5383. if c.ctx_ != nil {
  5384. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5385. }
  5386. return c.s.client.Do(req)
  5387. }
  5388. // Do executes the "directory.groups.aliases.insert" call.
  5389. // Exactly one of *Alias or error will be non-nil. Any non-2xx status
  5390. // code is an error. Response headers are in either
  5391. // *Alias.ServerResponse.Header or (if a response was returned at all)
  5392. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5393. // check whether the returned error was because http.StatusNotModified
  5394. // was returned.
  5395. func (c *GroupsAliasesInsertCall) Do(opts ...googleapi.CallOption) (*Alias, error) {
  5396. gensupport.SetOptions(c.urlParams_, opts...)
  5397. res, err := c.doRequest("json")
  5398. if res != nil && res.StatusCode == http.StatusNotModified {
  5399. if res.Body != nil {
  5400. res.Body.Close()
  5401. }
  5402. return nil, &googleapi.Error{
  5403. Code: res.StatusCode,
  5404. Header: res.Header,
  5405. }
  5406. }
  5407. if err != nil {
  5408. return nil, err
  5409. }
  5410. defer googleapi.CloseBody(res)
  5411. if err := googleapi.CheckResponse(res); err != nil {
  5412. return nil, err
  5413. }
  5414. ret := &Alias{
  5415. ServerResponse: googleapi.ServerResponse{
  5416. Header: res.Header,
  5417. HTTPStatusCode: res.StatusCode,
  5418. },
  5419. }
  5420. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5421. return nil, err
  5422. }
  5423. return ret, nil
  5424. // {
  5425. // "description": "Add a alias for the group",
  5426. // "httpMethod": "POST",
  5427. // "id": "directory.groups.aliases.insert",
  5428. // "parameterOrder": [
  5429. // "groupKey"
  5430. // ],
  5431. // "parameters": {
  5432. // "groupKey": {
  5433. // "description": "Email or immutable Id of the group",
  5434. // "location": "path",
  5435. // "required": true,
  5436. // "type": "string"
  5437. // }
  5438. // },
  5439. // "path": "groups/{groupKey}/aliases",
  5440. // "request": {
  5441. // "$ref": "Alias"
  5442. // },
  5443. // "response": {
  5444. // "$ref": "Alias"
  5445. // },
  5446. // "scopes": [
  5447. // "https://www.googleapis.com/auth/admin.directory.group"
  5448. // ]
  5449. // }
  5450. }
  5451. // method id "directory.groups.aliases.list":
  5452. type GroupsAliasesListCall struct {
  5453. s *Service
  5454. groupKey string
  5455. urlParams_ gensupport.URLParams
  5456. ifNoneMatch_ string
  5457. ctx_ context.Context
  5458. }
  5459. // List: List all aliases for a group
  5460. func (r *GroupsAliasesService) List(groupKey string) *GroupsAliasesListCall {
  5461. c := &GroupsAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5462. c.groupKey = groupKey
  5463. return c
  5464. }
  5465. // Fields allows partial responses to be retrieved. See
  5466. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5467. // for more information.
  5468. func (c *GroupsAliasesListCall) Fields(s ...googleapi.Field) *GroupsAliasesListCall {
  5469. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5470. return c
  5471. }
  5472. // IfNoneMatch sets the optional parameter which makes the operation
  5473. // fail if the object's ETag matches the given value. This is useful for
  5474. // getting updates only after the object has changed since the last
  5475. // request. Use googleapi.IsNotModified to check whether the response
  5476. // error from Do is the result of In-None-Match.
  5477. func (c *GroupsAliasesListCall) IfNoneMatch(entityTag string) *GroupsAliasesListCall {
  5478. c.ifNoneMatch_ = entityTag
  5479. return c
  5480. }
  5481. // Context sets the context to be used in this call's Do method. Any
  5482. // pending HTTP request will be aborted if the provided context is
  5483. // canceled.
  5484. func (c *GroupsAliasesListCall) Context(ctx context.Context) *GroupsAliasesListCall {
  5485. c.ctx_ = ctx
  5486. return c
  5487. }
  5488. func (c *GroupsAliasesListCall) doRequest(alt string) (*http.Response, error) {
  5489. var body io.Reader = nil
  5490. c.urlParams_.Set("alt", alt)
  5491. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/aliases")
  5492. urls += "?" + c.urlParams_.Encode()
  5493. req, _ := http.NewRequest("GET", urls, body)
  5494. googleapi.Expand(req.URL, map[string]string{
  5495. "groupKey": c.groupKey,
  5496. })
  5497. req.Header.Set("User-Agent", c.s.userAgent())
  5498. if c.ifNoneMatch_ != "" {
  5499. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5500. }
  5501. if c.ctx_ != nil {
  5502. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5503. }
  5504. return c.s.client.Do(req)
  5505. }
  5506. // Do executes the "directory.groups.aliases.list" call.
  5507. // Exactly one of *Aliases or error will be non-nil. Any non-2xx status
  5508. // code is an error. Response headers are in either
  5509. // *Aliases.ServerResponse.Header or (if a response was returned at all)
  5510. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5511. // check whether the returned error was because http.StatusNotModified
  5512. // was returned.
  5513. func (c *GroupsAliasesListCall) Do(opts ...googleapi.CallOption) (*Aliases, error) {
  5514. gensupport.SetOptions(c.urlParams_, opts...)
  5515. res, err := c.doRequest("json")
  5516. if res != nil && res.StatusCode == http.StatusNotModified {
  5517. if res.Body != nil {
  5518. res.Body.Close()
  5519. }
  5520. return nil, &googleapi.Error{
  5521. Code: res.StatusCode,
  5522. Header: res.Header,
  5523. }
  5524. }
  5525. if err != nil {
  5526. return nil, err
  5527. }
  5528. defer googleapi.CloseBody(res)
  5529. if err := googleapi.CheckResponse(res); err != nil {
  5530. return nil, err
  5531. }
  5532. ret := &Aliases{
  5533. ServerResponse: googleapi.ServerResponse{
  5534. Header: res.Header,
  5535. HTTPStatusCode: res.StatusCode,
  5536. },
  5537. }
  5538. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5539. return nil, err
  5540. }
  5541. return ret, nil
  5542. // {
  5543. // "description": "List all aliases for a group",
  5544. // "httpMethod": "GET",
  5545. // "id": "directory.groups.aliases.list",
  5546. // "parameterOrder": [
  5547. // "groupKey"
  5548. // ],
  5549. // "parameters": {
  5550. // "groupKey": {
  5551. // "description": "Email or immutable Id of the group",
  5552. // "location": "path",
  5553. // "required": true,
  5554. // "type": "string"
  5555. // }
  5556. // },
  5557. // "path": "groups/{groupKey}/aliases",
  5558. // "response": {
  5559. // "$ref": "Aliases"
  5560. // },
  5561. // "scopes": [
  5562. // "https://www.googleapis.com/auth/admin.directory.group",
  5563. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  5564. // ],
  5565. // "supportsSubscription": true
  5566. // }
  5567. }
  5568. // method id "directory.members.delete":
  5569. type MembersDeleteCall struct {
  5570. s *Service
  5571. groupKey string
  5572. memberKey string
  5573. urlParams_ gensupport.URLParams
  5574. ctx_ context.Context
  5575. }
  5576. // Delete: Remove membership.
  5577. func (r *MembersService) Delete(groupKey string, memberKey string) *MembersDeleteCall {
  5578. c := &MembersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5579. c.groupKey = groupKey
  5580. c.memberKey = memberKey
  5581. return c
  5582. }
  5583. // Fields allows partial responses to be retrieved. See
  5584. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5585. // for more information.
  5586. func (c *MembersDeleteCall) Fields(s ...googleapi.Field) *MembersDeleteCall {
  5587. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5588. return c
  5589. }
  5590. // Context sets the context to be used in this call's Do method. Any
  5591. // pending HTTP request will be aborted if the provided context is
  5592. // canceled.
  5593. func (c *MembersDeleteCall) Context(ctx context.Context) *MembersDeleteCall {
  5594. c.ctx_ = ctx
  5595. return c
  5596. }
  5597. func (c *MembersDeleteCall) doRequest(alt string) (*http.Response, error) {
  5598. var body io.Reader = nil
  5599. c.urlParams_.Set("alt", alt)
  5600. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members/{memberKey}")
  5601. urls += "?" + c.urlParams_.Encode()
  5602. req, _ := http.NewRequest("DELETE", urls, body)
  5603. googleapi.Expand(req.URL, map[string]string{
  5604. "groupKey": c.groupKey,
  5605. "memberKey": c.memberKey,
  5606. })
  5607. req.Header.Set("User-Agent", c.s.userAgent())
  5608. if c.ctx_ != nil {
  5609. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5610. }
  5611. return c.s.client.Do(req)
  5612. }
  5613. // Do executes the "directory.members.delete" call.
  5614. func (c *MembersDeleteCall) Do(opts ...googleapi.CallOption) error {
  5615. gensupport.SetOptions(c.urlParams_, opts...)
  5616. res, err := c.doRequest("json")
  5617. if err != nil {
  5618. return err
  5619. }
  5620. defer googleapi.CloseBody(res)
  5621. if err := googleapi.CheckResponse(res); err != nil {
  5622. return err
  5623. }
  5624. return nil
  5625. // {
  5626. // "description": "Remove membership.",
  5627. // "httpMethod": "DELETE",
  5628. // "id": "directory.members.delete",
  5629. // "parameterOrder": [
  5630. // "groupKey",
  5631. // "memberKey"
  5632. // ],
  5633. // "parameters": {
  5634. // "groupKey": {
  5635. // "description": "Email or immutable Id of the group",
  5636. // "location": "path",
  5637. // "required": true,
  5638. // "type": "string"
  5639. // },
  5640. // "memberKey": {
  5641. // "description": "Email or immutable Id of the member",
  5642. // "location": "path",
  5643. // "required": true,
  5644. // "type": "string"
  5645. // }
  5646. // },
  5647. // "path": "groups/{groupKey}/members/{memberKey}",
  5648. // "scopes": [
  5649. // "https://www.googleapis.com/auth/admin.directory.group",
  5650. // "https://www.googleapis.com/auth/admin.directory.group.member"
  5651. // ]
  5652. // }
  5653. }
  5654. // method id "directory.members.get":
  5655. type MembersGetCall struct {
  5656. s *Service
  5657. groupKey string
  5658. memberKey string
  5659. urlParams_ gensupport.URLParams
  5660. ifNoneMatch_ string
  5661. ctx_ context.Context
  5662. }
  5663. // Get: Retrieve Group Member
  5664. func (r *MembersService) Get(groupKey string, memberKey string) *MembersGetCall {
  5665. c := &MembersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5666. c.groupKey = groupKey
  5667. c.memberKey = memberKey
  5668. return c
  5669. }
  5670. // Fields allows partial responses to be retrieved. See
  5671. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5672. // for more information.
  5673. func (c *MembersGetCall) Fields(s ...googleapi.Field) *MembersGetCall {
  5674. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5675. return c
  5676. }
  5677. // IfNoneMatch sets the optional parameter which makes the operation
  5678. // fail if the object's ETag matches the given value. This is useful for
  5679. // getting updates only after the object has changed since the last
  5680. // request. Use googleapi.IsNotModified to check whether the response
  5681. // error from Do is the result of In-None-Match.
  5682. func (c *MembersGetCall) IfNoneMatch(entityTag string) *MembersGetCall {
  5683. c.ifNoneMatch_ = entityTag
  5684. return c
  5685. }
  5686. // Context sets the context to be used in this call's Do method. Any
  5687. // pending HTTP request will be aborted if the provided context is
  5688. // canceled.
  5689. func (c *MembersGetCall) Context(ctx context.Context) *MembersGetCall {
  5690. c.ctx_ = ctx
  5691. return c
  5692. }
  5693. func (c *MembersGetCall) doRequest(alt string) (*http.Response, error) {
  5694. var body io.Reader = nil
  5695. c.urlParams_.Set("alt", alt)
  5696. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members/{memberKey}")
  5697. urls += "?" + c.urlParams_.Encode()
  5698. req, _ := http.NewRequest("GET", urls, body)
  5699. googleapi.Expand(req.URL, map[string]string{
  5700. "groupKey": c.groupKey,
  5701. "memberKey": c.memberKey,
  5702. })
  5703. req.Header.Set("User-Agent", c.s.userAgent())
  5704. if c.ifNoneMatch_ != "" {
  5705. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5706. }
  5707. if c.ctx_ != nil {
  5708. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5709. }
  5710. return c.s.client.Do(req)
  5711. }
  5712. // Do executes the "directory.members.get" call.
  5713. // Exactly one of *Member or error will be non-nil. Any non-2xx status
  5714. // code is an error. Response headers are in either
  5715. // *Member.ServerResponse.Header or (if a response was returned at all)
  5716. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5717. // check whether the returned error was because http.StatusNotModified
  5718. // was returned.
  5719. func (c *MembersGetCall) Do(opts ...googleapi.CallOption) (*Member, error) {
  5720. gensupport.SetOptions(c.urlParams_, opts...)
  5721. res, err := c.doRequest("json")
  5722. if res != nil && res.StatusCode == http.StatusNotModified {
  5723. if res.Body != nil {
  5724. res.Body.Close()
  5725. }
  5726. return nil, &googleapi.Error{
  5727. Code: res.StatusCode,
  5728. Header: res.Header,
  5729. }
  5730. }
  5731. if err != nil {
  5732. return nil, err
  5733. }
  5734. defer googleapi.CloseBody(res)
  5735. if err := googleapi.CheckResponse(res); err != nil {
  5736. return nil, err
  5737. }
  5738. ret := &Member{
  5739. ServerResponse: googleapi.ServerResponse{
  5740. Header: res.Header,
  5741. HTTPStatusCode: res.StatusCode,
  5742. },
  5743. }
  5744. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5745. return nil, err
  5746. }
  5747. return ret, nil
  5748. // {
  5749. // "description": "Retrieve Group Member",
  5750. // "httpMethod": "GET",
  5751. // "id": "directory.members.get",
  5752. // "parameterOrder": [
  5753. // "groupKey",
  5754. // "memberKey"
  5755. // ],
  5756. // "parameters": {
  5757. // "groupKey": {
  5758. // "description": "Email or immutable Id of the group",
  5759. // "location": "path",
  5760. // "required": true,
  5761. // "type": "string"
  5762. // },
  5763. // "memberKey": {
  5764. // "description": "Email or immutable Id of the member",
  5765. // "location": "path",
  5766. // "required": true,
  5767. // "type": "string"
  5768. // }
  5769. // },
  5770. // "path": "groups/{groupKey}/members/{memberKey}",
  5771. // "response": {
  5772. // "$ref": "Member"
  5773. // },
  5774. // "scopes": [
  5775. // "https://www.googleapis.com/auth/admin.directory.group",
  5776. // "https://www.googleapis.com/auth/admin.directory.group.member",
  5777. // "https://www.googleapis.com/auth/admin.directory.group.member.readonly",
  5778. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  5779. // ]
  5780. // }
  5781. }
  5782. // method id "directory.members.insert":
  5783. type MembersInsertCall struct {
  5784. s *Service
  5785. groupKey string
  5786. member *Member
  5787. urlParams_ gensupport.URLParams
  5788. ctx_ context.Context
  5789. }
  5790. // Insert: Add user to the specified group.
  5791. func (r *MembersService) Insert(groupKey string, member *Member) *MembersInsertCall {
  5792. c := &MembersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5793. c.groupKey = groupKey
  5794. c.member = member
  5795. return c
  5796. }
  5797. // Fields allows partial responses to be retrieved. See
  5798. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5799. // for more information.
  5800. func (c *MembersInsertCall) Fields(s ...googleapi.Field) *MembersInsertCall {
  5801. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5802. return c
  5803. }
  5804. // Context sets the context to be used in this call's Do method. Any
  5805. // pending HTTP request will be aborted if the provided context is
  5806. // canceled.
  5807. func (c *MembersInsertCall) Context(ctx context.Context) *MembersInsertCall {
  5808. c.ctx_ = ctx
  5809. return c
  5810. }
  5811. func (c *MembersInsertCall) doRequest(alt string) (*http.Response, error) {
  5812. var body io.Reader = nil
  5813. body, err := googleapi.WithoutDataWrapper.JSONReader(c.member)
  5814. if err != nil {
  5815. return nil, err
  5816. }
  5817. ctype := "application/json"
  5818. c.urlParams_.Set("alt", alt)
  5819. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members")
  5820. urls += "?" + c.urlParams_.Encode()
  5821. req, _ := http.NewRequest("POST", urls, body)
  5822. googleapi.Expand(req.URL, map[string]string{
  5823. "groupKey": c.groupKey,
  5824. })
  5825. req.Header.Set("Content-Type", ctype)
  5826. req.Header.Set("User-Agent", c.s.userAgent())
  5827. if c.ctx_ != nil {
  5828. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5829. }
  5830. return c.s.client.Do(req)
  5831. }
  5832. // Do executes the "directory.members.insert" call.
  5833. // Exactly one of *Member or error will be non-nil. Any non-2xx status
  5834. // code is an error. Response headers are in either
  5835. // *Member.ServerResponse.Header or (if a response was returned at all)
  5836. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5837. // check whether the returned error was because http.StatusNotModified
  5838. // was returned.
  5839. func (c *MembersInsertCall) Do(opts ...googleapi.CallOption) (*Member, error) {
  5840. gensupport.SetOptions(c.urlParams_, opts...)
  5841. res, err := c.doRequest("json")
  5842. if res != nil && res.StatusCode == http.StatusNotModified {
  5843. if res.Body != nil {
  5844. res.Body.Close()
  5845. }
  5846. return nil, &googleapi.Error{
  5847. Code: res.StatusCode,
  5848. Header: res.Header,
  5849. }
  5850. }
  5851. if err != nil {
  5852. return nil, err
  5853. }
  5854. defer googleapi.CloseBody(res)
  5855. if err := googleapi.CheckResponse(res); err != nil {
  5856. return nil, err
  5857. }
  5858. ret := &Member{
  5859. ServerResponse: googleapi.ServerResponse{
  5860. Header: res.Header,
  5861. HTTPStatusCode: res.StatusCode,
  5862. },
  5863. }
  5864. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  5865. return nil, err
  5866. }
  5867. return ret, nil
  5868. // {
  5869. // "description": "Add user to the specified group.",
  5870. // "httpMethod": "POST",
  5871. // "id": "directory.members.insert",
  5872. // "parameterOrder": [
  5873. // "groupKey"
  5874. // ],
  5875. // "parameters": {
  5876. // "groupKey": {
  5877. // "description": "Email or immutable Id of the group",
  5878. // "location": "path",
  5879. // "required": true,
  5880. // "type": "string"
  5881. // }
  5882. // },
  5883. // "path": "groups/{groupKey}/members",
  5884. // "request": {
  5885. // "$ref": "Member"
  5886. // },
  5887. // "response": {
  5888. // "$ref": "Member"
  5889. // },
  5890. // "scopes": [
  5891. // "https://www.googleapis.com/auth/admin.directory.group",
  5892. // "https://www.googleapis.com/auth/admin.directory.group.member"
  5893. // ]
  5894. // }
  5895. }
  5896. // method id "directory.members.list":
  5897. type MembersListCall struct {
  5898. s *Service
  5899. groupKey string
  5900. urlParams_ gensupport.URLParams
  5901. ifNoneMatch_ string
  5902. ctx_ context.Context
  5903. }
  5904. // List: Retrieve all members in a group (paginated)
  5905. func (r *MembersService) List(groupKey string) *MembersListCall {
  5906. c := &MembersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5907. c.groupKey = groupKey
  5908. return c
  5909. }
  5910. // MaxResults sets the optional parameter "maxResults": Maximum number
  5911. // of results to return. Default is 200
  5912. func (c *MembersListCall) MaxResults(maxResults int64) *MembersListCall {
  5913. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5914. return c
  5915. }
  5916. // PageToken sets the optional parameter "pageToken": Token to specify
  5917. // next page in the list
  5918. func (c *MembersListCall) PageToken(pageToken string) *MembersListCall {
  5919. c.urlParams_.Set("pageToken", pageToken)
  5920. return c
  5921. }
  5922. // Roles sets the optional parameter "roles": Comma separated role
  5923. // values to filter list results on.
  5924. func (c *MembersListCall) Roles(roles string) *MembersListCall {
  5925. c.urlParams_.Set("roles", roles)
  5926. return c
  5927. }
  5928. // Fields allows partial responses to be retrieved. See
  5929. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5930. // for more information.
  5931. func (c *MembersListCall) Fields(s ...googleapi.Field) *MembersListCall {
  5932. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5933. return c
  5934. }
  5935. // IfNoneMatch sets the optional parameter which makes the operation
  5936. // fail if the object's ETag matches the given value. This is useful for
  5937. // getting updates only after the object has changed since the last
  5938. // request. Use googleapi.IsNotModified to check whether the response
  5939. // error from Do is the result of In-None-Match.
  5940. func (c *MembersListCall) IfNoneMatch(entityTag string) *MembersListCall {
  5941. c.ifNoneMatch_ = entityTag
  5942. return c
  5943. }
  5944. // Context sets the context to be used in this call's Do method. Any
  5945. // pending HTTP request will be aborted if the provided context is
  5946. // canceled.
  5947. func (c *MembersListCall) Context(ctx context.Context) *MembersListCall {
  5948. c.ctx_ = ctx
  5949. return c
  5950. }
  5951. func (c *MembersListCall) doRequest(alt string) (*http.Response, error) {
  5952. var body io.Reader = nil
  5953. c.urlParams_.Set("alt", alt)
  5954. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members")
  5955. urls += "?" + c.urlParams_.Encode()
  5956. req, _ := http.NewRequest("GET", urls, body)
  5957. googleapi.Expand(req.URL, map[string]string{
  5958. "groupKey": c.groupKey,
  5959. })
  5960. req.Header.Set("User-Agent", c.s.userAgent())
  5961. if c.ifNoneMatch_ != "" {
  5962. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  5963. }
  5964. if c.ctx_ != nil {
  5965. return ctxhttp.Do(c.ctx_, c.s.client, req)
  5966. }
  5967. return c.s.client.Do(req)
  5968. }
  5969. // Do executes the "directory.members.list" call.
  5970. // Exactly one of *Members or error will be non-nil. Any non-2xx status
  5971. // code is an error. Response headers are in either
  5972. // *Members.ServerResponse.Header or (if a response was returned at all)
  5973. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5974. // check whether the returned error was because http.StatusNotModified
  5975. // was returned.
  5976. func (c *MembersListCall) Do(opts ...googleapi.CallOption) (*Members, error) {
  5977. gensupport.SetOptions(c.urlParams_, opts...)
  5978. res, err := c.doRequest("json")
  5979. if res != nil && res.StatusCode == http.StatusNotModified {
  5980. if res.Body != nil {
  5981. res.Body.Close()
  5982. }
  5983. return nil, &googleapi.Error{
  5984. Code: res.StatusCode,
  5985. Header: res.Header,
  5986. }
  5987. }
  5988. if err != nil {
  5989. return nil, err
  5990. }
  5991. defer googleapi.CloseBody(res)
  5992. if err := googleapi.CheckResponse(res); err != nil {
  5993. return nil, err
  5994. }
  5995. ret := &Members{
  5996. ServerResponse: googleapi.ServerResponse{
  5997. Header: res.Header,
  5998. HTTPStatusCode: res.StatusCode,
  5999. },
  6000. }
  6001. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6002. return nil, err
  6003. }
  6004. return ret, nil
  6005. // {
  6006. // "description": "Retrieve all members in a group (paginated)",
  6007. // "httpMethod": "GET",
  6008. // "id": "directory.members.list",
  6009. // "parameterOrder": [
  6010. // "groupKey"
  6011. // ],
  6012. // "parameters": {
  6013. // "groupKey": {
  6014. // "description": "Email or immutable Id of the group",
  6015. // "location": "path",
  6016. // "required": true,
  6017. // "type": "string"
  6018. // },
  6019. // "maxResults": {
  6020. // "description": "Maximum number of results to return. Default is 200",
  6021. // "format": "int32",
  6022. // "location": "query",
  6023. // "minimum": "1",
  6024. // "type": "integer"
  6025. // },
  6026. // "pageToken": {
  6027. // "description": "Token to specify next page in the list",
  6028. // "location": "query",
  6029. // "type": "string"
  6030. // },
  6031. // "roles": {
  6032. // "description": "Comma separated role values to filter list results on.",
  6033. // "location": "query",
  6034. // "type": "string"
  6035. // }
  6036. // },
  6037. // "path": "groups/{groupKey}/members",
  6038. // "response": {
  6039. // "$ref": "Members"
  6040. // },
  6041. // "scopes": [
  6042. // "https://www.googleapis.com/auth/admin.directory.group",
  6043. // "https://www.googleapis.com/auth/admin.directory.group.member",
  6044. // "https://www.googleapis.com/auth/admin.directory.group.member.readonly",
  6045. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  6046. // ]
  6047. // }
  6048. }
  6049. // Pages invokes f for each page of results.
  6050. // A non-nil error returned from f will halt the iteration.
  6051. // The provided context supersedes any context provided to the Context method.
  6052. func (c *MembersListCall) Pages(ctx context.Context, f func(*Members) error) error {
  6053. c.ctx_ = ctx
  6054. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6055. for {
  6056. x, err := c.Do()
  6057. if err != nil {
  6058. return err
  6059. }
  6060. if err := f(x); err != nil {
  6061. return err
  6062. }
  6063. if x.NextPageToken == "" {
  6064. return nil
  6065. }
  6066. c.PageToken(x.NextPageToken)
  6067. }
  6068. }
  6069. // method id "directory.members.patch":
  6070. type MembersPatchCall struct {
  6071. s *Service
  6072. groupKey string
  6073. memberKey string
  6074. member *Member
  6075. urlParams_ gensupport.URLParams
  6076. ctx_ context.Context
  6077. }
  6078. // Patch: Update membership of a user in the specified group. This
  6079. // method supports patch semantics.
  6080. func (r *MembersService) Patch(groupKey string, memberKey string, member *Member) *MembersPatchCall {
  6081. c := &MembersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6082. c.groupKey = groupKey
  6083. c.memberKey = memberKey
  6084. c.member = member
  6085. return c
  6086. }
  6087. // Fields allows partial responses to be retrieved. See
  6088. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6089. // for more information.
  6090. func (c *MembersPatchCall) Fields(s ...googleapi.Field) *MembersPatchCall {
  6091. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6092. return c
  6093. }
  6094. // Context sets the context to be used in this call's Do method. Any
  6095. // pending HTTP request will be aborted if the provided context is
  6096. // canceled.
  6097. func (c *MembersPatchCall) Context(ctx context.Context) *MembersPatchCall {
  6098. c.ctx_ = ctx
  6099. return c
  6100. }
  6101. func (c *MembersPatchCall) doRequest(alt string) (*http.Response, error) {
  6102. var body io.Reader = nil
  6103. body, err := googleapi.WithoutDataWrapper.JSONReader(c.member)
  6104. if err != nil {
  6105. return nil, err
  6106. }
  6107. ctype := "application/json"
  6108. c.urlParams_.Set("alt", alt)
  6109. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members/{memberKey}")
  6110. urls += "?" + c.urlParams_.Encode()
  6111. req, _ := http.NewRequest("PATCH", urls, body)
  6112. googleapi.Expand(req.URL, map[string]string{
  6113. "groupKey": c.groupKey,
  6114. "memberKey": c.memberKey,
  6115. })
  6116. req.Header.Set("Content-Type", ctype)
  6117. req.Header.Set("User-Agent", c.s.userAgent())
  6118. if c.ctx_ != nil {
  6119. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6120. }
  6121. return c.s.client.Do(req)
  6122. }
  6123. // Do executes the "directory.members.patch" call.
  6124. // Exactly one of *Member or error will be non-nil. Any non-2xx status
  6125. // code is an error. Response headers are in either
  6126. // *Member.ServerResponse.Header or (if a response was returned at all)
  6127. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6128. // check whether the returned error was because http.StatusNotModified
  6129. // was returned.
  6130. func (c *MembersPatchCall) Do(opts ...googleapi.CallOption) (*Member, error) {
  6131. gensupport.SetOptions(c.urlParams_, opts...)
  6132. res, err := c.doRequest("json")
  6133. if res != nil && res.StatusCode == http.StatusNotModified {
  6134. if res.Body != nil {
  6135. res.Body.Close()
  6136. }
  6137. return nil, &googleapi.Error{
  6138. Code: res.StatusCode,
  6139. Header: res.Header,
  6140. }
  6141. }
  6142. if err != nil {
  6143. return nil, err
  6144. }
  6145. defer googleapi.CloseBody(res)
  6146. if err := googleapi.CheckResponse(res); err != nil {
  6147. return nil, err
  6148. }
  6149. ret := &Member{
  6150. ServerResponse: googleapi.ServerResponse{
  6151. Header: res.Header,
  6152. HTTPStatusCode: res.StatusCode,
  6153. },
  6154. }
  6155. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6156. return nil, err
  6157. }
  6158. return ret, nil
  6159. // {
  6160. // "description": "Update membership of a user in the specified group. This method supports patch semantics.",
  6161. // "httpMethod": "PATCH",
  6162. // "id": "directory.members.patch",
  6163. // "parameterOrder": [
  6164. // "groupKey",
  6165. // "memberKey"
  6166. // ],
  6167. // "parameters": {
  6168. // "groupKey": {
  6169. // "description": "Email or immutable Id of the group. If Id, it should match with id of group object",
  6170. // "location": "path",
  6171. // "required": true,
  6172. // "type": "string"
  6173. // },
  6174. // "memberKey": {
  6175. // "description": "Email or immutable Id of the user. If Id, it should match with id of member object",
  6176. // "location": "path",
  6177. // "required": true,
  6178. // "type": "string"
  6179. // }
  6180. // },
  6181. // "path": "groups/{groupKey}/members/{memberKey}",
  6182. // "request": {
  6183. // "$ref": "Member"
  6184. // },
  6185. // "response": {
  6186. // "$ref": "Member"
  6187. // },
  6188. // "scopes": [
  6189. // "https://www.googleapis.com/auth/admin.directory.group",
  6190. // "https://www.googleapis.com/auth/admin.directory.group.member"
  6191. // ]
  6192. // }
  6193. }
  6194. // method id "directory.members.update":
  6195. type MembersUpdateCall struct {
  6196. s *Service
  6197. groupKey string
  6198. memberKey string
  6199. member *Member
  6200. urlParams_ gensupport.URLParams
  6201. ctx_ context.Context
  6202. }
  6203. // Update: Update membership of a user in the specified group.
  6204. func (r *MembersService) Update(groupKey string, memberKey string, member *Member) *MembersUpdateCall {
  6205. c := &MembersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6206. c.groupKey = groupKey
  6207. c.memberKey = memberKey
  6208. c.member = member
  6209. return c
  6210. }
  6211. // Fields allows partial responses to be retrieved. See
  6212. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6213. // for more information.
  6214. func (c *MembersUpdateCall) Fields(s ...googleapi.Field) *MembersUpdateCall {
  6215. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6216. return c
  6217. }
  6218. // Context sets the context to be used in this call's Do method. Any
  6219. // pending HTTP request will be aborted if the provided context is
  6220. // canceled.
  6221. func (c *MembersUpdateCall) Context(ctx context.Context) *MembersUpdateCall {
  6222. c.ctx_ = ctx
  6223. return c
  6224. }
  6225. func (c *MembersUpdateCall) doRequest(alt string) (*http.Response, error) {
  6226. var body io.Reader = nil
  6227. body, err := googleapi.WithoutDataWrapper.JSONReader(c.member)
  6228. if err != nil {
  6229. return nil, err
  6230. }
  6231. ctype := "application/json"
  6232. c.urlParams_.Set("alt", alt)
  6233. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members/{memberKey}")
  6234. urls += "?" + c.urlParams_.Encode()
  6235. req, _ := http.NewRequest("PUT", urls, body)
  6236. googleapi.Expand(req.URL, map[string]string{
  6237. "groupKey": c.groupKey,
  6238. "memberKey": c.memberKey,
  6239. })
  6240. req.Header.Set("Content-Type", ctype)
  6241. req.Header.Set("User-Agent", c.s.userAgent())
  6242. if c.ctx_ != nil {
  6243. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6244. }
  6245. return c.s.client.Do(req)
  6246. }
  6247. // Do executes the "directory.members.update" call.
  6248. // Exactly one of *Member or error will be non-nil. Any non-2xx status
  6249. // code is an error. Response headers are in either
  6250. // *Member.ServerResponse.Header or (if a response was returned at all)
  6251. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6252. // check whether the returned error was because http.StatusNotModified
  6253. // was returned.
  6254. func (c *MembersUpdateCall) Do(opts ...googleapi.CallOption) (*Member, error) {
  6255. gensupport.SetOptions(c.urlParams_, opts...)
  6256. res, err := c.doRequest("json")
  6257. if res != nil && res.StatusCode == http.StatusNotModified {
  6258. if res.Body != nil {
  6259. res.Body.Close()
  6260. }
  6261. return nil, &googleapi.Error{
  6262. Code: res.StatusCode,
  6263. Header: res.Header,
  6264. }
  6265. }
  6266. if err != nil {
  6267. return nil, err
  6268. }
  6269. defer googleapi.CloseBody(res)
  6270. if err := googleapi.CheckResponse(res); err != nil {
  6271. return nil, err
  6272. }
  6273. ret := &Member{
  6274. ServerResponse: googleapi.ServerResponse{
  6275. Header: res.Header,
  6276. HTTPStatusCode: res.StatusCode,
  6277. },
  6278. }
  6279. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6280. return nil, err
  6281. }
  6282. return ret, nil
  6283. // {
  6284. // "description": "Update membership of a user in the specified group.",
  6285. // "httpMethod": "PUT",
  6286. // "id": "directory.members.update",
  6287. // "parameterOrder": [
  6288. // "groupKey",
  6289. // "memberKey"
  6290. // ],
  6291. // "parameters": {
  6292. // "groupKey": {
  6293. // "description": "Email or immutable Id of the group. If Id, it should match with id of group object",
  6294. // "location": "path",
  6295. // "required": true,
  6296. // "type": "string"
  6297. // },
  6298. // "memberKey": {
  6299. // "description": "Email or immutable Id of the user. If Id, it should match with id of member object",
  6300. // "location": "path",
  6301. // "required": true,
  6302. // "type": "string"
  6303. // }
  6304. // },
  6305. // "path": "groups/{groupKey}/members/{memberKey}",
  6306. // "request": {
  6307. // "$ref": "Member"
  6308. // },
  6309. // "response": {
  6310. // "$ref": "Member"
  6311. // },
  6312. // "scopes": [
  6313. // "https://www.googleapis.com/auth/admin.directory.group",
  6314. // "https://www.googleapis.com/auth/admin.directory.group.member"
  6315. // ]
  6316. // }
  6317. }
  6318. // method id "directory.mobiledevices.action":
  6319. type MobiledevicesActionCall struct {
  6320. s *Service
  6321. customerId string
  6322. resourceId string
  6323. mobiledeviceaction *MobileDeviceAction
  6324. urlParams_ gensupport.URLParams
  6325. ctx_ context.Context
  6326. }
  6327. // Action: Take action on Mobile Device
  6328. func (r *MobiledevicesService) Action(customerId string, resourceId string, mobiledeviceaction *MobileDeviceAction) *MobiledevicesActionCall {
  6329. c := &MobiledevicesActionCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6330. c.customerId = customerId
  6331. c.resourceId = resourceId
  6332. c.mobiledeviceaction = mobiledeviceaction
  6333. return c
  6334. }
  6335. // Fields allows partial responses to be retrieved. See
  6336. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6337. // for more information.
  6338. func (c *MobiledevicesActionCall) Fields(s ...googleapi.Field) *MobiledevicesActionCall {
  6339. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6340. return c
  6341. }
  6342. // Context sets the context to be used in this call's Do method. Any
  6343. // pending HTTP request will be aborted if the provided context is
  6344. // canceled.
  6345. func (c *MobiledevicesActionCall) Context(ctx context.Context) *MobiledevicesActionCall {
  6346. c.ctx_ = ctx
  6347. return c
  6348. }
  6349. func (c *MobiledevicesActionCall) doRequest(alt string) (*http.Response, error) {
  6350. var body io.Reader = nil
  6351. body, err := googleapi.WithoutDataWrapper.JSONReader(c.mobiledeviceaction)
  6352. if err != nil {
  6353. return nil, err
  6354. }
  6355. ctype := "application/json"
  6356. c.urlParams_.Set("alt", alt)
  6357. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/mobile/{resourceId}/action")
  6358. urls += "?" + c.urlParams_.Encode()
  6359. req, _ := http.NewRequest("POST", urls, body)
  6360. googleapi.Expand(req.URL, map[string]string{
  6361. "customerId": c.customerId,
  6362. "resourceId": c.resourceId,
  6363. })
  6364. req.Header.Set("Content-Type", ctype)
  6365. req.Header.Set("User-Agent", c.s.userAgent())
  6366. if c.ctx_ != nil {
  6367. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6368. }
  6369. return c.s.client.Do(req)
  6370. }
  6371. // Do executes the "directory.mobiledevices.action" call.
  6372. func (c *MobiledevicesActionCall) Do(opts ...googleapi.CallOption) error {
  6373. gensupport.SetOptions(c.urlParams_, opts...)
  6374. res, err := c.doRequest("json")
  6375. if err != nil {
  6376. return err
  6377. }
  6378. defer googleapi.CloseBody(res)
  6379. if err := googleapi.CheckResponse(res); err != nil {
  6380. return err
  6381. }
  6382. return nil
  6383. // {
  6384. // "description": "Take action on Mobile Device",
  6385. // "httpMethod": "POST",
  6386. // "id": "directory.mobiledevices.action",
  6387. // "parameterOrder": [
  6388. // "customerId",
  6389. // "resourceId"
  6390. // ],
  6391. // "parameters": {
  6392. // "customerId": {
  6393. // "description": "Immutable id of the Google Apps account",
  6394. // "location": "path",
  6395. // "required": true,
  6396. // "type": "string"
  6397. // },
  6398. // "resourceId": {
  6399. // "description": "Immutable id of Mobile Device",
  6400. // "location": "path",
  6401. // "required": true,
  6402. // "type": "string"
  6403. // }
  6404. // },
  6405. // "path": "customer/{customerId}/devices/mobile/{resourceId}/action",
  6406. // "request": {
  6407. // "$ref": "MobileDeviceAction"
  6408. // },
  6409. // "scopes": [
  6410. // "https://www.googleapis.com/auth/admin.directory.device.mobile",
  6411. // "https://www.googleapis.com/auth/admin.directory.device.mobile.action"
  6412. // ]
  6413. // }
  6414. }
  6415. // method id "directory.mobiledevices.delete":
  6416. type MobiledevicesDeleteCall struct {
  6417. s *Service
  6418. customerId string
  6419. resourceId string
  6420. urlParams_ gensupport.URLParams
  6421. ctx_ context.Context
  6422. }
  6423. // Delete: Delete Mobile Device
  6424. func (r *MobiledevicesService) Delete(customerId string, resourceId string) *MobiledevicesDeleteCall {
  6425. c := &MobiledevicesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6426. c.customerId = customerId
  6427. c.resourceId = resourceId
  6428. return c
  6429. }
  6430. // Fields allows partial responses to be retrieved. See
  6431. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6432. // for more information.
  6433. func (c *MobiledevicesDeleteCall) Fields(s ...googleapi.Field) *MobiledevicesDeleteCall {
  6434. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6435. return c
  6436. }
  6437. // Context sets the context to be used in this call's Do method. Any
  6438. // pending HTTP request will be aborted if the provided context is
  6439. // canceled.
  6440. func (c *MobiledevicesDeleteCall) Context(ctx context.Context) *MobiledevicesDeleteCall {
  6441. c.ctx_ = ctx
  6442. return c
  6443. }
  6444. func (c *MobiledevicesDeleteCall) doRequest(alt string) (*http.Response, error) {
  6445. var body io.Reader = nil
  6446. c.urlParams_.Set("alt", alt)
  6447. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/mobile/{resourceId}")
  6448. urls += "?" + c.urlParams_.Encode()
  6449. req, _ := http.NewRequest("DELETE", urls, body)
  6450. googleapi.Expand(req.URL, map[string]string{
  6451. "customerId": c.customerId,
  6452. "resourceId": c.resourceId,
  6453. })
  6454. req.Header.Set("User-Agent", c.s.userAgent())
  6455. if c.ctx_ != nil {
  6456. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6457. }
  6458. return c.s.client.Do(req)
  6459. }
  6460. // Do executes the "directory.mobiledevices.delete" call.
  6461. func (c *MobiledevicesDeleteCall) Do(opts ...googleapi.CallOption) error {
  6462. gensupport.SetOptions(c.urlParams_, opts...)
  6463. res, err := c.doRequest("json")
  6464. if err != nil {
  6465. return err
  6466. }
  6467. defer googleapi.CloseBody(res)
  6468. if err := googleapi.CheckResponse(res); err != nil {
  6469. return err
  6470. }
  6471. return nil
  6472. // {
  6473. // "description": "Delete Mobile Device",
  6474. // "httpMethod": "DELETE",
  6475. // "id": "directory.mobiledevices.delete",
  6476. // "parameterOrder": [
  6477. // "customerId",
  6478. // "resourceId"
  6479. // ],
  6480. // "parameters": {
  6481. // "customerId": {
  6482. // "description": "Immutable id of the Google Apps account",
  6483. // "location": "path",
  6484. // "required": true,
  6485. // "type": "string"
  6486. // },
  6487. // "resourceId": {
  6488. // "description": "Immutable id of Mobile Device",
  6489. // "location": "path",
  6490. // "required": true,
  6491. // "type": "string"
  6492. // }
  6493. // },
  6494. // "path": "customer/{customerId}/devices/mobile/{resourceId}",
  6495. // "scopes": [
  6496. // "https://www.googleapis.com/auth/admin.directory.device.mobile"
  6497. // ]
  6498. // }
  6499. }
  6500. // method id "directory.mobiledevices.get":
  6501. type MobiledevicesGetCall struct {
  6502. s *Service
  6503. customerId string
  6504. resourceId string
  6505. urlParams_ gensupport.URLParams
  6506. ifNoneMatch_ string
  6507. ctx_ context.Context
  6508. }
  6509. // Get: Retrieve Mobile Device
  6510. func (r *MobiledevicesService) Get(customerId string, resourceId string) *MobiledevicesGetCall {
  6511. c := &MobiledevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6512. c.customerId = customerId
  6513. c.resourceId = resourceId
  6514. return c
  6515. }
  6516. // Projection sets the optional parameter "projection": Restrict
  6517. // information returned to a set of selected fields.
  6518. //
  6519. // Possible values:
  6520. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  6521. // model, status, type, and status)
  6522. // "FULL" - Includes all metadata fields
  6523. func (c *MobiledevicesGetCall) Projection(projection string) *MobiledevicesGetCall {
  6524. c.urlParams_.Set("projection", projection)
  6525. return c
  6526. }
  6527. // Fields allows partial responses to be retrieved. See
  6528. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6529. // for more information.
  6530. func (c *MobiledevicesGetCall) Fields(s ...googleapi.Field) *MobiledevicesGetCall {
  6531. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6532. return c
  6533. }
  6534. // IfNoneMatch sets the optional parameter which makes the operation
  6535. // fail if the object's ETag matches the given value. This is useful for
  6536. // getting updates only after the object has changed since the last
  6537. // request. Use googleapi.IsNotModified to check whether the response
  6538. // error from Do is the result of In-None-Match.
  6539. func (c *MobiledevicesGetCall) IfNoneMatch(entityTag string) *MobiledevicesGetCall {
  6540. c.ifNoneMatch_ = entityTag
  6541. return c
  6542. }
  6543. // Context sets the context to be used in this call's Do method. Any
  6544. // pending HTTP request will be aborted if the provided context is
  6545. // canceled.
  6546. func (c *MobiledevicesGetCall) Context(ctx context.Context) *MobiledevicesGetCall {
  6547. c.ctx_ = ctx
  6548. return c
  6549. }
  6550. func (c *MobiledevicesGetCall) doRequest(alt string) (*http.Response, error) {
  6551. var body io.Reader = nil
  6552. c.urlParams_.Set("alt", alt)
  6553. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/mobile/{resourceId}")
  6554. urls += "?" + c.urlParams_.Encode()
  6555. req, _ := http.NewRequest("GET", urls, body)
  6556. googleapi.Expand(req.URL, map[string]string{
  6557. "customerId": c.customerId,
  6558. "resourceId": c.resourceId,
  6559. })
  6560. req.Header.Set("User-Agent", c.s.userAgent())
  6561. if c.ifNoneMatch_ != "" {
  6562. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  6563. }
  6564. if c.ctx_ != nil {
  6565. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6566. }
  6567. return c.s.client.Do(req)
  6568. }
  6569. // Do executes the "directory.mobiledevices.get" call.
  6570. // Exactly one of *MobileDevice or error will be non-nil. Any non-2xx
  6571. // status code is an error. Response headers are in either
  6572. // *MobileDevice.ServerResponse.Header or (if a response was returned at
  6573. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6574. // to check whether the returned error was because
  6575. // http.StatusNotModified was returned.
  6576. func (c *MobiledevicesGetCall) Do(opts ...googleapi.CallOption) (*MobileDevice, error) {
  6577. gensupport.SetOptions(c.urlParams_, opts...)
  6578. res, err := c.doRequest("json")
  6579. if res != nil && res.StatusCode == http.StatusNotModified {
  6580. if res.Body != nil {
  6581. res.Body.Close()
  6582. }
  6583. return nil, &googleapi.Error{
  6584. Code: res.StatusCode,
  6585. Header: res.Header,
  6586. }
  6587. }
  6588. if err != nil {
  6589. return nil, err
  6590. }
  6591. defer googleapi.CloseBody(res)
  6592. if err := googleapi.CheckResponse(res); err != nil {
  6593. return nil, err
  6594. }
  6595. ret := &MobileDevice{
  6596. ServerResponse: googleapi.ServerResponse{
  6597. Header: res.Header,
  6598. HTTPStatusCode: res.StatusCode,
  6599. },
  6600. }
  6601. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6602. return nil, err
  6603. }
  6604. return ret, nil
  6605. // {
  6606. // "description": "Retrieve Mobile Device",
  6607. // "httpMethod": "GET",
  6608. // "id": "directory.mobiledevices.get",
  6609. // "parameterOrder": [
  6610. // "customerId",
  6611. // "resourceId"
  6612. // ],
  6613. // "parameters": {
  6614. // "customerId": {
  6615. // "description": "Immutable id of the Google Apps account",
  6616. // "location": "path",
  6617. // "required": true,
  6618. // "type": "string"
  6619. // },
  6620. // "projection": {
  6621. // "description": "Restrict information returned to a set of selected fields.",
  6622. // "enum": [
  6623. // "BASIC",
  6624. // "FULL"
  6625. // ],
  6626. // "enumDescriptions": [
  6627. // "Includes only the basic metadata fields (e.g., deviceId, model, status, type, and status)",
  6628. // "Includes all metadata fields"
  6629. // ],
  6630. // "location": "query",
  6631. // "type": "string"
  6632. // },
  6633. // "resourceId": {
  6634. // "description": "Immutable id of Mobile Device",
  6635. // "location": "path",
  6636. // "required": true,
  6637. // "type": "string"
  6638. // }
  6639. // },
  6640. // "path": "customer/{customerId}/devices/mobile/{resourceId}",
  6641. // "response": {
  6642. // "$ref": "MobileDevice"
  6643. // },
  6644. // "scopes": [
  6645. // "https://www.googleapis.com/auth/admin.directory.device.mobile",
  6646. // "https://www.googleapis.com/auth/admin.directory.device.mobile.action",
  6647. // "https://www.googleapis.com/auth/admin.directory.device.mobile.readonly"
  6648. // ]
  6649. // }
  6650. }
  6651. // method id "directory.mobiledevices.list":
  6652. type MobiledevicesListCall struct {
  6653. s *Service
  6654. customerId string
  6655. urlParams_ gensupport.URLParams
  6656. ifNoneMatch_ string
  6657. ctx_ context.Context
  6658. }
  6659. // List: Retrieve all Mobile Devices of a customer (paginated)
  6660. func (r *MobiledevicesService) List(customerId string) *MobiledevicesListCall {
  6661. c := &MobiledevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6662. c.customerId = customerId
  6663. return c
  6664. }
  6665. // MaxResults sets the optional parameter "maxResults": Maximum number
  6666. // of results to return. Default is 100
  6667. func (c *MobiledevicesListCall) MaxResults(maxResults int64) *MobiledevicesListCall {
  6668. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6669. return c
  6670. }
  6671. // OrderBy sets the optional parameter "orderBy": Column to use for
  6672. // sorting results
  6673. //
  6674. // Possible values:
  6675. // "deviceId" - Mobile Device serial number.
  6676. // "email" - Owner user email.
  6677. // "lastSync" - Last policy settings sync date time of the device.
  6678. // "model" - Mobile Device model.
  6679. // "name" - Owner user name.
  6680. // "os" - Mobile operating system.
  6681. // "status" - Status of the device.
  6682. // "type" - Type of the device.
  6683. func (c *MobiledevicesListCall) OrderBy(orderBy string) *MobiledevicesListCall {
  6684. c.urlParams_.Set("orderBy", orderBy)
  6685. return c
  6686. }
  6687. // PageToken sets the optional parameter "pageToken": Token to specify
  6688. // next page in the list
  6689. func (c *MobiledevicesListCall) PageToken(pageToken string) *MobiledevicesListCall {
  6690. c.urlParams_.Set("pageToken", pageToken)
  6691. return c
  6692. }
  6693. // Projection sets the optional parameter "projection": Restrict
  6694. // information returned to a set of selected fields.
  6695. //
  6696. // Possible values:
  6697. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  6698. // model, status, type, and status)
  6699. // "FULL" - Includes all metadata fields
  6700. func (c *MobiledevicesListCall) Projection(projection string) *MobiledevicesListCall {
  6701. c.urlParams_.Set("projection", projection)
  6702. return c
  6703. }
  6704. // Query sets the optional parameter "query": Search string in the
  6705. // format given at
  6706. // http://support.google.com/a/bin/answer.py?hl=en&answer=1408863#search
  6707. func (c *MobiledevicesListCall) Query(query string) *MobiledevicesListCall {
  6708. c.urlParams_.Set("query", query)
  6709. return c
  6710. }
  6711. // SortOrder sets the optional parameter "sortOrder": Whether to return
  6712. // results in ascending or descending order. Only of use when orderBy is
  6713. // also used
  6714. //
  6715. // Possible values:
  6716. // "ASCENDING" - Ascending order.
  6717. // "DESCENDING" - Descending order.
  6718. func (c *MobiledevicesListCall) SortOrder(sortOrder string) *MobiledevicesListCall {
  6719. c.urlParams_.Set("sortOrder", sortOrder)
  6720. return c
  6721. }
  6722. // Fields allows partial responses to be retrieved. See
  6723. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6724. // for more information.
  6725. func (c *MobiledevicesListCall) Fields(s ...googleapi.Field) *MobiledevicesListCall {
  6726. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6727. return c
  6728. }
  6729. // IfNoneMatch sets the optional parameter which makes the operation
  6730. // fail if the object's ETag matches the given value. This is useful for
  6731. // getting updates only after the object has changed since the last
  6732. // request. Use googleapi.IsNotModified to check whether the response
  6733. // error from Do is the result of In-None-Match.
  6734. func (c *MobiledevicesListCall) IfNoneMatch(entityTag string) *MobiledevicesListCall {
  6735. c.ifNoneMatch_ = entityTag
  6736. return c
  6737. }
  6738. // Context sets the context to be used in this call's Do method. Any
  6739. // pending HTTP request will be aborted if the provided context is
  6740. // canceled.
  6741. func (c *MobiledevicesListCall) Context(ctx context.Context) *MobiledevicesListCall {
  6742. c.ctx_ = ctx
  6743. return c
  6744. }
  6745. func (c *MobiledevicesListCall) doRequest(alt string) (*http.Response, error) {
  6746. var body io.Reader = nil
  6747. c.urlParams_.Set("alt", alt)
  6748. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/mobile")
  6749. urls += "?" + c.urlParams_.Encode()
  6750. req, _ := http.NewRequest("GET", urls, body)
  6751. googleapi.Expand(req.URL, map[string]string{
  6752. "customerId": c.customerId,
  6753. })
  6754. req.Header.Set("User-Agent", c.s.userAgent())
  6755. if c.ifNoneMatch_ != "" {
  6756. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  6757. }
  6758. if c.ctx_ != nil {
  6759. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6760. }
  6761. return c.s.client.Do(req)
  6762. }
  6763. // Do executes the "directory.mobiledevices.list" call.
  6764. // Exactly one of *MobileDevices or error will be non-nil. Any non-2xx
  6765. // status code is an error. Response headers are in either
  6766. // *MobileDevices.ServerResponse.Header or (if a response was returned
  6767. // at all) in error.(*googleapi.Error).Header. Use
  6768. // googleapi.IsNotModified to check whether the returned error was
  6769. // because http.StatusNotModified was returned.
  6770. func (c *MobiledevicesListCall) Do(opts ...googleapi.CallOption) (*MobileDevices, error) {
  6771. gensupport.SetOptions(c.urlParams_, opts...)
  6772. res, err := c.doRequest("json")
  6773. if res != nil && res.StatusCode == http.StatusNotModified {
  6774. if res.Body != nil {
  6775. res.Body.Close()
  6776. }
  6777. return nil, &googleapi.Error{
  6778. Code: res.StatusCode,
  6779. Header: res.Header,
  6780. }
  6781. }
  6782. if err != nil {
  6783. return nil, err
  6784. }
  6785. defer googleapi.CloseBody(res)
  6786. if err := googleapi.CheckResponse(res); err != nil {
  6787. return nil, err
  6788. }
  6789. ret := &MobileDevices{
  6790. ServerResponse: googleapi.ServerResponse{
  6791. Header: res.Header,
  6792. HTTPStatusCode: res.StatusCode,
  6793. },
  6794. }
  6795. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  6796. return nil, err
  6797. }
  6798. return ret, nil
  6799. // {
  6800. // "description": "Retrieve all Mobile Devices of a customer (paginated)",
  6801. // "httpMethod": "GET",
  6802. // "id": "directory.mobiledevices.list",
  6803. // "parameterOrder": [
  6804. // "customerId"
  6805. // ],
  6806. // "parameters": {
  6807. // "customerId": {
  6808. // "description": "Immutable id of the Google Apps account",
  6809. // "location": "path",
  6810. // "required": true,
  6811. // "type": "string"
  6812. // },
  6813. // "maxResults": {
  6814. // "description": "Maximum number of results to return. Default is 100",
  6815. // "format": "int32",
  6816. // "location": "query",
  6817. // "minimum": "1",
  6818. // "type": "integer"
  6819. // },
  6820. // "orderBy": {
  6821. // "description": "Column to use for sorting results",
  6822. // "enum": [
  6823. // "deviceId",
  6824. // "email",
  6825. // "lastSync",
  6826. // "model",
  6827. // "name",
  6828. // "os",
  6829. // "status",
  6830. // "type"
  6831. // ],
  6832. // "enumDescriptions": [
  6833. // "Mobile Device serial number.",
  6834. // "Owner user email.",
  6835. // "Last policy settings sync date time of the device.",
  6836. // "Mobile Device model.",
  6837. // "Owner user name.",
  6838. // "Mobile operating system.",
  6839. // "Status of the device.",
  6840. // "Type of the device."
  6841. // ],
  6842. // "location": "query",
  6843. // "type": "string"
  6844. // },
  6845. // "pageToken": {
  6846. // "description": "Token to specify next page in the list",
  6847. // "location": "query",
  6848. // "type": "string"
  6849. // },
  6850. // "projection": {
  6851. // "description": "Restrict information returned to a set of selected fields.",
  6852. // "enum": [
  6853. // "BASIC",
  6854. // "FULL"
  6855. // ],
  6856. // "enumDescriptions": [
  6857. // "Includes only the basic metadata fields (e.g., deviceId, model, status, type, and status)",
  6858. // "Includes all metadata fields"
  6859. // ],
  6860. // "location": "query",
  6861. // "type": "string"
  6862. // },
  6863. // "query": {
  6864. // "description": "Search string in the format given at http://support.google.com/a/bin/answer.py?hl=en\u0026answer=1408863#search",
  6865. // "location": "query",
  6866. // "type": "string"
  6867. // },
  6868. // "sortOrder": {
  6869. // "description": "Whether to return results in ascending or descending order. Only of use when orderBy is also used",
  6870. // "enum": [
  6871. // "ASCENDING",
  6872. // "DESCENDING"
  6873. // ],
  6874. // "enumDescriptions": [
  6875. // "Ascending order.",
  6876. // "Descending order."
  6877. // ],
  6878. // "location": "query",
  6879. // "type": "string"
  6880. // }
  6881. // },
  6882. // "path": "customer/{customerId}/devices/mobile",
  6883. // "response": {
  6884. // "$ref": "MobileDevices"
  6885. // },
  6886. // "scopes": [
  6887. // "https://www.googleapis.com/auth/admin.directory.device.mobile",
  6888. // "https://www.googleapis.com/auth/admin.directory.device.mobile.action",
  6889. // "https://www.googleapis.com/auth/admin.directory.device.mobile.readonly"
  6890. // ]
  6891. // }
  6892. }
  6893. // Pages invokes f for each page of results.
  6894. // A non-nil error returned from f will halt the iteration.
  6895. // The provided context supersedes any context provided to the Context method.
  6896. func (c *MobiledevicesListCall) Pages(ctx context.Context, f func(*MobileDevices) error) error {
  6897. c.ctx_ = ctx
  6898. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6899. for {
  6900. x, err := c.Do()
  6901. if err != nil {
  6902. return err
  6903. }
  6904. if err := f(x); err != nil {
  6905. return err
  6906. }
  6907. if x.NextPageToken == "" {
  6908. return nil
  6909. }
  6910. c.PageToken(x.NextPageToken)
  6911. }
  6912. }
  6913. // method id "directory.notifications.delete":
  6914. type NotificationsDeleteCall struct {
  6915. s *Service
  6916. customer string
  6917. notificationId string
  6918. urlParams_ gensupport.URLParams
  6919. ctx_ context.Context
  6920. }
  6921. // Delete: Deletes a notification
  6922. func (r *NotificationsService) Delete(customer string, notificationId string) *NotificationsDeleteCall {
  6923. c := &NotificationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6924. c.customer = customer
  6925. c.notificationId = notificationId
  6926. return c
  6927. }
  6928. // Fields allows partial responses to be retrieved. See
  6929. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6930. // for more information.
  6931. func (c *NotificationsDeleteCall) Fields(s ...googleapi.Field) *NotificationsDeleteCall {
  6932. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6933. return c
  6934. }
  6935. // Context sets the context to be used in this call's Do method. Any
  6936. // pending HTTP request will be aborted if the provided context is
  6937. // canceled.
  6938. func (c *NotificationsDeleteCall) Context(ctx context.Context) *NotificationsDeleteCall {
  6939. c.ctx_ = ctx
  6940. return c
  6941. }
  6942. func (c *NotificationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6943. var body io.Reader = nil
  6944. c.urlParams_.Set("alt", alt)
  6945. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications/{notificationId}")
  6946. urls += "?" + c.urlParams_.Encode()
  6947. req, _ := http.NewRequest("DELETE", urls, body)
  6948. googleapi.Expand(req.URL, map[string]string{
  6949. "customer": c.customer,
  6950. "notificationId": c.notificationId,
  6951. })
  6952. req.Header.Set("User-Agent", c.s.userAgent())
  6953. if c.ctx_ != nil {
  6954. return ctxhttp.Do(c.ctx_, c.s.client, req)
  6955. }
  6956. return c.s.client.Do(req)
  6957. }
  6958. // Do executes the "directory.notifications.delete" call.
  6959. func (c *NotificationsDeleteCall) Do(opts ...googleapi.CallOption) error {
  6960. gensupport.SetOptions(c.urlParams_, opts...)
  6961. res, err := c.doRequest("json")
  6962. if err != nil {
  6963. return err
  6964. }
  6965. defer googleapi.CloseBody(res)
  6966. if err := googleapi.CheckResponse(res); err != nil {
  6967. return err
  6968. }
  6969. return nil
  6970. // {
  6971. // "description": "Deletes a notification",
  6972. // "httpMethod": "DELETE",
  6973. // "id": "directory.notifications.delete",
  6974. // "parameterOrder": [
  6975. // "customer",
  6976. // "notificationId"
  6977. // ],
  6978. // "parameters": {
  6979. // "customer": {
  6980. // "description": "The unique ID for the customer's Google account. The customerId is also returned as part of the Users resource.",
  6981. // "location": "path",
  6982. // "required": true,
  6983. // "type": "string"
  6984. // },
  6985. // "notificationId": {
  6986. // "description": "The unique ID of the notification.",
  6987. // "location": "path",
  6988. // "required": true,
  6989. // "type": "string"
  6990. // }
  6991. // },
  6992. // "path": "customer/{customer}/notifications/{notificationId}",
  6993. // "scopes": [
  6994. // "https://www.googleapis.com/auth/admin.directory.notifications"
  6995. // ]
  6996. // }
  6997. }
  6998. // method id "directory.notifications.get":
  6999. type NotificationsGetCall struct {
  7000. s *Service
  7001. customer string
  7002. notificationId string
  7003. urlParams_ gensupport.URLParams
  7004. ifNoneMatch_ string
  7005. ctx_ context.Context
  7006. }
  7007. // Get: Retrieves a notification.
  7008. func (r *NotificationsService) Get(customer string, notificationId string) *NotificationsGetCall {
  7009. c := &NotificationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7010. c.customer = customer
  7011. c.notificationId = notificationId
  7012. return c
  7013. }
  7014. // Fields allows partial responses to be retrieved. See
  7015. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7016. // for more information.
  7017. func (c *NotificationsGetCall) Fields(s ...googleapi.Field) *NotificationsGetCall {
  7018. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7019. return c
  7020. }
  7021. // IfNoneMatch sets the optional parameter which makes the operation
  7022. // fail if the object's ETag matches the given value. This is useful for
  7023. // getting updates only after the object has changed since the last
  7024. // request. Use googleapi.IsNotModified to check whether the response
  7025. // error from Do is the result of In-None-Match.
  7026. func (c *NotificationsGetCall) IfNoneMatch(entityTag string) *NotificationsGetCall {
  7027. c.ifNoneMatch_ = entityTag
  7028. return c
  7029. }
  7030. // Context sets the context to be used in this call's Do method. Any
  7031. // pending HTTP request will be aborted if the provided context is
  7032. // canceled.
  7033. func (c *NotificationsGetCall) Context(ctx context.Context) *NotificationsGetCall {
  7034. c.ctx_ = ctx
  7035. return c
  7036. }
  7037. func (c *NotificationsGetCall) doRequest(alt string) (*http.Response, error) {
  7038. var body io.Reader = nil
  7039. c.urlParams_.Set("alt", alt)
  7040. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications/{notificationId}")
  7041. urls += "?" + c.urlParams_.Encode()
  7042. req, _ := http.NewRequest("GET", urls, body)
  7043. googleapi.Expand(req.URL, map[string]string{
  7044. "customer": c.customer,
  7045. "notificationId": c.notificationId,
  7046. })
  7047. req.Header.Set("User-Agent", c.s.userAgent())
  7048. if c.ifNoneMatch_ != "" {
  7049. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  7050. }
  7051. if c.ctx_ != nil {
  7052. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7053. }
  7054. return c.s.client.Do(req)
  7055. }
  7056. // Do executes the "directory.notifications.get" call.
  7057. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  7058. // status code is an error. Response headers are in either
  7059. // *Notification.ServerResponse.Header or (if a response was returned at
  7060. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7061. // to check whether the returned error was because
  7062. // http.StatusNotModified was returned.
  7063. func (c *NotificationsGetCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  7064. gensupport.SetOptions(c.urlParams_, opts...)
  7065. res, err := c.doRequest("json")
  7066. if res != nil && res.StatusCode == http.StatusNotModified {
  7067. if res.Body != nil {
  7068. res.Body.Close()
  7069. }
  7070. return nil, &googleapi.Error{
  7071. Code: res.StatusCode,
  7072. Header: res.Header,
  7073. }
  7074. }
  7075. if err != nil {
  7076. return nil, err
  7077. }
  7078. defer googleapi.CloseBody(res)
  7079. if err := googleapi.CheckResponse(res); err != nil {
  7080. return nil, err
  7081. }
  7082. ret := &Notification{
  7083. ServerResponse: googleapi.ServerResponse{
  7084. Header: res.Header,
  7085. HTTPStatusCode: res.StatusCode,
  7086. },
  7087. }
  7088. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7089. return nil, err
  7090. }
  7091. return ret, nil
  7092. // {
  7093. // "description": "Retrieves a notification.",
  7094. // "httpMethod": "GET",
  7095. // "id": "directory.notifications.get",
  7096. // "parameterOrder": [
  7097. // "customer",
  7098. // "notificationId"
  7099. // ],
  7100. // "parameters": {
  7101. // "customer": {
  7102. // "description": "The unique ID for the customer's Google account. The customerId is also returned as part of the Users resource.",
  7103. // "location": "path",
  7104. // "required": true,
  7105. // "type": "string"
  7106. // },
  7107. // "notificationId": {
  7108. // "description": "The unique ID of the notification.",
  7109. // "location": "path",
  7110. // "required": true,
  7111. // "type": "string"
  7112. // }
  7113. // },
  7114. // "path": "customer/{customer}/notifications/{notificationId}",
  7115. // "response": {
  7116. // "$ref": "Notification"
  7117. // },
  7118. // "scopes": [
  7119. // "https://www.googleapis.com/auth/admin.directory.notifications"
  7120. // ]
  7121. // }
  7122. }
  7123. // method id "directory.notifications.list":
  7124. type NotificationsListCall struct {
  7125. s *Service
  7126. customer string
  7127. urlParams_ gensupport.URLParams
  7128. ifNoneMatch_ string
  7129. ctx_ context.Context
  7130. }
  7131. // List: Retrieves a list of notifications.
  7132. func (r *NotificationsService) List(customer string) *NotificationsListCall {
  7133. c := &NotificationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7134. c.customer = customer
  7135. return c
  7136. }
  7137. // Language sets the optional parameter "language": The ISO 639-1 code
  7138. // of the language notifications are returned in. The default is English
  7139. // (en).
  7140. func (c *NotificationsListCall) Language(language string) *NotificationsListCall {
  7141. c.urlParams_.Set("language", language)
  7142. return c
  7143. }
  7144. // MaxResults sets the optional parameter "maxResults": Maximum number
  7145. // of notifications to return per page. The default is 100.
  7146. func (c *NotificationsListCall) MaxResults(maxResults int64) *NotificationsListCall {
  7147. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  7148. return c
  7149. }
  7150. // PageToken sets the optional parameter "pageToken": The token to
  7151. // specify the page of results to retrieve.
  7152. func (c *NotificationsListCall) PageToken(pageToken string) *NotificationsListCall {
  7153. c.urlParams_.Set("pageToken", pageToken)
  7154. return c
  7155. }
  7156. // Fields allows partial responses to be retrieved. See
  7157. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7158. // for more information.
  7159. func (c *NotificationsListCall) Fields(s ...googleapi.Field) *NotificationsListCall {
  7160. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7161. return c
  7162. }
  7163. // IfNoneMatch sets the optional parameter which makes the operation
  7164. // fail if the object's ETag matches the given value. This is useful for
  7165. // getting updates only after the object has changed since the last
  7166. // request. Use googleapi.IsNotModified to check whether the response
  7167. // error from Do is the result of In-None-Match.
  7168. func (c *NotificationsListCall) IfNoneMatch(entityTag string) *NotificationsListCall {
  7169. c.ifNoneMatch_ = entityTag
  7170. return c
  7171. }
  7172. // Context sets the context to be used in this call's Do method. Any
  7173. // pending HTTP request will be aborted if the provided context is
  7174. // canceled.
  7175. func (c *NotificationsListCall) Context(ctx context.Context) *NotificationsListCall {
  7176. c.ctx_ = ctx
  7177. return c
  7178. }
  7179. func (c *NotificationsListCall) doRequest(alt string) (*http.Response, error) {
  7180. var body io.Reader = nil
  7181. c.urlParams_.Set("alt", alt)
  7182. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications")
  7183. urls += "?" + c.urlParams_.Encode()
  7184. req, _ := http.NewRequest("GET", urls, body)
  7185. googleapi.Expand(req.URL, map[string]string{
  7186. "customer": c.customer,
  7187. })
  7188. req.Header.Set("User-Agent", c.s.userAgent())
  7189. if c.ifNoneMatch_ != "" {
  7190. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  7191. }
  7192. if c.ctx_ != nil {
  7193. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7194. }
  7195. return c.s.client.Do(req)
  7196. }
  7197. // Do executes the "directory.notifications.list" call.
  7198. // Exactly one of *Notifications or error will be non-nil. Any non-2xx
  7199. // status code is an error. Response headers are in either
  7200. // *Notifications.ServerResponse.Header or (if a response was returned
  7201. // at all) in error.(*googleapi.Error).Header. Use
  7202. // googleapi.IsNotModified to check whether the returned error was
  7203. // because http.StatusNotModified was returned.
  7204. func (c *NotificationsListCall) Do(opts ...googleapi.CallOption) (*Notifications, error) {
  7205. gensupport.SetOptions(c.urlParams_, opts...)
  7206. res, err := c.doRequest("json")
  7207. if res != nil && res.StatusCode == http.StatusNotModified {
  7208. if res.Body != nil {
  7209. res.Body.Close()
  7210. }
  7211. return nil, &googleapi.Error{
  7212. Code: res.StatusCode,
  7213. Header: res.Header,
  7214. }
  7215. }
  7216. if err != nil {
  7217. return nil, err
  7218. }
  7219. defer googleapi.CloseBody(res)
  7220. if err := googleapi.CheckResponse(res); err != nil {
  7221. return nil, err
  7222. }
  7223. ret := &Notifications{
  7224. ServerResponse: googleapi.ServerResponse{
  7225. Header: res.Header,
  7226. HTTPStatusCode: res.StatusCode,
  7227. },
  7228. }
  7229. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7230. return nil, err
  7231. }
  7232. return ret, nil
  7233. // {
  7234. // "description": "Retrieves a list of notifications.",
  7235. // "httpMethod": "GET",
  7236. // "id": "directory.notifications.list",
  7237. // "parameterOrder": [
  7238. // "customer"
  7239. // ],
  7240. // "parameters": {
  7241. // "customer": {
  7242. // "description": "The unique ID for the customer's Google account.",
  7243. // "location": "path",
  7244. // "required": true,
  7245. // "type": "string"
  7246. // },
  7247. // "language": {
  7248. // "description": "The ISO 639-1 code of the language notifications are returned in. The default is English (en).",
  7249. // "location": "query",
  7250. // "type": "string"
  7251. // },
  7252. // "maxResults": {
  7253. // "description": "Maximum number of notifications to return per page. The default is 100.",
  7254. // "format": "uint32",
  7255. // "location": "query",
  7256. // "type": "integer"
  7257. // },
  7258. // "pageToken": {
  7259. // "description": "The token to specify the page of results to retrieve.",
  7260. // "location": "query",
  7261. // "type": "string"
  7262. // }
  7263. // },
  7264. // "path": "customer/{customer}/notifications",
  7265. // "response": {
  7266. // "$ref": "Notifications"
  7267. // },
  7268. // "scopes": [
  7269. // "https://www.googleapis.com/auth/admin.directory.notifications"
  7270. // ]
  7271. // }
  7272. }
  7273. // Pages invokes f for each page of results.
  7274. // A non-nil error returned from f will halt the iteration.
  7275. // The provided context supersedes any context provided to the Context method.
  7276. func (c *NotificationsListCall) Pages(ctx context.Context, f func(*Notifications) error) error {
  7277. c.ctx_ = ctx
  7278. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7279. for {
  7280. x, err := c.Do()
  7281. if err != nil {
  7282. return err
  7283. }
  7284. if err := f(x); err != nil {
  7285. return err
  7286. }
  7287. if x.NextPageToken == "" {
  7288. return nil
  7289. }
  7290. c.PageToken(x.NextPageToken)
  7291. }
  7292. }
  7293. // method id "directory.notifications.patch":
  7294. type NotificationsPatchCall struct {
  7295. s *Service
  7296. customer string
  7297. notificationId string
  7298. notification *Notification
  7299. urlParams_ gensupport.URLParams
  7300. ctx_ context.Context
  7301. }
  7302. // Patch: Updates a notification. This method supports patch semantics.
  7303. func (r *NotificationsService) Patch(customer string, notificationId string, notification *Notification) *NotificationsPatchCall {
  7304. c := &NotificationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7305. c.customer = customer
  7306. c.notificationId = notificationId
  7307. c.notification = notification
  7308. return c
  7309. }
  7310. // Fields allows partial responses to be retrieved. See
  7311. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7312. // for more information.
  7313. func (c *NotificationsPatchCall) Fields(s ...googleapi.Field) *NotificationsPatchCall {
  7314. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7315. return c
  7316. }
  7317. // Context sets the context to be used in this call's Do method. Any
  7318. // pending HTTP request will be aborted if the provided context is
  7319. // canceled.
  7320. func (c *NotificationsPatchCall) Context(ctx context.Context) *NotificationsPatchCall {
  7321. c.ctx_ = ctx
  7322. return c
  7323. }
  7324. func (c *NotificationsPatchCall) doRequest(alt string) (*http.Response, error) {
  7325. var body io.Reader = nil
  7326. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notification)
  7327. if err != nil {
  7328. return nil, err
  7329. }
  7330. ctype := "application/json"
  7331. c.urlParams_.Set("alt", alt)
  7332. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications/{notificationId}")
  7333. urls += "?" + c.urlParams_.Encode()
  7334. req, _ := http.NewRequest("PATCH", urls, body)
  7335. googleapi.Expand(req.URL, map[string]string{
  7336. "customer": c.customer,
  7337. "notificationId": c.notificationId,
  7338. })
  7339. req.Header.Set("Content-Type", ctype)
  7340. req.Header.Set("User-Agent", c.s.userAgent())
  7341. if c.ctx_ != nil {
  7342. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7343. }
  7344. return c.s.client.Do(req)
  7345. }
  7346. // Do executes the "directory.notifications.patch" call.
  7347. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  7348. // status code is an error. Response headers are in either
  7349. // *Notification.ServerResponse.Header or (if a response was returned at
  7350. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7351. // to check whether the returned error was because
  7352. // http.StatusNotModified was returned.
  7353. func (c *NotificationsPatchCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  7354. gensupport.SetOptions(c.urlParams_, opts...)
  7355. res, err := c.doRequest("json")
  7356. if res != nil && res.StatusCode == http.StatusNotModified {
  7357. if res.Body != nil {
  7358. res.Body.Close()
  7359. }
  7360. return nil, &googleapi.Error{
  7361. Code: res.StatusCode,
  7362. Header: res.Header,
  7363. }
  7364. }
  7365. if err != nil {
  7366. return nil, err
  7367. }
  7368. defer googleapi.CloseBody(res)
  7369. if err := googleapi.CheckResponse(res); err != nil {
  7370. return nil, err
  7371. }
  7372. ret := &Notification{
  7373. ServerResponse: googleapi.ServerResponse{
  7374. Header: res.Header,
  7375. HTTPStatusCode: res.StatusCode,
  7376. },
  7377. }
  7378. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7379. return nil, err
  7380. }
  7381. return ret, nil
  7382. // {
  7383. // "description": "Updates a notification. This method supports patch semantics.",
  7384. // "httpMethod": "PATCH",
  7385. // "id": "directory.notifications.patch",
  7386. // "parameterOrder": [
  7387. // "customer",
  7388. // "notificationId"
  7389. // ],
  7390. // "parameters": {
  7391. // "customer": {
  7392. // "description": "The unique ID for the customer's Google account.",
  7393. // "location": "path",
  7394. // "required": true,
  7395. // "type": "string"
  7396. // },
  7397. // "notificationId": {
  7398. // "description": "The unique ID of the notification.",
  7399. // "location": "path",
  7400. // "required": true,
  7401. // "type": "string"
  7402. // }
  7403. // },
  7404. // "path": "customer/{customer}/notifications/{notificationId}",
  7405. // "request": {
  7406. // "$ref": "Notification"
  7407. // },
  7408. // "response": {
  7409. // "$ref": "Notification"
  7410. // },
  7411. // "scopes": [
  7412. // "https://www.googleapis.com/auth/admin.directory.notifications"
  7413. // ]
  7414. // }
  7415. }
  7416. // method id "directory.notifications.update":
  7417. type NotificationsUpdateCall struct {
  7418. s *Service
  7419. customer string
  7420. notificationId string
  7421. notification *Notification
  7422. urlParams_ gensupport.URLParams
  7423. ctx_ context.Context
  7424. }
  7425. // Update: Updates a notification.
  7426. func (r *NotificationsService) Update(customer string, notificationId string, notification *Notification) *NotificationsUpdateCall {
  7427. c := &NotificationsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7428. c.customer = customer
  7429. c.notificationId = notificationId
  7430. c.notification = notification
  7431. return c
  7432. }
  7433. // Fields allows partial responses to be retrieved. See
  7434. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7435. // for more information.
  7436. func (c *NotificationsUpdateCall) Fields(s ...googleapi.Field) *NotificationsUpdateCall {
  7437. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7438. return c
  7439. }
  7440. // Context sets the context to be used in this call's Do method. Any
  7441. // pending HTTP request will be aborted if the provided context is
  7442. // canceled.
  7443. func (c *NotificationsUpdateCall) Context(ctx context.Context) *NotificationsUpdateCall {
  7444. c.ctx_ = ctx
  7445. return c
  7446. }
  7447. func (c *NotificationsUpdateCall) doRequest(alt string) (*http.Response, error) {
  7448. var body io.Reader = nil
  7449. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notification)
  7450. if err != nil {
  7451. return nil, err
  7452. }
  7453. ctype := "application/json"
  7454. c.urlParams_.Set("alt", alt)
  7455. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications/{notificationId}")
  7456. urls += "?" + c.urlParams_.Encode()
  7457. req, _ := http.NewRequest("PUT", urls, body)
  7458. googleapi.Expand(req.URL, map[string]string{
  7459. "customer": c.customer,
  7460. "notificationId": c.notificationId,
  7461. })
  7462. req.Header.Set("Content-Type", ctype)
  7463. req.Header.Set("User-Agent", c.s.userAgent())
  7464. if c.ctx_ != nil {
  7465. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7466. }
  7467. return c.s.client.Do(req)
  7468. }
  7469. // Do executes the "directory.notifications.update" call.
  7470. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  7471. // status code is an error. Response headers are in either
  7472. // *Notification.ServerResponse.Header or (if a response was returned at
  7473. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7474. // to check whether the returned error was because
  7475. // http.StatusNotModified was returned.
  7476. func (c *NotificationsUpdateCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  7477. gensupport.SetOptions(c.urlParams_, opts...)
  7478. res, err := c.doRequest("json")
  7479. if res != nil && res.StatusCode == http.StatusNotModified {
  7480. if res.Body != nil {
  7481. res.Body.Close()
  7482. }
  7483. return nil, &googleapi.Error{
  7484. Code: res.StatusCode,
  7485. Header: res.Header,
  7486. }
  7487. }
  7488. if err != nil {
  7489. return nil, err
  7490. }
  7491. defer googleapi.CloseBody(res)
  7492. if err := googleapi.CheckResponse(res); err != nil {
  7493. return nil, err
  7494. }
  7495. ret := &Notification{
  7496. ServerResponse: googleapi.ServerResponse{
  7497. Header: res.Header,
  7498. HTTPStatusCode: res.StatusCode,
  7499. },
  7500. }
  7501. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7502. return nil, err
  7503. }
  7504. return ret, nil
  7505. // {
  7506. // "description": "Updates a notification.",
  7507. // "httpMethod": "PUT",
  7508. // "id": "directory.notifications.update",
  7509. // "parameterOrder": [
  7510. // "customer",
  7511. // "notificationId"
  7512. // ],
  7513. // "parameters": {
  7514. // "customer": {
  7515. // "description": "The unique ID for the customer's Google account.",
  7516. // "location": "path",
  7517. // "required": true,
  7518. // "type": "string"
  7519. // },
  7520. // "notificationId": {
  7521. // "description": "The unique ID of the notification.",
  7522. // "location": "path",
  7523. // "required": true,
  7524. // "type": "string"
  7525. // }
  7526. // },
  7527. // "path": "customer/{customer}/notifications/{notificationId}",
  7528. // "request": {
  7529. // "$ref": "Notification"
  7530. // },
  7531. // "response": {
  7532. // "$ref": "Notification"
  7533. // },
  7534. // "scopes": [
  7535. // "https://www.googleapis.com/auth/admin.directory.notifications"
  7536. // ]
  7537. // }
  7538. }
  7539. // method id "directory.orgunits.delete":
  7540. type OrgunitsDeleteCall struct {
  7541. s *Service
  7542. customerId string
  7543. orgUnitPath []string
  7544. urlParams_ gensupport.URLParams
  7545. ctx_ context.Context
  7546. }
  7547. // Delete: Remove Organization Unit
  7548. func (r *OrgunitsService) Delete(customerId string, orgUnitPath []string) *OrgunitsDeleteCall {
  7549. c := &OrgunitsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7550. c.customerId = customerId
  7551. c.orgUnitPath = append([]string{}, orgUnitPath...)
  7552. return c
  7553. }
  7554. // Fields allows partial responses to be retrieved. See
  7555. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7556. // for more information.
  7557. func (c *OrgunitsDeleteCall) Fields(s ...googleapi.Field) *OrgunitsDeleteCall {
  7558. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7559. return c
  7560. }
  7561. // Context sets the context to be used in this call's Do method. Any
  7562. // pending HTTP request will be aborted if the provided context is
  7563. // canceled.
  7564. func (c *OrgunitsDeleteCall) Context(ctx context.Context) *OrgunitsDeleteCall {
  7565. c.ctx_ = ctx
  7566. return c
  7567. }
  7568. func (c *OrgunitsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7569. var body io.Reader = nil
  7570. c.urlParams_.Set("alt", alt)
  7571. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits{/orgUnitPath*}")
  7572. urls += "?" + c.urlParams_.Encode()
  7573. req, _ := http.NewRequest("DELETE", urls, body)
  7574. googleapi.Expand(req.URL, map[string]string{
  7575. "customerId": c.customerId,
  7576. "orgUnitPath": c.orgUnitPath[0],
  7577. })
  7578. req.Header.Set("User-Agent", c.s.userAgent())
  7579. if c.ctx_ != nil {
  7580. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7581. }
  7582. return c.s.client.Do(req)
  7583. }
  7584. // Do executes the "directory.orgunits.delete" call.
  7585. func (c *OrgunitsDeleteCall) Do(opts ...googleapi.CallOption) error {
  7586. gensupport.SetOptions(c.urlParams_, opts...)
  7587. res, err := c.doRequest("json")
  7588. if err != nil {
  7589. return err
  7590. }
  7591. defer googleapi.CloseBody(res)
  7592. if err := googleapi.CheckResponse(res); err != nil {
  7593. return err
  7594. }
  7595. return nil
  7596. // {
  7597. // "description": "Remove Organization Unit",
  7598. // "httpMethod": "DELETE",
  7599. // "id": "directory.orgunits.delete",
  7600. // "parameterOrder": [
  7601. // "customerId",
  7602. // "orgUnitPath"
  7603. // ],
  7604. // "parameters": {
  7605. // "customerId": {
  7606. // "description": "Immutable id of the Google Apps account",
  7607. // "location": "path",
  7608. // "required": true,
  7609. // "type": "string"
  7610. // },
  7611. // "orgUnitPath": {
  7612. // "description": "Full path of the organization unit or its Id",
  7613. // "location": "path",
  7614. // "repeated": true,
  7615. // "required": true,
  7616. // "type": "string"
  7617. // }
  7618. // },
  7619. // "path": "customer/{customerId}/orgunits{/orgUnitPath*}",
  7620. // "scopes": [
  7621. // "https://www.googleapis.com/auth/admin.directory.orgunit"
  7622. // ]
  7623. // }
  7624. }
  7625. // method id "directory.orgunits.get":
  7626. type OrgunitsGetCall struct {
  7627. s *Service
  7628. customerId string
  7629. orgUnitPath []string
  7630. urlParams_ gensupport.URLParams
  7631. ifNoneMatch_ string
  7632. ctx_ context.Context
  7633. }
  7634. // Get: Retrieve Organization Unit
  7635. func (r *OrgunitsService) Get(customerId string, orgUnitPath []string) *OrgunitsGetCall {
  7636. c := &OrgunitsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7637. c.customerId = customerId
  7638. c.orgUnitPath = append([]string{}, orgUnitPath...)
  7639. return c
  7640. }
  7641. // Fields allows partial responses to be retrieved. See
  7642. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7643. // for more information.
  7644. func (c *OrgunitsGetCall) Fields(s ...googleapi.Field) *OrgunitsGetCall {
  7645. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7646. return c
  7647. }
  7648. // IfNoneMatch sets the optional parameter which makes the operation
  7649. // fail if the object's ETag matches the given value. This is useful for
  7650. // getting updates only after the object has changed since the last
  7651. // request. Use googleapi.IsNotModified to check whether the response
  7652. // error from Do is the result of In-None-Match.
  7653. func (c *OrgunitsGetCall) IfNoneMatch(entityTag string) *OrgunitsGetCall {
  7654. c.ifNoneMatch_ = entityTag
  7655. return c
  7656. }
  7657. // Context sets the context to be used in this call's Do method. Any
  7658. // pending HTTP request will be aborted if the provided context is
  7659. // canceled.
  7660. func (c *OrgunitsGetCall) Context(ctx context.Context) *OrgunitsGetCall {
  7661. c.ctx_ = ctx
  7662. return c
  7663. }
  7664. func (c *OrgunitsGetCall) doRequest(alt string) (*http.Response, error) {
  7665. var body io.Reader = nil
  7666. c.urlParams_.Set("alt", alt)
  7667. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits{/orgUnitPath*}")
  7668. urls += "?" + c.urlParams_.Encode()
  7669. req, _ := http.NewRequest("GET", urls, body)
  7670. googleapi.Expand(req.URL, map[string]string{
  7671. "customerId": c.customerId,
  7672. "orgUnitPath": c.orgUnitPath[0],
  7673. })
  7674. req.Header.Set("User-Agent", c.s.userAgent())
  7675. if c.ifNoneMatch_ != "" {
  7676. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  7677. }
  7678. if c.ctx_ != nil {
  7679. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7680. }
  7681. return c.s.client.Do(req)
  7682. }
  7683. // Do executes the "directory.orgunits.get" call.
  7684. // Exactly one of *OrgUnit or error will be non-nil. Any non-2xx status
  7685. // code is an error. Response headers are in either
  7686. // *OrgUnit.ServerResponse.Header or (if a response was returned at all)
  7687. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7688. // check whether the returned error was because http.StatusNotModified
  7689. // was returned.
  7690. func (c *OrgunitsGetCall) Do(opts ...googleapi.CallOption) (*OrgUnit, error) {
  7691. gensupport.SetOptions(c.urlParams_, opts...)
  7692. res, err := c.doRequest("json")
  7693. if res != nil && res.StatusCode == http.StatusNotModified {
  7694. if res.Body != nil {
  7695. res.Body.Close()
  7696. }
  7697. return nil, &googleapi.Error{
  7698. Code: res.StatusCode,
  7699. Header: res.Header,
  7700. }
  7701. }
  7702. if err != nil {
  7703. return nil, err
  7704. }
  7705. defer googleapi.CloseBody(res)
  7706. if err := googleapi.CheckResponse(res); err != nil {
  7707. return nil, err
  7708. }
  7709. ret := &OrgUnit{
  7710. ServerResponse: googleapi.ServerResponse{
  7711. Header: res.Header,
  7712. HTTPStatusCode: res.StatusCode,
  7713. },
  7714. }
  7715. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7716. return nil, err
  7717. }
  7718. return ret, nil
  7719. // {
  7720. // "description": "Retrieve Organization Unit",
  7721. // "httpMethod": "GET",
  7722. // "id": "directory.orgunits.get",
  7723. // "parameterOrder": [
  7724. // "customerId",
  7725. // "orgUnitPath"
  7726. // ],
  7727. // "parameters": {
  7728. // "customerId": {
  7729. // "description": "Immutable id of the Google Apps account",
  7730. // "location": "path",
  7731. // "required": true,
  7732. // "type": "string"
  7733. // },
  7734. // "orgUnitPath": {
  7735. // "description": "Full path of the organization unit or its Id",
  7736. // "location": "path",
  7737. // "repeated": true,
  7738. // "required": true,
  7739. // "type": "string"
  7740. // }
  7741. // },
  7742. // "path": "customer/{customerId}/orgunits{/orgUnitPath*}",
  7743. // "response": {
  7744. // "$ref": "OrgUnit"
  7745. // },
  7746. // "scopes": [
  7747. // "https://www.googleapis.com/auth/admin.directory.orgunit",
  7748. // "https://www.googleapis.com/auth/admin.directory.orgunit.readonly"
  7749. // ]
  7750. // }
  7751. }
  7752. // method id "directory.orgunits.insert":
  7753. type OrgunitsInsertCall struct {
  7754. s *Service
  7755. customerId string
  7756. orgunit *OrgUnit
  7757. urlParams_ gensupport.URLParams
  7758. ctx_ context.Context
  7759. }
  7760. // Insert: Add Organization Unit
  7761. func (r *OrgunitsService) Insert(customerId string, orgunit *OrgUnit) *OrgunitsInsertCall {
  7762. c := &OrgunitsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7763. c.customerId = customerId
  7764. c.orgunit = orgunit
  7765. return c
  7766. }
  7767. // Fields allows partial responses to be retrieved. See
  7768. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7769. // for more information.
  7770. func (c *OrgunitsInsertCall) Fields(s ...googleapi.Field) *OrgunitsInsertCall {
  7771. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7772. return c
  7773. }
  7774. // Context sets the context to be used in this call's Do method. Any
  7775. // pending HTTP request will be aborted if the provided context is
  7776. // canceled.
  7777. func (c *OrgunitsInsertCall) Context(ctx context.Context) *OrgunitsInsertCall {
  7778. c.ctx_ = ctx
  7779. return c
  7780. }
  7781. func (c *OrgunitsInsertCall) doRequest(alt string) (*http.Response, error) {
  7782. var body io.Reader = nil
  7783. body, err := googleapi.WithoutDataWrapper.JSONReader(c.orgunit)
  7784. if err != nil {
  7785. return nil, err
  7786. }
  7787. ctype := "application/json"
  7788. c.urlParams_.Set("alt", alt)
  7789. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits")
  7790. urls += "?" + c.urlParams_.Encode()
  7791. req, _ := http.NewRequest("POST", urls, body)
  7792. googleapi.Expand(req.URL, map[string]string{
  7793. "customerId": c.customerId,
  7794. })
  7795. req.Header.Set("Content-Type", ctype)
  7796. req.Header.Set("User-Agent", c.s.userAgent())
  7797. if c.ctx_ != nil {
  7798. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7799. }
  7800. return c.s.client.Do(req)
  7801. }
  7802. // Do executes the "directory.orgunits.insert" call.
  7803. // Exactly one of *OrgUnit or error will be non-nil. Any non-2xx status
  7804. // code is an error. Response headers are in either
  7805. // *OrgUnit.ServerResponse.Header or (if a response was returned at all)
  7806. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7807. // check whether the returned error was because http.StatusNotModified
  7808. // was returned.
  7809. func (c *OrgunitsInsertCall) Do(opts ...googleapi.CallOption) (*OrgUnit, error) {
  7810. gensupport.SetOptions(c.urlParams_, opts...)
  7811. res, err := c.doRequest("json")
  7812. if res != nil && res.StatusCode == http.StatusNotModified {
  7813. if res.Body != nil {
  7814. res.Body.Close()
  7815. }
  7816. return nil, &googleapi.Error{
  7817. Code: res.StatusCode,
  7818. Header: res.Header,
  7819. }
  7820. }
  7821. if err != nil {
  7822. return nil, err
  7823. }
  7824. defer googleapi.CloseBody(res)
  7825. if err := googleapi.CheckResponse(res); err != nil {
  7826. return nil, err
  7827. }
  7828. ret := &OrgUnit{
  7829. ServerResponse: googleapi.ServerResponse{
  7830. Header: res.Header,
  7831. HTTPStatusCode: res.StatusCode,
  7832. },
  7833. }
  7834. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7835. return nil, err
  7836. }
  7837. return ret, nil
  7838. // {
  7839. // "description": "Add Organization Unit",
  7840. // "httpMethod": "POST",
  7841. // "id": "directory.orgunits.insert",
  7842. // "parameterOrder": [
  7843. // "customerId"
  7844. // ],
  7845. // "parameters": {
  7846. // "customerId": {
  7847. // "description": "Immutable id of the Google Apps account",
  7848. // "location": "path",
  7849. // "required": true,
  7850. // "type": "string"
  7851. // }
  7852. // },
  7853. // "path": "customer/{customerId}/orgunits",
  7854. // "request": {
  7855. // "$ref": "OrgUnit"
  7856. // },
  7857. // "response": {
  7858. // "$ref": "OrgUnit"
  7859. // },
  7860. // "scopes": [
  7861. // "https://www.googleapis.com/auth/admin.directory.orgunit"
  7862. // ]
  7863. // }
  7864. }
  7865. // method id "directory.orgunits.list":
  7866. type OrgunitsListCall struct {
  7867. s *Service
  7868. customerId string
  7869. urlParams_ gensupport.URLParams
  7870. ifNoneMatch_ string
  7871. ctx_ context.Context
  7872. }
  7873. // List: Retrieve all Organization Units
  7874. func (r *OrgunitsService) List(customerId string) *OrgunitsListCall {
  7875. c := &OrgunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7876. c.customerId = customerId
  7877. return c
  7878. }
  7879. // OrgUnitPath sets the optional parameter "orgUnitPath": the
  7880. // URL-encoded organization unit's path or its Id
  7881. func (c *OrgunitsListCall) OrgUnitPath(orgUnitPath string) *OrgunitsListCall {
  7882. c.urlParams_.Set("orgUnitPath", orgUnitPath)
  7883. return c
  7884. }
  7885. // Type sets the optional parameter "type": Whether to return all
  7886. // sub-organizations or just immediate children
  7887. //
  7888. // Possible values:
  7889. // "all" - All sub-organization units.
  7890. // "children" - Immediate children only (default).
  7891. func (c *OrgunitsListCall) Type(type_ string) *OrgunitsListCall {
  7892. c.urlParams_.Set("type", type_)
  7893. return c
  7894. }
  7895. // Fields allows partial responses to be retrieved. See
  7896. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7897. // for more information.
  7898. func (c *OrgunitsListCall) Fields(s ...googleapi.Field) *OrgunitsListCall {
  7899. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7900. return c
  7901. }
  7902. // IfNoneMatch sets the optional parameter which makes the operation
  7903. // fail if the object's ETag matches the given value. This is useful for
  7904. // getting updates only after the object has changed since the last
  7905. // request. Use googleapi.IsNotModified to check whether the response
  7906. // error from Do is the result of In-None-Match.
  7907. func (c *OrgunitsListCall) IfNoneMatch(entityTag string) *OrgunitsListCall {
  7908. c.ifNoneMatch_ = entityTag
  7909. return c
  7910. }
  7911. // Context sets the context to be used in this call's Do method. Any
  7912. // pending HTTP request will be aborted if the provided context is
  7913. // canceled.
  7914. func (c *OrgunitsListCall) Context(ctx context.Context) *OrgunitsListCall {
  7915. c.ctx_ = ctx
  7916. return c
  7917. }
  7918. func (c *OrgunitsListCall) doRequest(alt string) (*http.Response, error) {
  7919. var body io.Reader = nil
  7920. c.urlParams_.Set("alt", alt)
  7921. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits")
  7922. urls += "?" + c.urlParams_.Encode()
  7923. req, _ := http.NewRequest("GET", urls, body)
  7924. googleapi.Expand(req.URL, map[string]string{
  7925. "customerId": c.customerId,
  7926. })
  7927. req.Header.Set("User-Agent", c.s.userAgent())
  7928. if c.ifNoneMatch_ != "" {
  7929. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  7930. }
  7931. if c.ctx_ != nil {
  7932. return ctxhttp.Do(c.ctx_, c.s.client, req)
  7933. }
  7934. return c.s.client.Do(req)
  7935. }
  7936. // Do executes the "directory.orgunits.list" call.
  7937. // Exactly one of *OrgUnits or error will be non-nil. Any non-2xx status
  7938. // code is an error. Response headers are in either
  7939. // *OrgUnits.ServerResponse.Header or (if a response was returned at
  7940. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7941. // to check whether the returned error was because
  7942. // http.StatusNotModified was returned.
  7943. func (c *OrgunitsListCall) Do(opts ...googleapi.CallOption) (*OrgUnits, error) {
  7944. gensupport.SetOptions(c.urlParams_, opts...)
  7945. res, err := c.doRequest("json")
  7946. if res != nil && res.StatusCode == http.StatusNotModified {
  7947. if res.Body != nil {
  7948. res.Body.Close()
  7949. }
  7950. return nil, &googleapi.Error{
  7951. Code: res.StatusCode,
  7952. Header: res.Header,
  7953. }
  7954. }
  7955. if err != nil {
  7956. return nil, err
  7957. }
  7958. defer googleapi.CloseBody(res)
  7959. if err := googleapi.CheckResponse(res); err != nil {
  7960. return nil, err
  7961. }
  7962. ret := &OrgUnits{
  7963. ServerResponse: googleapi.ServerResponse{
  7964. Header: res.Header,
  7965. HTTPStatusCode: res.StatusCode,
  7966. },
  7967. }
  7968. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  7969. return nil, err
  7970. }
  7971. return ret, nil
  7972. // {
  7973. // "description": "Retrieve all Organization Units",
  7974. // "httpMethod": "GET",
  7975. // "id": "directory.orgunits.list",
  7976. // "parameterOrder": [
  7977. // "customerId"
  7978. // ],
  7979. // "parameters": {
  7980. // "customerId": {
  7981. // "description": "Immutable id of the Google Apps account",
  7982. // "location": "path",
  7983. // "required": true,
  7984. // "type": "string"
  7985. // },
  7986. // "orgUnitPath": {
  7987. // "default": "",
  7988. // "description": "the URL-encoded organization unit's path or its Id",
  7989. // "location": "query",
  7990. // "type": "string"
  7991. // },
  7992. // "type": {
  7993. // "description": "Whether to return all sub-organizations or just immediate children",
  7994. // "enum": [
  7995. // "all",
  7996. // "children"
  7997. // ],
  7998. // "enumDescriptions": [
  7999. // "All sub-organization units.",
  8000. // "Immediate children only (default)."
  8001. // ],
  8002. // "location": "query",
  8003. // "type": "string"
  8004. // }
  8005. // },
  8006. // "path": "customer/{customerId}/orgunits",
  8007. // "response": {
  8008. // "$ref": "OrgUnits"
  8009. // },
  8010. // "scopes": [
  8011. // "https://www.googleapis.com/auth/admin.directory.orgunit",
  8012. // "https://www.googleapis.com/auth/admin.directory.orgunit.readonly"
  8013. // ]
  8014. // }
  8015. }
  8016. // method id "directory.orgunits.patch":
  8017. type OrgunitsPatchCall struct {
  8018. s *Service
  8019. customerId string
  8020. orgUnitPath []string
  8021. orgunit *OrgUnit
  8022. urlParams_ gensupport.URLParams
  8023. ctx_ context.Context
  8024. }
  8025. // Patch: Update Organization Unit. This method supports patch
  8026. // semantics.
  8027. func (r *OrgunitsService) Patch(customerId string, orgUnitPath []string, orgunit *OrgUnit) *OrgunitsPatchCall {
  8028. c := &OrgunitsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8029. c.customerId = customerId
  8030. c.orgUnitPath = append([]string{}, orgUnitPath...)
  8031. c.orgunit = orgunit
  8032. return c
  8033. }
  8034. // Fields allows partial responses to be retrieved. See
  8035. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8036. // for more information.
  8037. func (c *OrgunitsPatchCall) Fields(s ...googleapi.Field) *OrgunitsPatchCall {
  8038. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8039. return c
  8040. }
  8041. // Context sets the context to be used in this call's Do method. Any
  8042. // pending HTTP request will be aborted if the provided context is
  8043. // canceled.
  8044. func (c *OrgunitsPatchCall) Context(ctx context.Context) *OrgunitsPatchCall {
  8045. c.ctx_ = ctx
  8046. return c
  8047. }
  8048. func (c *OrgunitsPatchCall) doRequest(alt string) (*http.Response, error) {
  8049. var body io.Reader = nil
  8050. body, err := googleapi.WithoutDataWrapper.JSONReader(c.orgunit)
  8051. if err != nil {
  8052. return nil, err
  8053. }
  8054. ctype := "application/json"
  8055. c.urlParams_.Set("alt", alt)
  8056. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits{/orgUnitPath*}")
  8057. urls += "?" + c.urlParams_.Encode()
  8058. req, _ := http.NewRequest("PATCH", urls, body)
  8059. googleapi.Expand(req.URL, map[string]string{
  8060. "customerId": c.customerId,
  8061. "orgUnitPath": c.orgUnitPath[0],
  8062. })
  8063. req.Header.Set("Content-Type", ctype)
  8064. req.Header.Set("User-Agent", c.s.userAgent())
  8065. if c.ctx_ != nil {
  8066. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8067. }
  8068. return c.s.client.Do(req)
  8069. }
  8070. // Do executes the "directory.orgunits.patch" call.
  8071. // Exactly one of *OrgUnit or error will be non-nil. Any non-2xx status
  8072. // code is an error. Response headers are in either
  8073. // *OrgUnit.ServerResponse.Header or (if a response was returned at all)
  8074. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8075. // check whether the returned error was because http.StatusNotModified
  8076. // was returned.
  8077. func (c *OrgunitsPatchCall) Do(opts ...googleapi.CallOption) (*OrgUnit, error) {
  8078. gensupport.SetOptions(c.urlParams_, opts...)
  8079. res, err := c.doRequest("json")
  8080. if res != nil && res.StatusCode == http.StatusNotModified {
  8081. if res.Body != nil {
  8082. res.Body.Close()
  8083. }
  8084. return nil, &googleapi.Error{
  8085. Code: res.StatusCode,
  8086. Header: res.Header,
  8087. }
  8088. }
  8089. if err != nil {
  8090. return nil, err
  8091. }
  8092. defer googleapi.CloseBody(res)
  8093. if err := googleapi.CheckResponse(res); err != nil {
  8094. return nil, err
  8095. }
  8096. ret := &OrgUnit{
  8097. ServerResponse: googleapi.ServerResponse{
  8098. Header: res.Header,
  8099. HTTPStatusCode: res.StatusCode,
  8100. },
  8101. }
  8102. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  8103. return nil, err
  8104. }
  8105. return ret, nil
  8106. // {
  8107. // "description": "Update Organization Unit. This method supports patch semantics.",
  8108. // "httpMethod": "PATCH",
  8109. // "id": "directory.orgunits.patch",
  8110. // "parameterOrder": [
  8111. // "customerId",
  8112. // "orgUnitPath"
  8113. // ],
  8114. // "parameters": {
  8115. // "customerId": {
  8116. // "description": "Immutable id of the Google Apps account",
  8117. // "location": "path",
  8118. // "required": true,
  8119. // "type": "string"
  8120. // },
  8121. // "orgUnitPath": {
  8122. // "description": "Full path of the organization unit or its Id",
  8123. // "location": "path",
  8124. // "repeated": true,
  8125. // "required": true,
  8126. // "type": "string"
  8127. // }
  8128. // },
  8129. // "path": "customer/{customerId}/orgunits{/orgUnitPath*}",
  8130. // "request": {
  8131. // "$ref": "OrgUnit"
  8132. // },
  8133. // "response": {
  8134. // "$ref": "OrgUnit"
  8135. // },
  8136. // "scopes": [
  8137. // "https://www.googleapis.com/auth/admin.directory.orgunit"
  8138. // ]
  8139. // }
  8140. }
  8141. // method id "directory.orgunits.update":
  8142. type OrgunitsUpdateCall struct {
  8143. s *Service
  8144. customerId string
  8145. orgUnitPath []string
  8146. orgunit *OrgUnit
  8147. urlParams_ gensupport.URLParams
  8148. ctx_ context.Context
  8149. }
  8150. // Update: Update Organization Unit
  8151. func (r *OrgunitsService) Update(customerId string, orgUnitPath []string, orgunit *OrgUnit) *OrgunitsUpdateCall {
  8152. c := &OrgunitsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8153. c.customerId = customerId
  8154. c.orgUnitPath = append([]string{}, orgUnitPath...)
  8155. c.orgunit = orgunit
  8156. return c
  8157. }
  8158. // Fields allows partial responses to be retrieved. See
  8159. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8160. // for more information.
  8161. func (c *OrgunitsUpdateCall) Fields(s ...googleapi.Field) *OrgunitsUpdateCall {
  8162. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8163. return c
  8164. }
  8165. // Context sets the context to be used in this call's Do method. Any
  8166. // pending HTTP request will be aborted if the provided context is
  8167. // canceled.
  8168. func (c *OrgunitsUpdateCall) Context(ctx context.Context) *OrgunitsUpdateCall {
  8169. c.ctx_ = ctx
  8170. return c
  8171. }
  8172. func (c *OrgunitsUpdateCall) doRequest(alt string) (*http.Response, error) {
  8173. var body io.Reader = nil
  8174. body, err := googleapi.WithoutDataWrapper.JSONReader(c.orgunit)
  8175. if err != nil {
  8176. return nil, err
  8177. }
  8178. ctype := "application/json"
  8179. c.urlParams_.Set("alt", alt)
  8180. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits{/orgUnitPath*}")
  8181. urls += "?" + c.urlParams_.Encode()
  8182. req, _ := http.NewRequest("PUT", urls, body)
  8183. googleapi.Expand(req.URL, map[string]string{
  8184. "customerId": c.customerId,
  8185. "orgUnitPath": c.orgUnitPath[0],
  8186. })
  8187. req.Header.Set("Content-Type", ctype)
  8188. req.Header.Set("User-Agent", c.s.userAgent())
  8189. if c.ctx_ != nil {
  8190. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8191. }
  8192. return c.s.client.Do(req)
  8193. }
  8194. // Do executes the "directory.orgunits.update" call.
  8195. // Exactly one of *OrgUnit or error will be non-nil. Any non-2xx status
  8196. // code is an error. Response headers are in either
  8197. // *OrgUnit.ServerResponse.Header or (if a response was returned at all)
  8198. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8199. // check whether the returned error was because http.StatusNotModified
  8200. // was returned.
  8201. func (c *OrgunitsUpdateCall) Do(opts ...googleapi.CallOption) (*OrgUnit, error) {
  8202. gensupport.SetOptions(c.urlParams_, opts...)
  8203. res, err := c.doRequest("json")
  8204. if res != nil && res.StatusCode == http.StatusNotModified {
  8205. if res.Body != nil {
  8206. res.Body.Close()
  8207. }
  8208. return nil, &googleapi.Error{
  8209. Code: res.StatusCode,
  8210. Header: res.Header,
  8211. }
  8212. }
  8213. if err != nil {
  8214. return nil, err
  8215. }
  8216. defer googleapi.CloseBody(res)
  8217. if err := googleapi.CheckResponse(res); err != nil {
  8218. return nil, err
  8219. }
  8220. ret := &OrgUnit{
  8221. ServerResponse: googleapi.ServerResponse{
  8222. Header: res.Header,
  8223. HTTPStatusCode: res.StatusCode,
  8224. },
  8225. }
  8226. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  8227. return nil, err
  8228. }
  8229. return ret, nil
  8230. // {
  8231. // "description": "Update Organization Unit",
  8232. // "httpMethod": "PUT",
  8233. // "id": "directory.orgunits.update",
  8234. // "parameterOrder": [
  8235. // "customerId",
  8236. // "orgUnitPath"
  8237. // ],
  8238. // "parameters": {
  8239. // "customerId": {
  8240. // "description": "Immutable id of the Google Apps account",
  8241. // "location": "path",
  8242. // "required": true,
  8243. // "type": "string"
  8244. // },
  8245. // "orgUnitPath": {
  8246. // "description": "Full path of the organization unit or its Id",
  8247. // "location": "path",
  8248. // "repeated": true,
  8249. // "required": true,
  8250. // "type": "string"
  8251. // }
  8252. // },
  8253. // "path": "customer/{customerId}/orgunits{/orgUnitPath*}",
  8254. // "request": {
  8255. // "$ref": "OrgUnit"
  8256. // },
  8257. // "response": {
  8258. // "$ref": "OrgUnit"
  8259. // },
  8260. // "scopes": [
  8261. // "https://www.googleapis.com/auth/admin.directory.orgunit"
  8262. // ]
  8263. // }
  8264. }
  8265. // method id "directory.privileges.list":
  8266. type PrivilegesListCall struct {
  8267. s *Service
  8268. customer string
  8269. urlParams_ gensupport.URLParams
  8270. ifNoneMatch_ string
  8271. ctx_ context.Context
  8272. }
  8273. // List: Retrieves a paginated list of all privileges for a customer.
  8274. func (r *PrivilegesService) List(customer string) *PrivilegesListCall {
  8275. c := &PrivilegesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8276. c.customer = customer
  8277. return c
  8278. }
  8279. // Fields allows partial responses to be retrieved. See
  8280. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8281. // for more information.
  8282. func (c *PrivilegesListCall) Fields(s ...googleapi.Field) *PrivilegesListCall {
  8283. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8284. return c
  8285. }
  8286. // IfNoneMatch sets the optional parameter which makes the operation
  8287. // fail if the object's ETag matches the given value. This is useful for
  8288. // getting updates only after the object has changed since the last
  8289. // request. Use googleapi.IsNotModified to check whether the response
  8290. // error from Do is the result of In-None-Match.
  8291. func (c *PrivilegesListCall) IfNoneMatch(entityTag string) *PrivilegesListCall {
  8292. c.ifNoneMatch_ = entityTag
  8293. return c
  8294. }
  8295. // Context sets the context to be used in this call's Do method. Any
  8296. // pending HTTP request will be aborted if the provided context is
  8297. // canceled.
  8298. func (c *PrivilegesListCall) Context(ctx context.Context) *PrivilegesListCall {
  8299. c.ctx_ = ctx
  8300. return c
  8301. }
  8302. func (c *PrivilegesListCall) doRequest(alt string) (*http.Response, error) {
  8303. var body io.Reader = nil
  8304. c.urlParams_.Set("alt", alt)
  8305. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/ALL/privileges")
  8306. urls += "?" + c.urlParams_.Encode()
  8307. req, _ := http.NewRequest("GET", urls, body)
  8308. googleapi.Expand(req.URL, map[string]string{
  8309. "customer": c.customer,
  8310. })
  8311. req.Header.Set("User-Agent", c.s.userAgent())
  8312. if c.ifNoneMatch_ != "" {
  8313. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  8314. }
  8315. if c.ctx_ != nil {
  8316. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8317. }
  8318. return c.s.client.Do(req)
  8319. }
  8320. // Do executes the "directory.privileges.list" call.
  8321. // Exactly one of *Privileges or error will be non-nil. Any non-2xx
  8322. // status code is an error. Response headers are in either
  8323. // *Privileges.ServerResponse.Header or (if a response was returned at
  8324. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8325. // to check whether the returned error was because
  8326. // http.StatusNotModified was returned.
  8327. func (c *PrivilegesListCall) Do(opts ...googleapi.CallOption) (*Privileges, error) {
  8328. gensupport.SetOptions(c.urlParams_, opts...)
  8329. res, err := c.doRequest("json")
  8330. if res != nil && res.StatusCode == http.StatusNotModified {
  8331. if res.Body != nil {
  8332. res.Body.Close()
  8333. }
  8334. return nil, &googleapi.Error{
  8335. Code: res.StatusCode,
  8336. Header: res.Header,
  8337. }
  8338. }
  8339. if err != nil {
  8340. return nil, err
  8341. }
  8342. defer googleapi.CloseBody(res)
  8343. if err := googleapi.CheckResponse(res); err != nil {
  8344. return nil, err
  8345. }
  8346. ret := &Privileges{
  8347. ServerResponse: googleapi.ServerResponse{
  8348. Header: res.Header,
  8349. HTTPStatusCode: res.StatusCode,
  8350. },
  8351. }
  8352. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  8353. return nil, err
  8354. }
  8355. return ret, nil
  8356. // {
  8357. // "description": "Retrieves a paginated list of all privileges for a customer.",
  8358. // "httpMethod": "GET",
  8359. // "id": "directory.privileges.list",
  8360. // "parameterOrder": [
  8361. // "customer"
  8362. // ],
  8363. // "parameters": {
  8364. // "customer": {
  8365. // "description": "Immutable ID of the Google Apps account.",
  8366. // "location": "path",
  8367. // "required": true,
  8368. // "type": "string"
  8369. // }
  8370. // },
  8371. // "path": "customer/{customer}/roles/ALL/privileges",
  8372. // "response": {
  8373. // "$ref": "Privileges"
  8374. // },
  8375. // "scopes": [
  8376. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  8377. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  8378. // ]
  8379. // }
  8380. }
  8381. // method id "directory.resources.calendars.delete":
  8382. type ResourcesCalendarsDeleteCall struct {
  8383. s *Service
  8384. customer string
  8385. calendarResourceId string
  8386. urlParams_ gensupport.URLParams
  8387. ctx_ context.Context
  8388. }
  8389. // Delete: Deletes a calendar resource.
  8390. func (r *ResourcesCalendarsService) Delete(customer string, calendarResourceId string) *ResourcesCalendarsDeleteCall {
  8391. c := &ResourcesCalendarsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8392. c.customer = customer
  8393. c.calendarResourceId = calendarResourceId
  8394. return c
  8395. }
  8396. // Fields allows partial responses to be retrieved. See
  8397. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8398. // for more information.
  8399. func (c *ResourcesCalendarsDeleteCall) Fields(s ...googleapi.Field) *ResourcesCalendarsDeleteCall {
  8400. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8401. return c
  8402. }
  8403. // Context sets the context to be used in this call's Do method. Any
  8404. // pending HTTP request will be aborted if the provided context is
  8405. // canceled.
  8406. func (c *ResourcesCalendarsDeleteCall) Context(ctx context.Context) *ResourcesCalendarsDeleteCall {
  8407. c.ctx_ = ctx
  8408. return c
  8409. }
  8410. func (c *ResourcesCalendarsDeleteCall) doRequest(alt string) (*http.Response, error) {
  8411. var body io.Reader = nil
  8412. c.urlParams_.Set("alt", alt)
  8413. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars/{calendarResourceId}")
  8414. urls += "?" + c.urlParams_.Encode()
  8415. req, _ := http.NewRequest("DELETE", urls, body)
  8416. googleapi.Expand(req.URL, map[string]string{
  8417. "customer": c.customer,
  8418. "calendarResourceId": c.calendarResourceId,
  8419. })
  8420. req.Header.Set("User-Agent", c.s.userAgent())
  8421. if c.ctx_ != nil {
  8422. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8423. }
  8424. return c.s.client.Do(req)
  8425. }
  8426. // Do executes the "directory.resources.calendars.delete" call.
  8427. func (c *ResourcesCalendarsDeleteCall) Do(opts ...googleapi.CallOption) error {
  8428. gensupport.SetOptions(c.urlParams_, opts...)
  8429. res, err := c.doRequest("json")
  8430. if err != nil {
  8431. return err
  8432. }
  8433. defer googleapi.CloseBody(res)
  8434. if err := googleapi.CheckResponse(res); err != nil {
  8435. return err
  8436. }
  8437. return nil
  8438. // {
  8439. // "description": "Deletes a calendar resource.",
  8440. // "httpMethod": "DELETE",
  8441. // "id": "directory.resources.calendars.delete",
  8442. // "parameterOrder": [
  8443. // "customer",
  8444. // "calendarResourceId"
  8445. // ],
  8446. // "parameters": {
  8447. // "calendarResourceId": {
  8448. // "description": "The unique ID of the calendar resource to delete.",
  8449. // "location": "path",
  8450. // "required": true,
  8451. // "type": "string"
  8452. // },
  8453. // "customer": {
  8454. // "description": "The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  8455. // "location": "path",
  8456. // "required": true,
  8457. // "type": "string"
  8458. // }
  8459. // },
  8460. // "path": "customer/{customer}/resources/calendars/{calendarResourceId}",
  8461. // "scopes": [
  8462. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  8463. // ]
  8464. // }
  8465. }
  8466. // method id "directory.resources.calendars.get":
  8467. type ResourcesCalendarsGetCall struct {
  8468. s *Service
  8469. customer string
  8470. calendarResourceId string
  8471. urlParams_ gensupport.URLParams
  8472. ifNoneMatch_ string
  8473. ctx_ context.Context
  8474. }
  8475. // Get: Retrieves a calendar resource.
  8476. func (r *ResourcesCalendarsService) Get(customer string, calendarResourceId string) *ResourcesCalendarsGetCall {
  8477. c := &ResourcesCalendarsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8478. c.customer = customer
  8479. c.calendarResourceId = calendarResourceId
  8480. return c
  8481. }
  8482. // Fields allows partial responses to be retrieved. See
  8483. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8484. // for more information.
  8485. func (c *ResourcesCalendarsGetCall) Fields(s ...googleapi.Field) *ResourcesCalendarsGetCall {
  8486. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8487. return c
  8488. }
  8489. // IfNoneMatch sets the optional parameter which makes the operation
  8490. // fail if the object's ETag matches the given value. This is useful for
  8491. // getting updates only after the object has changed since the last
  8492. // request. Use googleapi.IsNotModified to check whether the response
  8493. // error from Do is the result of In-None-Match.
  8494. func (c *ResourcesCalendarsGetCall) IfNoneMatch(entityTag string) *ResourcesCalendarsGetCall {
  8495. c.ifNoneMatch_ = entityTag
  8496. return c
  8497. }
  8498. // Context sets the context to be used in this call's Do method. Any
  8499. // pending HTTP request will be aborted if the provided context is
  8500. // canceled.
  8501. func (c *ResourcesCalendarsGetCall) Context(ctx context.Context) *ResourcesCalendarsGetCall {
  8502. c.ctx_ = ctx
  8503. return c
  8504. }
  8505. func (c *ResourcesCalendarsGetCall) doRequest(alt string) (*http.Response, error) {
  8506. var body io.Reader = nil
  8507. c.urlParams_.Set("alt", alt)
  8508. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars/{calendarResourceId}")
  8509. urls += "?" + c.urlParams_.Encode()
  8510. req, _ := http.NewRequest("GET", urls, body)
  8511. googleapi.Expand(req.URL, map[string]string{
  8512. "customer": c.customer,
  8513. "calendarResourceId": c.calendarResourceId,
  8514. })
  8515. req.Header.Set("User-Agent", c.s.userAgent())
  8516. if c.ifNoneMatch_ != "" {
  8517. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  8518. }
  8519. if c.ctx_ != nil {
  8520. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8521. }
  8522. return c.s.client.Do(req)
  8523. }
  8524. // Do executes the "directory.resources.calendars.get" call.
  8525. // Exactly one of *CalendarResource or error will be non-nil. Any
  8526. // non-2xx status code is an error. Response headers are in either
  8527. // *CalendarResource.ServerResponse.Header or (if a response was
  8528. // returned at all) in error.(*googleapi.Error).Header. Use
  8529. // googleapi.IsNotModified to check whether the returned error was
  8530. // because http.StatusNotModified was returned.
  8531. func (c *ResourcesCalendarsGetCall) Do(opts ...googleapi.CallOption) (*CalendarResource, error) {
  8532. gensupport.SetOptions(c.urlParams_, opts...)
  8533. res, err := c.doRequest("json")
  8534. if res != nil && res.StatusCode == http.StatusNotModified {
  8535. if res.Body != nil {
  8536. res.Body.Close()
  8537. }
  8538. return nil, &googleapi.Error{
  8539. Code: res.StatusCode,
  8540. Header: res.Header,
  8541. }
  8542. }
  8543. if err != nil {
  8544. return nil, err
  8545. }
  8546. defer googleapi.CloseBody(res)
  8547. if err := googleapi.CheckResponse(res); err != nil {
  8548. return nil, err
  8549. }
  8550. ret := &CalendarResource{
  8551. ServerResponse: googleapi.ServerResponse{
  8552. Header: res.Header,
  8553. HTTPStatusCode: res.StatusCode,
  8554. },
  8555. }
  8556. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  8557. return nil, err
  8558. }
  8559. return ret, nil
  8560. // {
  8561. // "description": "Retrieves a calendar resource.",
  8562. // "httpMethod": "GET",
  8563. // "id": "directory.resources.calendars.get",
  8564. // "parameterOrder": [
  8565. // "customer",
  8566. // "calendarResourceId"
  8567. // ],
  8568. // "parameters": {
  8569. // "calendarResourceId": {
  8570. // "description": "The unique ID of the calendar resource to retrieve.",
  8571. // "location": "path",
  8572. // "required": true,
  8573. // "type": "string"
  8574. // },
  8575. // "customer": {
  8576. // "description": "The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  8577. // "location": "path",
  8578. // "required": true,
  8579. // "type": "string"
  8580. // }
  8581. // },
  8582. // "path": "customer/{customer}/resources/calendars/{calendarResourceId}",
  8583. // "response": {
  8584. // "$ref": "CalendarResource"
  8585. // },
  8586. // "scopes": [
  8587. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  8588. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  8589. // ]
  8590. // }
  8591. }
  8592. // method id "directory.resources.calendars.insert":
  8593. type ResourcesCalendarsInsertCall struct {
  8594. s *Service
  8595. customer string
  8596. calendarresource *CalendarResource
  8597. urlParams_ gensupport.URLParams
  8598. ctx_ context.Context
  8599. }
  8600. // Insert: Inserts a calendar resource.
  8601. func (r *ResourcesCalendarsService) Insert(customer string, calendarresource *CalendarResource) *ResourcesCalendarsInsertCall {
  8602. c := &ResourcesCalendarsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8603. c.customer = customer
  8604. c.calendarresource = calendarresource
  8605. return c
  8606. }
  8607. // Fields allows partial responses to be retrieved. See
  8608. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8609. // for more information.
  8610. func (c *ResourcesCalendarsInsertCall) Fields(s ...googleapi.Field) *ResourcesCalendarsInsertCall {
  8611. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8612. return c
  8613. }
  8614. // Context sets the context to be used in this call's Do method. Any
  8615. // pending HTTP request will be aborted if the provided context is
  8616. // canceled.
  8617. func (c *ResourcesCalendarsInsertCall) Context(ctx context.Context) *ResourcesCalendarsInsertCall {
  8618. c.ctx_ = ctx
  8619. return c
  8620. }
  8621. func (c *ResourcesCalendarsInsertCall) doRequest(alt string) (*http.Response, error) {
  8622. var body io.Reader = nil
  8623. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendarresource)
  8624. if err != nil {
  8625. return nil, err
  8626. }
  8627. ctype := "application/json"
  8628. c.urlParams_.Set("alt", alt)
  8629. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars")
  8630. urls += "?" + c.urlParams_.Encode()
  8631. req, _ := http.NewRequest("POST", urls, body)
  8632. googleapi.Expand(req.URL, map[string]string{
  8633. "customer": c.customer,
  8634. })
  8635. req.Header.Set("Content-Type", ctype)
  8636. req.Header.Set("User-Agent", c.s.userAgent())
  8637. if c.ctx_ != nil {
  8638. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8639. }
  8640. return c.s.client.Do(req)
  8641. }
  8642. // Do executes the "directory.resources.calendars.insert" call.
  8643. // Exactly one of *CalendarResource or error will be non-nil. Any
  8644. // non-2xx status code is an error. Response headers are in either
  8645. // *CalendarResource.ServerResponse.Header or (if a response was
  8646. // returned at all) in error.(*googleapi.Error).Header. Use
  8647. // googleapi.IsNotModified to check whether the returned error was
  8648. // because http.StatusNotModified was returned.
  8649. func (c *ResourcesCalendarsInsertCall) Do(opts ...googleapi.CallOption) (*CalendarResource, error) {
  8650. gensupport.SetOptions(c.urlParams_, opts...)
  8651. res, err := c.doRequest("json")
  8652. if res != nil && res.StatusCode == http.StatusNotModified {
  8653. if res.Body != nil {
  8654. res.Body.Close()
  8655. }
  8656. return nil, &googleapi.Error{
  8657. Code: res.StatusCode,
  8658. Header: res.Header,
  8659. }
  8660. }
  8661. if err != nil {
  8662. return nil, err
  8663. }
  8664. defer googleapi.CloseBody(res)
  8665. if err := googleapi.CheckResponse(res); err != nil {
  8666. return nil, err
  8667. }
  8668. ret := &CalendarResource{
  8669. ServerResponse: googleapi.ServerResponse{
  8670. Header: res.Header,
  8671. HTTPStatusCode: res.StatusCode,
  8672. },
  8673. }
  8674. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  8675. return nil, err
  8676. }
  8677. return ret, nil
  8678. // {
  8679. // "description": "Inserts a calendar resource.",
  8680. // "httpMethod": "POST",
  8681. // "id": "directory.resources.calendars.insert",
  8682. // "parameterOrder": [
  8683. // "customer"
  8684. // ],
  8685. // "parameters": {
  8686. // "customer": {
  8687. // "description": "The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  8688. // "location": "path",
  8689. // "required": true,
  8690. // "type": "string"
  8691. // }
  8692. // },
  8693. // "path": "customer/{customer}/resources/calendars",
  8694. // "request": {
  8695. // "$ref": "CalendarResource"
  8696. // },
  8697. // "response": {
  8698. // "$ref": "CalendarResource"
  8699. // },
  8700. // "scopes": [
  8701. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  8702. // ]
  8703. // }
  8704. }
  8705. // method id "directory.resources.calendars.list":
  8706. type ResourcesCalendarsListCall struct {
  8707. s *Service
  8708. customer string
  8709. urlParams_ gensupport.URLParams
  8710. ifNoneMatch_ string
  8711. ctx_ context.Context
  8712. }
  8713. // List: Retrieves a list of calendar resources for an account.
  8714. func (r *ResourcesCalendarsService) List(customer string) *ResourcesCalendarsListCall {
  8715. c := &ResourcesCalendarsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8716. c.customer = customer
  8717. return c
  8718. }
  8719. // MaxResults sets the optional parameter "maxResults": Maximum number
  8720. // of results to return.
  8721. func (c *ResourcesCalendarsListCall) MaxResults(maxResults int64) *ResourcesCalendarsListCall {
  8722. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  8723. return c
  8724. }
  8725. // PageToken sets the optional parameter "pageToken": Token to specify
  8726. // the next page in the list.
  8727. func (c *ResourcesCalendarsListCall) PageToken(pageToken string) *ResourcesCalendarsListCall {
  8728. c.urlParams_.Set("pageToken", pageToken)
  8729. return c
  8730. }
  8731. // Fields allows partial responses to be retrieved. See
  8732. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8733. // for more information.
  8734. func (c *ResourcesCalendarsListCall) Fields(s ...googleapi.Field) *ResourcesCalendarsListCall {
  8735. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8736. return c
  8737. }
  8738. // IfNoneMatch sets the optional parameter which makes the operation
  8739. // fail if the object's ETag matches the given value. This is useful for
  8740. // getting updates only after the object has changed since the last
  8741. // request. Use googleapi.IsNotModified to check whether the response
  8742. // error from Do is the result of In-None-Match.
  8743. func (c *ResourcesCalendarsListCall) IfNoneMatch(entityTag string) *ResourcesCalendarsListCall {
  8744. c.ifNoneMatch_ = entityTag
  8745. return c
  8746. }
  8747. // Context sets the context to be used in this call's Do method. Any
  8748. // pending HTTP request will be aborted if the provided context is
  8749. // canceled.
  8750. func (c *ResourcesCalendarsListCall) Context(ctx context.Context) *ResourcesCalendarsListCall {
  8751. c.ctx_ = ctx
  8752. return c
  8753. }
  8754. func (c *ResourcesCalendarsListCall) doRequest(alt string) (*http.Response, error) {
  8755. var body io.Reader = nil
  8756. c.urlParams_.Set("alt", alt)
  8757. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars")
  8758. urls += "?" + c.urlParams_.Encode()
  8759. req, _ := http.NewRequest("GET", urls, body)
  8760. googleapi.Expand(req.URL, map[string]string{
  8761. "customer": c.customer,
  8762. })
  8763. req.Header.Set("User-Agent", c.s.userAgent())
  8764. if c.ifNoneMatch_ != "" {
  8765. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  8766. }
  8767. if c.ctx_ != nil {
  8768. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8769. }
  8770. return c.s.client.Do(req)
  8771. }
  8772. // Do executes the "directory.resources.calendars.list" call.
  8773. // Exactly one of *CalendarResources or error will be non-nil. Any
  8774. // non-2xx status code is an error. Response headers are in either
  8775. // *CalendarResources.ServerResponse.Header or (if a response was
  8776. // returned at all) in error.(*googleapi.Error).Header. Use
  8777. // googleapi.IsNotModified to check whether the returned error was
  8778. // because http.StatusNotModified was returned.
  8779. func (c *ResourcesCalendarsListCall) Do(opts ...googleapi.CallOption) (*CalendarResources, error) {
  8780. gensupport.SetOptions(c.urlParams_, opts...)
  8781. res, err := c.doRequest("json")
  8782. if res != nil && res.StatusCode == http.StatusNotModified {
  8783. if res.Body != nil {
  8784. res.Body.Close()
  8785. }
  8786. return nil, &googleapi.Error{
  8787. Code: res.StatusCode,
  8788. Header: res.Header,
  8789. }
  8790. }
  8791. if err != nil {
  8792. return nil, err
  8793. }
  8794. defer googleapi.CloseBody(res)
  8795. if err := googleapi.CheckResponse(res); err != nil {
  8796. return nil, err
  8797. }
  8798. ret := &CalendarResources{
  8799. ServerResponse: googleapi.ServerResponse{
  8800. Header: res.Header,
  8801. HTTPStatusCode: res.StatusCode,
  8802. },
  8803. }
  8804. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  8805. return nil, err
  8806. }
  8807. return ret, nil
  8808. // {
  8809. // "description": "Retrieves a list of calendar resources for an account.",
  8810. // "httpMethod": "GET",
  8811. // "id": "directory.resources.calendars.list",
  8812. // "parameterOrder": [
  8813. // "customer"
  8814. // ],
  8815. // "parameters": {
  8816. // "customer": {
  8817. // "description": "The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  8818. // "location": "path",
  8819. // "required": true,
  8820. // "type": "string"
  8821. // },
  8822. // "maxResults": {
  8823. // "description": "Maximum number of results to return.",
  8824. // "format": "int32",
  8825. // "location": "query",
  8826. // "maximum": "500",
  8827. // "minimum": "1",
  8828. // "type": "integer"
  8829. // },
  8830. // "pageToken": {
  8831. // "description": "Token to specify the next page in the list.",
  8832. // "location": "query",
  8833. // "type": "string"
  8834. // }
  8835. // },
  8836. // "path": "customer/{customer}/resources/calendars",
  8837. // "response": {
  8838. // "$ref": "CalendarResources"
  8839. // },
  8840. // "scopes": [
  8841. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  8842. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  8843. // ]
  8844. // }
  8845. }
  8846. // Pages invokes f for each page of results.
  8847. // A non-nil error returned from f will halt the iteration.
  8848. // The provided context supersedes any context provided to the Context method.
  8849. func (c *ResourcesCalendarsListCall) Pages(ctx context.Context, f func(*CalendarResources) error) error {
  8850. c.ctx_ = ctx
  8851. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8852. for {
  8853. x, err := c.Do()
  8854. if err != nil {
  8855. return err
  8856. }
  8857. if err := f(x); err != nil {
  8858. return err
  8859. }
  8860. if x.NextPageToken == "" {
  8861. return nil
  8862. }
  8863. c.PageToken(x.NextPageToken)
  8864. }
  8865. }
  8866. // method id "directory.resources.calendars.patch":
  8867. type ResourcesCalendarsPatchCall struct {
  8868. s *Service
  8869. customer string
  8870. calendarResourceId string
  8871. calendarresource *CalendarResource
  8872. urlParams_ gensupport.URLParams
  8873. ctx_ context.Context
  8874. }
  8875. // Patch: Updates a calendar resource. This method supports patch
  8876. // semantics.
  8877. func (r *ResourcesCalendarsService) Patch(customer string, calendarResourceId string, calendarresource *CalendarResource) *ResourcesCalendarsPatchCall {
  8878. c := &ResourcesCalendarsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8879. c.customer = customer
  8880. c.calendarResourceId = calendarResourceId
  8881. c.calendarresource = calendarresource
  8882. return c
  8883. }
  8884. // Fields allows partial responses to be retrieved. See
  8885. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8886. // for more information.
  8887. func (c *ResourcesCalendarsPatchCall) Fields(s ...googleapi.Field) *ResourcesCalendarsPatchCall {
  8888. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8889. return c
  8890. }
  8891. // Context sets the context to be used in this call's Do method. Any
  8892. // pending HTTP request will be aborted if the provided context is
  8893. // canceled.
  8894. func (c *ResourcesCalendarsPatchCall) Context(ctx context.Context) *ResourcesCalendarsPatchCall {
  8895. c.ctx_ = ctx
  8896. return c
  8897. }
  8898. func (c *ResourcesCalendarsPatchCall) doRequest(alt string) (*http.Response, error) {
  8899. var body io.Reader = nil
  8900. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendarresource)
  8901. if err != nil {
  8902. return nil, err
  8903. }
  8904. ctype := "application/json"
  8905. c.urlParams_.Set("alt", alt)
  8906. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars/{calendarResourceId}")
  8907. urls += "?" + c.urlParams_.Encode()
  8908. req, _ := http.NewRequest("PATCH", urls, body)
  8909. googleapi.Expand(req.URL, map[string]string{
  8910. "customer": c.customer,
  8911. "calendarResourceId": c.calendarResourceId,
  8912. })
  8913. req.Header.Set("Content-Type", ctype)
  8914. req.Header.Set("User-Agent", c.s.userAgent())
  8915. if c.ctx_ != nil {
  8916. return ctxhttp.Do(c.ctx_, c.s.client, req)
  8917. }
  8918. return c.s.client.Do(req)
  8919. }
  8920. // Do executes the "directory.resources.calendars.patch" call.
  8921. // Exactly one of *CalendarResource or error will be non-nil. Any
  8922. // non-2xx status code is an error. Response headers are in either
  8923. // *CalendarResource.ServerResponse.Header or (if a response was
  8924. // returned at all) in error.(*googleapi.Error).Header. Use
  8925. // googleapi.IsNotModified to check whether the returned error was
  8926. // because http.StatusNotModified was returned.
  8927. func (c *ResourcesCalendarsPatchCall) Do(opts ...googleapi.CallOption) (*CalendarResource, error) {
  8928. gensupport.SetOptions(c.urlParams_, opts...)
  8929. res, err := c.doRequest("json")
  8930. if res != nil && res.StatusCode == http.StatusNotModified {
  8931. if res.Body != nil {
  8932. res.Body.Close()
  8933. }
  8934. return nil, &googleapi.Error{
  8935. Code: res.StatusCode,
  8936. Header: res.Header,
  8937. }
  8938. }
  8939. if err != nil {
  8940. return nil, err
  8941. }
  8942. defer googleapi.CloseBody(res)
  8943. if err := googleapi.CheckResponse(res); err != nil {
  8944. return nil, err
  8945. }
  8946. ret := &CalendarResource{
  8947. ServerResponse: googleapi.ServerResponse{
  8948. Header: res.Header,
  8949. HTTPStatusCode: res.StatusCode,
  8950. },
  8951. }
  8952. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  8953. return nil, err
  8954. }
  8955. return ret, nil
  8956. // {
  8957. // "description": "Updates a calendar resource. This method supports patch semantics.",
  8958. // "httpMethod": "PATCH",
  8959. // "id": "directory.resources.calendars.patch",
  8960. // "parameterOrder": [
  8961. // "customer",
  8962. // "calendarResourceId"
  8963. // ],
  8964. // "parameters": {
  8965. // "calendarResourceId": {
  8966. // "description": "The unique ID of the calendar resource to update.",
  8967. // "location": "path",
  8968. // "required": true,
  8969. // "type": "string"
  8970. // },
  8971. // "customer": {
  8972. // "description": "The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  8973. // "location": "path",
  8974. // "required": true,
  8975. // "type": "string"
  8976. // }
  8977. // },
  8978. // "path": "customer/{customer}/resources/calendars/{calendarResourceId}",
  8979. // "request": {
  8980. // "$ref": "CalendarResource"
  8981. // },
  8982. // "response": {
  8983. // "$ref": "CalendarResource"
  8984. // },
  8985. // "scopes": [
  8986. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  8987. // ]
  8988. // }
  8989. }
  8990. // method id "directory.resources.calendars.update":
  8991. type ResourcesCalendarsUpdateCall struct {
  8992. s *Service
  8993. customer string
  8994. calendarResourceId string
  8995. calendarresource *CalendarResource
  8996. urlParams_ gensupport.URLParams
  8997. ctx_ context.Context
  8998. }
  8999. // Update: Updates a calendar resource.
  9000. func (r *ResourcesCalendarsService) Update(customer string, calendarResourceId string, calendarresource *CalendarResource) *ResourcesCalendarsUpdateCall {
  9001. c := &ResourcesCalendarsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9002. c.customer = customer
  9003. c.calendarResourceId = calendarResourceId
  9004. c.calendarresource = calendarresource
  9005. return c
  9006. }
  9007. // Fields allows partial responses to be retrieved. See
  9008. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9009. // for more information.
  9010. func (c *ResourcesCalendarsUpdateCall) Fields(s ...googleapi.Field) *ResourcesCalendarsUpdateCall {
  9011. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9012. return c
  9013. }
  9014. // Context sets the context to be used in this call's Do method. Any
  9015. // pending HTTP request will be aborted if the provided context is
  9016. // canceled.
  9017. func (c *ResourcesCalendarsUpdateCall) Context(ctx context.Context) *ResourcesCalendarsUpdateCall {
  9018. c.ctx_ = ctx
  9019. return c
  9020. }
  9021. func (c *ResourcesCalendarsUpdateCall) doRequest(alt string) (*http.Response, error) {
  9022. var body io.Reader = nil
  9023. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendarresource)
  9024. if err != nil {
  9025. return nil, err
  9026. }
  9027. ctype := "application/json"
  9028. c.urlParams_.Set("alt", alt)
  9029. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars/{calendarResourceId}")
  9030. urls += "?" + c.urlParams_.Encode()
  9031. req, _ := http.NewRequest("PUT", urls, body)
  9032. googleapi.Expand(req.URL, map[string]string{
  9033. "customer": c.customer,
  9034. "calendarResourceId": c.calendarResourceId,
  9035. })
  9036. req.Header.Set("Content-Type", ctype)
  9037. req.Header.Set("User-Agent", c.s.userAgent())
  9038. if c.ctx_ != nil {
  9039. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9040. }
  9041. return c.s.client.Do(req)
  9042. }
  9043. // Do executes the "directory.resources.calendars.update" call.
  9044. // Exactly one of *CalendarResource or error will be non-nil. Any
  9045. // non-2xx status code is an error. Response headers are in either
  9046. // *CalendarResource.ServerResponse.Header or (if a response was
  9047. // returned at all) in error.(*googleapi.Error).Header. Use
  9048. // googleapi.IsNotModified to check whether the returned error was
  9049. // because http.StatusNotModified was returned.
  9050. func (c *ResourcesCalendarsUpdateCall) Do(opts ...googleapi.CallOption) (*CalendarResource, error) {
  9051. gensupport.SetOptions(c.urlParams_, opts...)
  9052. res, err := c.doRequest("json")
  9053. if res != nil && res.StatusCode == http.StatusNotModified {
  9054. if res.Body != nil {
  9055. res.Body.Close()
  9056. }
  9057. return nil, &googleapi.Error{
  9058. Code: res.StatusCode,
  9059. Header: res.Header,
  9060. }
  9061. }
  9062. if err != nil {
  9063. return nil, err
  9064. }
  9065. defer googleapi.CloseBody(res)
  9066. if err := googleapi.CheckResponse(res); err != nil {
  9067. return nil, err
  9068. }
  9069. ret := &CalendarResource{
  9070. ServerResponse: googleapi.ServerResponse{
  9071. Header: res.Header,
  9072. HTTPStatusCode: res.StatusCode,
  9073. },
  9074. }
  9075. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  9076. return nil, err
  9077. }
  9078. return ret, nil
  9079. // {
  9080. // "description": "Updates a calendar resource.",
  9081. // "httpMethod": "PUT",
  9082. // "id": "directory.resources.calendars.update",
  9083. // "parameterOrder": [
  9084. // "customer",
  9085. // "calendarResourceId"
  9086. // ],
  9087. // "parameters": {
  9088. // "calendarResourceId": {
  9089. // "description": "The unique ID of the calendar resource to update.",
  9090. // "location": "path",
  9091. // "required": true,
  9092. // "type": "string"
  9093. // },
  9094. // "customer": {
  9095. // "description": "The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  9096. // "location": "path",
  9097. // "required": true,
  9098. // "type": "string"
  9099. // }
  9100. // },
  9101. // "path": "customer/{customer}/resources/calendars/{calendarResourceId}",
  9102. // "request": {
  9103. // "$ref": "CalendarResource"
  9104. // },
  9105. // "response": {
  9106. // "$ref": "CalendarResource"
  9107. // },
  9108. // "scopes": [
  9109. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  9110. // ]
  9111. // }
  9112. }
  9113. // method id "directory.roleAssignments.delete":
  9114. type RoleAssignmentsDeleteCall struct {
  9115. s *Service
  9116. customer string
  9117. roleAssignmentId string
  9118. urlParams_ gensupport.URLParams
  9119. ctx_ context.Context
  9120. }
  9121. // Delete: Deletes a role assignment.
  9122. func (r *RoleAssignmentsService) Delete(customer string, roleAssignmentId string) *RoleAssignmentsDeleteCall {
  9123. c := &RoleAssignmentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9124. c.customer = customer
  9125. c.roleAssignmentId = roleAssignmentId
  9126. return c
  9127. }
  9128. // Fields allows partial responses to be retrieved. See
  9129. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9130. // for more information.
  9131. func (c *RoleAssignmentsDeleteCall) Fields(s ...googleapi.Field) *RoleAssignmentsDeleteCall {
  9132. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9133. return c
  9134. }
  9135. // Context sets the context to be used in this call's Do method. Any
  9136. // pending HTTP request will be aborted if the provided context is
  9137. // canceled.
  9138. func (c *RoleAssignmentsDeleteCall) Context(ctx context.Context) *RoleAssignmentsDeleteCall {
  9139. c.ctx_ = ctx
  9140. return c
  9141. }
  9142. func (c *RoleAssignmentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9143. var body io.Reader = nil
  9144. c.urlParams_.Set("alt", alt)
  9145. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roleassignments/{roleAssignmentId}")
  9146. urls += "?" + c.urlParams_.Encode()
  9147. req, _ := http.NewRequest("DELETE", urls, body)
  9148. googleapi.Expand(req.URL, map[string]string{
  9149. "customer": c.customer,
  9150. "roleAssignmentId": c.roleAssignmentId,
  9151. })
  9152. req.Header.Set("User-Agent", c.s.userAgent())
  9153. if c.ctx_ != nil {
  9154. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9155. }
  9156. return c.s.client.Do(req)
  9157. }
  9158. // Do executes the "directory.roleAssignments.delete" call.
  9159. func (c *RoleAssignmentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  9160. gensupport.SetOptions(c.urlParams_, opts...)
  9161. res, err := c.doRequest("json")
  9162. if err != nil {
  9163. return err
  9164. }
  9165. defer googleapi.CloseBody(res)
  9166. if err := googleapi.CheckResponse(res); err != nil {
  9167. return err
  9168. }
  9169. return nil
  9170. // {
  9171. // "description": "Deletes a role assignment.",
  9172. // "httpMethod": "DELETE",
  9173. // "id": "directory.roleAssignments.delete",
  9174. // "parameterOrder": [
  9175. // "customer",
  9176. // "roleAssignmentId"
  9177. // ],
  9178. // "parameters": {
  9179. // "customer": {
  9180. // "description": "Immutable ID of the Google Apps account.",
  9181. // "location": "path",
  9182. // "required": true,
  9183. // "type": "string"
  9184. // },
  9185. // "roleAssignmentId": {
  9186. // "description": "Immutable ID of the role assignment.",
  9187. // "location": "path",
  9188. // "required": true,
  9189. // "type": "string"
  9190. // }
  9191. // },
  9192. // "path": "customer/{customer}/roleassignments/{roleAssignmentId}",
  9193. // "scopes": [
  9194. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  9195. // ]
  9196. // }
  9197. }
  9198. // method id "directory.roleAssignments.get":
  9199. type RoleAssignmentsGetCall struct {
  9200. s *Service
  9201. customer string
  9202. roleAssignmentId string
  9203. urlParams_ gensupport.URLParams
  9204. ifNoneMatch_ string
  9205. ctx_ context.Context
  9206. }
  9207. // Get: Retrieve a role assignment.
  9208. func (r *RoleAssignmentsService) Get(customer string, roleAssignmentId string) *RoleAssignmentsGetCall {
  9209. c := &RoleAssignmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9210. c.customer = customer
  9211. c.roleAssignmentId = roleAssignmentId
  9212. return c
  9213. }
  9214. // Fields allows partial responses to be retrieved. See
  9215. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9216. // for more information.
  9217. func (c *RoleAssignmentsGetCall) Fields(s ...googleapi.Field) *RoleAssignmentsGetCall {
  9218. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9219. return c
  9220. }
  9221. // IfNoneMatch sets the optional parameter which makes the operation
  9222. // fail if the object's ETag matches the given value. This is useful for
  9223. // getting updates only after the object has changed since the last
  9224. // request. Use googleapi.IsNotModified to check whether the response
  9225. // error from Do is the result of In-None-Match.
  9226. func (c *RoleAssignmentsGetCall) IfNoneMatch(entityTag string) *RoleAssignmentsGetCall {
  9227. c.ifNoneMatch_ = entityTag
  9228. return c
  9229. }
  9230. // Context sets the context to be used in this call's Do method. Any
  9231. // pending HTTP request will be aborted if the provided context is
  9232. // canceled.
  9233. func (c *RoleAssignmentsGetCall) Context(ctx context.Context) *RoleAssignmentsGetCall {
  9234. c.ctx_ = ctx
  9235. return c
  9236. }
  9237. func (c *RoleAssignmentsGetCall) doRequest(alt string) (*http.Response, error) {
  9238. var body io.Reader = nil
  9239. c.urlParams_.Set("alt", alt)
  9240. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roleassignments/{roleAssignmentId}")
  9241. urls += "?" + c.urlParams_.Encode()
  9242. req, _ := http.NewRequest("GET", urls, body)
  9243. googleapi.Expand(req.URL, map[string]string{
  9244. "customer": c.customer,
  9245. "roleAssignmentId": c.roleAssignmentId,
  9246. })
  9247. req.Header.Set("User-Agent", c.s.userAgent())
  9248. if c.ifNoneMatch_ != "" {
  9249. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  9250. }
  9251. if c.ctx_ != nil {
  9252. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9253. }
  9254. return c.s.client.Do(req)
  9255. }
  9256. // Do executes the "directory.roleAssignments.get" call.
  9257. // Exactly one of *RoleAssignment or error will be non-nil. Any non-2xx
  9258. // status code is an error. Response headers are in either
  9259. // *RoleAssignment.ServerResponse.Header or (if a response was returned
  9260. // at all) in error.(*googleapi.Error).Header. Use
  9261. // googleapi.IsNotModified to check whether the returned error was
  9262. // because http.StatusNotModified was returned.
  9263. func (c *RoleAssignmentsGetCall) Do(opts ...googleapi.CallOption) (*RoleAssignment, error) {
  9264. gensupport.SetOptions(c.urlParams_, opts...)
  9265. res, err := c.doRequest("json")
  9266. if res != nil && res.StatusCode == http.StatusNotModified {
  9267. if res.Body != nil {
  9268. res.Body.Close()
  9269. }
  9270. return nil, &googleapi.Error{
  9271. Code: res.StatusCode,
  9272. Header: res.Header,
  9273. }
  9274. }
  9275. if err != nil {
  9276. return nil, err
  9277. }
  9278. defer googleapi.CloseBody(res)
  9279. if err := googleapi.CheckResponse(res); err != nil {
  9280. return nil, err
  9281. }
  9282. ret := &RoleAssignment{
  9283. ServerResponse: googleapi.ServerResponse{
  9284. Header: res.Header,
  9285. HTTPStatusCode: res.StatusCode,
  9286. },
  9287. }
  9288. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  9289. return nil, err
  9290. }
  9291. return ret, nil
  9292. // {
  9293. // "description": "Retrieve a role assignment.",
  9294. // "httpMethod": "GET",
  9295. // "id": "directory.roleAssignments.get",
  9296. // "parameterOrder": [
  9297. // "customer",
  9298. // "roleAssignmentId"
  9299. // ],
  9300. // "parameters": {
  9301. // "customer": {
  9302. // "description": "Immutable ID of the Google Apps account.",
  9303. // "location": "path",
  9304. // "required": true,
  9305. // "type": "string"
  9306. // },
  9307. // "roleAssignmentId": {
  9308. // "description": "Immutable ID of the role assignment.",
  9309. // "location": "path",
  9310. // "required": true,
  9311. // "type": "string"
  9312. // }
  9313. // },
  9314. // "path": "customer/{customer}/roleassignments/{roleAssignmentId}",
  9315. // "response": {
  9316. // "$ref": "RoleAssignment"
  9317. // },
  9318. // "scopes": [
  9319. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  9320. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  9321. // ]
  9322. // }
  9323. }
  9324. // method id "directory.roleAssignments.insert":
  9325. type RoleAssignmentsInsertCall struct {
  9326. s *Service
  9327. customer string
  9328. roleassignment *RoleAssignment
  9329. urlParams_ gensupport.URLParams
  9330. ctx_ context.Context
  9331. }
  9332. // Insert: Creates a role assignment.
  9333. func (r *RoleAssignmentsService) Insert(customer string, roleassignment *RoleAssignment) *RoleAssignmentsInsertCall {
  9334. c := &RoleAssignmentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9335. c.customer = customer
  9336. c.roleassignment = roleassignment
  9337. return c
  9338. }
  9339. // Fields allows partial responses to be retrieved. See
  9340. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9341. // for more information.
  9342. func (c *RoleAssignmentsInsertCall) Fields(s ...googleapi.Field) *RoleAssignmentsInsertCall {
  9343. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9344. return c
  9345. }
  9346. // Context sets the context to be used in this call's Do method. Any
  9347. // pending HTTP request will be aborted if the provided context is
  9348. // canceled.
  9349. func (c *RoleAssignmentsInsertCall) Context(ctx context.Context) *RoleAssignmentsInsertCall {
  9350. c.ctx_ = ctx
  9351. return c
  9352. }
  9353. func (c *RoleAssignmentsInsertCall) doRequest(alt string) (*http.Response, error) {
  9354. var body io.Reader = nil
  9355. body, err := googleapi.WithoutDataWrapper.JSONReader(c.roleassignment)
  9356. if err != nil {
  9357. return nil, err
  9358. }
  9359. ctype := "application/json"
  9360. c.urlParams_.Set("alt", alt)
  9361. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roleassignments")
  9362. urls += "?" + c.urlParams_.Encode()
  9363. req, _ := http.NewRequest("POST", urls, body)
  9364. googleapi.Expand(req.URL, map[string]string{
  9365. "customer": c.customer,
  9366. })
  9367. req.Header.Set("Content-Type", ctype)
  9368. req.Header.Set("User-Agent", c.s.userAgent())
  9369. if c.ctx_ != nil {
  9370. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9371. }
  9372. return c.s.client.Do(req)
  9373. }
  9374. // Do executes the "directory.roleAssignments.insert" call.
  9375. // Exactly one of *RoleAssignment or error will be non-nil. Any non-2xx
  9376. // status code is an error. Response headers are in either
  9377. // *RoleAssignment.ServerResponse.Header or (if a response was returned
  9378. // at all) in error.(*googleapi.Error).Header. Use
  9379. // googleapi.IsNotModified to check whether the returned error was
  9380. // because http.StatusNotModified was returned.
  9381. func (c *RoleAssignmentsInsertCall) Do(opts ...googleapi.CallOption) (*RoleAssignment, error) {
  9382. gensupport.SetOptions(c.urlParams_, opts...)
  9383. res, err := c.doRequest("json")
  9384. if res != nil && res.StatusCode == http.StatusNotModified {
  9385. if res.Body != nil {
  9386. res.Body.Close()
  9387. }
  9388. return nil, &googleapi.Error{
  9389. Code: res.StatusCode,
  9390. Header: res.Header,
  9391. }
  9392. }
  9393. if err != nil {
  9394. return nil, err
  9395. }
  9396. defer googleapi.CloseBody(res)
  9397. if err := googleapi.CheckResponse(res); err != nil {
  9398. return nil, err
  9399. }
  9400. ret := &RoleAssignment{
  9401. ServerResponse: googleapi.ServerResponse{
  9402. Header: res.Header,
  9403. HTTPStatusCode: res.StatusCode,
  9404. },
  9405. }
  9406. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  9407. return nil, err
  9408. }
  9409. return ret, nil
  9410. // {
  9411. // "description": "Creates a role assignment.",
  9412. // "httpMethod": "POST",
  9413. // "id": "directory.roleAssignments.insert",
  9414. // "parameterOrder": [
  9415. // "customer"
  9416. // ],
  9417. // "parameters": {
  9418. // "customer": {
  9419. // "description": "Immutable ID of the Google Apps account.",
  9420. // "location": "path",
  9421. // "required": true,
  9422. // "type": "string"
  9423. // }
  9424. // },
  9425. // "path": "customer/{customer}/roleassignments",
  9426. // "request": {
  9427. // "$ref": "RoleAssignment"
  9428. // },
  9429. // "response": {
  9430. // "$ref": "RoleAssignment"
  9431. // },
  9432. // "scopes": [
  9433. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  9434. // ]
  9435. // }
  9436. }
  9437. // method id "directory.roleAssignments.list":
  9438. type RoleAssignmentsListCall struct {
  9439. s *Service
  9440. customer string
  9441. urlParams_ gensupport.URLParams
  9442. ifNoneMatch_ string
  9443. ctx_ context.Context
  9444. }
  9445. // List: Retrieves a paginated list of all roleAssignments.
  9446. func (r *RoleAssignmentsService) List(customer string) *RoleAssignmentsListCall {
  9447. c := &RoleAssignmentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9448. c.customer = customer
  9449. return c
  9450. }
  9451. // MaxResults sets the optional parameter "maxResults": Maximum number
  9452. // of results to return.
  9453. func (c *RoleAssignmentsListCall) MaxResults(maxResults int64) *RoleAssignmentsListCall {
  9454. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  9455. return c
  9456. }
  9457. // PageToken sets the optional parameter "pageToken": Token to specify
  9458. // the next page in the list.
  9459. func (c *RoleAssignmentsListCall) PageToken(pageToken string) *RoleAssignmentsListCall {
  9460. c.urlParams_.Set("pageToken", pageToken)
  9461. return c
  9462. }
  9463. // RoleId sets the optional parameter "roleId": Immutable ID of a role.
  9464. // If included in the request, returns only role assignments containing
  9465. // this role ID.
  9466. func (c *RoleAssignmentsListCall) RoleId(roleId string) *RoleAssignmentsListCall {
  9467. c.urlParams_.Set("roleId", roleId)
  9468. return c
  9469. }
  9470. // UserKey sets the optional parameter "userKey": The user's primary
  9471. // email address, alias email address, or unique user ID. If included in
  9472. // the request, returns role assignments only for this user.
  9473. func (c *RoleAssignmentsListCall) UserKey(userKey string) *RoleAssignmentsListCall {
  9474. c.urlParams_.Set("userKey", userKey)
  9475. return c
  9476. }
  9477. // Fields allows partial responses to be retrieved. See
  9478. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9479. // for more information.
  9480. func (c *RoleAssignmentsListCall) Fields(s ...googleapi.Field) *RoleAssignmentsListCall {
  9481. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9482. return c
  9483. }
  9484. // IfNoneMatch sets the optional parameter which makes the operation
  9485. // fail if the object's ETag matches the given value. This is useful for
  9486. // getting updates only after the object has changed since the last
  9487. // request. Use googleapi.IsNotModified to check whether the response
  9488. // error from Do is the result of In-None-Match.
  9489. func (c *RoleAssignmentsListCall) IfNoneMatch(entityTag string) *RoleAssignmentsListCall {
  9490. c.ifNoneMatch_ = entityTag
  9491. return c
  9492. }
  9493. // Context sets the context to be used in this call's Do method. Any
  9494. // pending HTTP request will be aborted if the provided context is
  9495. // canceled.
  9496. func (c *RoleAssignmentsListCall) Context(ctx context.Context) *RoleAssignmentsListCall {
  9497. c.ctx_ = ctx
  9498. return c
  9499. }
  9500. func (c *RoleAssignmentsListCall) doRequest(alt string) (*http.Response, error) {
  9501. var body io.Reader = nil
  9502. c.urlParams_.Set("alt", alt)
  9503. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roleassignments")
  9504. urls += "?" + c.urlParams_.Encode()
  9505. req, _ := http.NewRequest("GET", urls, body)
  9506. googleapi.Expand(req.URL, map[string]string{
  9507. "customer": c.customer,
  9508. })
  9509. req.Header.Set("User-Agent", c.s.userAgent())
  9510. if c.ifNoneMatch_ != "" {
  9511. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  9512. }
  9513. if c.ctx_ != nil {
  9514. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9515. }
  9516. return c.s.client.Do(req)
  9517. }
  9518. // Do executes the "directory.roleAssignments.list" call.
  9519. // Exactly one of *RoleAssignments or error will be non-nil. Any non-2xx
  9520. // status code is an error. Response headers are in either
  9521. // *RoleAssignments.ServerResponse.Header or (if a response was returned
  9522. // at all) in error.(*googleapi.Error).Header. Use
  9523. // googleapi.IsNotModified to check whether the returned error was
  9524. // because http.StatusNotModified was returned.
  9525. func (c *RoleAssignmentsListCall) Do(opts ...googleapi.CallOption) (*RoleAssignments, error) {
  9526. gensupport.SetOptions(c.urlParams_, opts...)
  9527. res, err := c.doRequest("json")
  9528. if res != nil && res.StatusCode == http.StatusNotModified {
  9529. if res.Body != nil {
  9530. res.Body.Close()
  9531. }
  9532. return nil, &googleapi.Error{
  9533. Code: res.StatusCode,
  9534. Header: res.Header,
  9535. }
  9536. }
  9537. if err != nil {
  9538. return nil, err
  9539. }
  9540. defer googleapi.CloseBody(res)
  9541. if err := googleapi.CheckResponse(res); err != nil {
  9542. return nil, err
  9543. }
  9544. ret := &RoleAssignments{
  9545. ServerResponse: googleapi.ServerResponse{
  9546. Header: res.Header,
  9547. HTTPStatusCode: res.StatusCode,
  9548. },
  9549. }
  9550. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  9551. return nil, err
  9552. }
  9553. return ret, nil
  9554. // {
  9555. // "description": "Retrieves a paginated list of all roleAssignments.",
  9556. // "httpMethod": "GET",
  9557. // "id": "directory.roleAssignments.list",
  9558. // "parameterOrder": [
  9559. // "customer"
  9560. // ],
  9561. // "parameters": {
  9562. // "customer": {
  9563. // "description": "Immutable ID of the Google Apps account.",
  9564. // "location": "path",
  9565. // "required": true,
  9566. // "type": "string"
  9567. // },
  9568. // "maxResults": {
  9569. // "description": "Maximum number of results to return.",
  9570. // "format": "int32",
  9571. // "location": "query",
  9572. // "maximum": "200",
  9573. // "minimum": "1",
  9574. // "type": "integer"
  9575. // },
  9576. // "pageToken": {
  9577. // "description": "Token to specify the next page in the list.",
  9578. // "location": "query",
  9579. // "type": "string"
  9580. // },
  9581. // "roleId": {
  9582. // "description": "Immutable ID of a role. If included in the request, returns only role assignments containing this role ID.",
  9583. // "location": "query",
  9584. // "type": "string"
  9585. // },
  9586. // "userKey": {
  9587. // "description": "The user's primary email address, alias email address, or unique user ID. If included in the request, returns role assignments only for this user.",
  9588. // "location": "query",
  9589. // "type": "string"
  9590. // }
  9591. // },
  9592. // "path": "customer/{customer}/roleassignments",
  9593. // "response": {
  9594. // "$ref": "RoleAssignments"
  9595. // },
  9596. // "scopes": [
  9597. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  9598. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  9599. // ]
  9600. // }
  9601. }
  9602. // Pages invokes f for each page of results.
  9603. // A non-nil error returned from f will halt the iteration.
  9604. // The provided context supersedes any context provided to the Context method.
  9605. func (c *RoleAssignmentsListCall) Pages(ctx context.Context, f func(*RoleAssignments) error) error {
  9606. c.ctx_ = ctx
  9607. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9608. for {
  9609. x, err := c.Do()
  9610. if err != nil {
  9611. return err
  9612. }
  9613. if err := f(x); err != nil {
  9614. return err
  9615. }
  9616. if x.NextPageToken == "" {
  9617. return nil
  9618. }
  9619. c.PageToken(x.NextPageToken)
  9620. }
  9621. }
  9622. // method id "directory.roles.delete":
  9623. type RolesDeleteCall struct {
  9624. s *Service
  9625. customer string
  9626. roleId string
  9627. urlParams_ gensupport.URLParams
  9628. ctx_ context.Context
  9629. }
  9630. // Delete: Deletes a role.
  9631. func (r *RolesService) Delete(customer string, roleId string) *RolesDeleteCall {
  9632. c := &RolesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9633. c.customer = customer
  9634. c.roleId = roleId
  9635. return c
  9636. }
  9637. // Fields allows partial responses to be retrieved. See
  9638. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9639. // for more information.
  9640. func (c *RolesDeleteCall) Fields(s ...googleapi.Field) *RolesDeleteCall {
  9641. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9642. return c
  9643. }
  9644. // Context sets the context to be used in this call's Do method. Any
  9645. // pending HTTP request will be aborted if the provided context is
  9646. // canceled.
  9647. func (c *RolesDeleteCall) Context(ctx context.Context) *RolesDeleteCall {
  9648. c.ctx_ = ctx
  9649. return c
  9650. }
  9651. func (c *RolesDeleteCall) doRequest(alt string) (*http.Response, error) {
  9652. var body io.Reader = nil
  9653. c.urlParams_.Set("alt", alt)
  9654. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/{roleId}")
  9655. urls += "?" + c.urlParams_.Encode()
  9656. req, _ := http.NewRequest("DELETE", urls, body)
  9657. googleapi.Expand(req.URL, map[string]string{
  9658. "customer": c.customer,
  9659. "roleId": c.roleId,
  9660. })
  9661. req.Header.Set("User-Agent", c.s.userAgent())
  9662. if c.ctx_ != nil {
  9663. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9664. }
  9665. return c.s.client.Do(req)
  9666. }
  9667. // Do executes the "directory.roles.delete" call.
  9668. func (c *RolesDeleteCall) Do(opts ...googleapi.CallOption) error {
  9669. gensupport.SetOptions(c.urlParams_, opts...)
  9670. res, err := c.doRequest("json")
  9671. if err != nil {
  9672. return err
  9673. }
  9674. defer googleapi.CloseBody(res)
  9675. if err := googleapi.CheckResponse(res); err != nil {
  9676. return err
  9677. }
  9678. return nil
  9679. // {
  9680. // "description": "Deletes a role.",
  9681. // "httpMethod": "DELETE",
  9682. // "id": "directory.roles.delete",
  9683. // "parameterOrder": [
  9684. // "customer",
  9685. // "roleId"
  9686. // ],
  9687. // "parameters": {
  9688. // "customer": {
  9689. // "description": "Immutable ID of the Google Apps account.",
  9690. // "location": "path",
  9691. // "required": true,
  9692. // "type": "string"
  9693. // },
  9694. // "roleId": {
  9695. // "description": "Immutable ID of the role.",
  9696. // "location": "path",
  9697. // "required": true,
  9698. // "type": "string"
  9699. // }
  9700. // },
  9701. // "path": "customer/{customer}/roles/{roleId}",
  9702. // "scopes": [
  9703. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  9704. // ]
  9705. // }
  9706. }
  9707. // method id "directory.roles.get":
  9708. type RolesGetCall struct {
  9709. s *Service
  9710. customer string
  9711. roleId string
  9712. urlParams_ gensupport.URLParams
  9713. ifNoneMatch_ string
  9714. ctx_ context.Context
  9715. }
  9716. // Get: Retrieves a role.
  9717. func (r *RolesService) Get(customer string, roleId string) *RolesGetCall {
  9718. c := &RolesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9719. c.customer = customer
  9720. c.roleId = roleId
  9721. return c
  9722. }
  9723. // Fields allows partial responses to be retrieved. See
  9724. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9725. // for more information.
  9726. func (c *RolesGetCall) Fields(s ...googleapi.Field) *RolesGetCall {
  9727. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9728. return c
  9729. }
  9730. // IfNoneMatch sets the optional parameter which makes the operation
  9731. // fail if the object's ETag matches the given value. This is useful for
  9732. // getting updates only after the object has changed since the last
  9733. // request. Use googleapi.IsNotModified to check whether the response
  9734. // error from Do is the result of In-None-Match.
  9735. func (c *RolesGetCall) IfNoneMatch(entityTag string) *RolesGetCall {
  9736. c.ifNoneMatch_ = entityTag
  9737. return c
  9738. }
  9739. // Context sets the context to be used in this call's Do method. Any
  9740. // pending HTTP request will be aborted if the provided context is
  9741. // canceled.
  9742. func (c *RolesGetCall) Context(ctx context.Context) *RolesGetCall {
  9743. c.ctx_ = ctx
  9744. return c
  9745. }
  9746. func (c *RolesGetCall) doRequest(alt string) (*http.Response, error) {
  9747. var body io.Reader = nil
  9748. c.urlParams_.Set("alt", alt)
  9749. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/{roleId}")
  9750. urls += "?" + c.urlParams_.Encode()
  9751. req, _ := http.NewRequest("GET", urls, body)
  9752. googleapi.Expand(req.URL, map[string]string{
  9753. "customer": c.customer,
  9754. "roleId": c.roleId,
  9755. })
  9756. req.Header.Set("User-Agent", c.s.userAgent())
  9757. if c.ifNoneMatch_ != "" {
  9758. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  9759. }
  9760. if c.ctx_ != nil {
  9761. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9762. }
  9763. return c.s.client.Do(req)
  9764. }
  9765. // Do executes the "directory.roles.get" call.
  9766. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  9767. // code is an error. Response headers are in either
  9768. // *Role.ServerResponse.Header or (if a response was returned at all) in
  9769. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  9770. // whether the returned error was because http.StatusNotModified was
  9771. // returned.
  9772. func (c *RolesGetCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  9773. gensupport.SetOptions(c.urlParams_, opts...)
  9774. res, err := c.doRequest("json")
  9775. if res != nil && res.StatusCode == http.StatusNotModified {
  9776. if res.Body != nil {
  9777. res.Body.Close()
  9778. }
  9779. return nil, &googleapi.Error{
  9780. Code: res.StatusCode,
  9781. Header: res.Header,
  9782. }
  9783. }
  9784. if err != nil {
  9785. return nil, err
  9786. }
  9787. defer googleapi.CloseBody(res)
  9788. if err := googleapi.CheckResponse(res); err != nil {
  9789. return nil, err
  9790. }
  9791. ret := &Role{
  9792. ServerResponse: googleapi.ServerResponse{
  9793. Header: res.Header,
  9794. HTTPStatusCode: res.StatusCode,
  9795. },
  9796. }
  9797. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  9798. return nil, err
  9799. }
  9800. return ret, nil
  9801. // {
  9802. // "description": "Retrieves a role.",
  9803. // "httpMethod": "GET",
  9804. // "id": "directory.roles.get",
  9805. // "parameterOrder": [
  9806. // "customer",
  9807. // "roleId"
  9808. // ],
  9809. // "parameters": {
  9810. // "customer": {
  9811. // "description": "Immutable ID of the Google Apps account.",
  9812. // "location": "path",
  9813. // "required": true,
  9814. // "type": "string"
  9815. // },
  9816. // "roleId": {
  9817. // "description": "Immutable ID of the role.",
  9818. // "location": "path",
  9819. // "required": true,
  9820. // "type": "string"
  9821. // }
  9822. // },
  9823. // "path": "customer/{customer}/roles/{roleId}",
  9824. // "response": {
  9825. // "$ref": "Role"
  9826. // },
  9827. // "scopes": [
  9828. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  9829. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  9830. // ]
  9831. // }
  9832. }
  9833. // method id "directory.roles.insert":
  9834. type RolesInsertCall struct {
  9835. s *Service
  9836. customer string
  9837. role *Role
  9838. urlParams_ gensupport.URLParams
  9839. ctx_ context.Context
  9840. }
  9841. // Insert: Creates a role.
  9842. func (r *RolesService) Insert(customer string, role *Role) *RolesInsertCall {
  9843. c := &RolesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9844. c.customer = customer
  9845. c.role = role
  9846. return c
  9847. }
  9848. // Fields allows partial responses to be retrieved. See
  9849. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9850. // for more information.
  9851. func (c *RolesInsertCall) Fields(s ...googleapi.Field) *RolesInsertCall {
  9852. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9853. return c
  9854. }
  9855. // Context sets the context to be used in this call's Do method. Any
  9856. // pending HTTP request will be aborted if the provided context is
  9857. // canceled.
  9858. func (c *RolesInsertCall) Context(ctx context.Context) *RolesInsertCall {
  9859. c.ctx_ = ctx
  9860. return c
  9861. }
  9862. func (c *RolesInsertCall) doRequest(alt string) (*http.Response, error) {
  9863. var body io.Reader = nil
  9864. body, err := googleapi.WithoutDataWrapper.JSONReader(c.role)
  9865. if err != nil {
  9866. return nil, err
  9867. }
  9868. ctype := "application/json"
  9869. c.urlParams_.Set("alt", alt)
  9870. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles")
  9871. urls += "?" + c.urlParams_.Encode()
  9872. req, _ := http.NewRequest("POST", urls, body)
  9873. googleapi.Expand(req.URL, map[string]string{
  9874. "customer": c.customer,
  9875. })
  9876. req.Header.Set("Content-Type", ctype)
  9877. req.Header.Set("User-Agent", c.s.userAgent())
  9878. if c.ctx_ != nil {
  9879. return ctxhttp.Do(c.ctx_, c.s.client, req)
  9880. }
  9881. return c.s.client.Do(req)
  9882. }
  9883. // Do executes the "directory.roles.insert" call.
  9884. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  9885. // code is an error. Response headers are in either
  9886. // *Role.ServerResponse.Header or (if a response was returned at all) in
  9887. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  9888. // whether the returned error was because http.StatusNotModified was
  9889. // returned.
  9890. func (c *RolesInsertCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  9891. gensupport.SetOptions(c.urlParams_, opts...)
  9892. res, err := c.doRequest("json")
  9893. if res != nil && res.StatusCode == http.StatusNotModified {
  9894. if res.Body != nil {
  9895. res.Body.Close()
  9896. }
  9897. return nil, &googleapi.Error{
  9898. Code: res.StatusCode,
  9899. Header: res.Header,
  9900. }
  9901. }
  9902. if err != nil {
  9903. return nil, err
  9904. }
  9905. defer googleapi.CloseBody(res)
  9906. if err := googleapi.CheckResponse(res); err != nil {
  9907. return nil, err
  9908. }
  9909. ret := &Role{
  9910. ServerResponse: googleapi.ServerResponse{
  9911. Header: res.Header,
  9912. HTTPStatusCode: res.StatusCode,
  9913. },
  9914. }
  9915. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  9916. return nil, err
  9917. }
  9918. return ret, nil
  9919. // {
  9920. // "description": "Creates a role.",
  9921. // "httpMethod": "POST",
  9922. // "id": "directory.roles.insert",
  9923. // "parameterOrder": [
  9924. // "customer"
  9925. // ],
  9926. // "parameters": {
  9927. // "customer": {
  9928. // "description": "Immutable ID of the Google Apps account.",
  9929. // "location": "path",
  9930. // "required": true,
  9931. // "type": "string"
  9932. // }
  9933. // },
  9934. // "path": "customer/{customer}/roles",
  9935. // "request": {
  9936. // "$ref": "Role"
  9937. // },
  9938. // "response": {
  9939. // "$ref": "Role"
  9940. // },
  9941. // "scopes": [
  9942. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  9943. // ]
  9944. // }
  9945. }
  9946. // method id "directory.roles.list":
  9947. type RolesListCall struct {
  9948. s *Service
  9949. customer string
  9950. urlParams_ gensupport.URLParams
  9951. ifNoneMatch_ string
  9952. ctx_ context.Context
  9953. }
  9954. // List: Retrieves a paginated list of all the roles in a domain.
  9955. func (r *RolesService) List(customer string) *RolesListCall {
  9956. c := &RolesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9957. c.customer = customer
  9958. return c
  9959. }
  9960. // MaxResults sets the optional parameter "maxResults": Maximum number
  9961. // of results to return.
  9962. func (c *RolesListCall) MaxResults(maxResults int64) *RolesListCall {
  9963. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  9964. return c
  9965. }
  9966. // PageToken sets the optional parameter "pageToken": Token to specify
  9967. // the next page in the list.
  9968. func (c *RolesListCall) PageToken(pageToken string) *RolesListCall {
  9969. c.urlParams_.Set("pageToken", pageToken)
  9970. return c
  9971. }
  9972. // Fields allows partial responses to be retrieved. See
  9973. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9974. // for more information.
  9975. func (c *RolesListCall) Fields(s ...googleapi.Field) *RolesListCall {
  9976. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9977. return c
  9978. }
  9979. // IfNoneMatch sets the optional parameter which makes the operation
  9980. // fail if the object's ETag matches the given value. This is useful for
  9981. // getting updates only after the object has changed since the last
  9982. // request. Use googleapi.IsNotModified to check whether the response
  9983. // error from Do is the result of In-None-Match.
  9984. func (c *RolesListCall) IfNoneMatch(entityTag string) *RolesListCall {
  9985. c.ifNoneMatch_ = entityTag
  9986. return c
  9987. }
  9988. // Context sets the context to be used in this call's Do method. Any
  9989. // pending HTTP request will be aborted if the provided context is
  9990. // canceled.
  9991. func (c *RolesListCall) Context(ctx context.Context) *RolesListCall {
  9992. c.ctx_ = ctx
  9993. return c
  9994. }
  9995. func (c *RolesListCall) doRequest(alt string) (*http.Response, error) {
  9996. var body io.Reader = nil
  9997. c.urlParams_.Set("alt", alt)
  9998. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles")
  9999. urls += "?" + c.urlParams_.Encode()
  10000. req, _ := http.NewRequest("GET", urls, body)
  10001. googleapi.Expand(req.URL, map[string]string{
  10002. "customer": c.customer,
  10003. })
  10004. req.Header.Set("User-Agent", c.s.userAgent())
  10005. if c.ifNoneMatch_ != "" {
  10006. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  10007. }
  10008. if c.ctx_ != nil {
  10009. return ctxhttp.Do(c.ctx_, c.s.client, req)
  10010. }
  10011. return c.s.client.Do(req)
  10012. }
  10013. // Do executes the "directory.roles.list" call.
  10014. // Exactly one of *Roles or error will be non-nil. Any non-2xx status
  10015. // code is an error. Response headers are in either
  10016. // *Roles.ServerResponse.Header or (if a response was returned at all)
  10017. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10018. // check whether the returned error was because http.StatusNotModified
  10019. // was returned.
  10020. func (c *RolesListCall) Do(opts ...googleapi.CallOption) (*Roles, error) {
  10021. gensupport.SetOptions(c.urlParams_, opts...)
  10022. res, err := c.doRequest("json")
  10023. if res != nil && res.StatusCode == http.StatusNotModified {
  10024. if res.Body != nil {
  10025. res.Body.Close()
  10026. }
  10027. return nil, &googleapi.Error{
  10028. Code: res.StatusCode,
  10029. Header: res.Header,
  10030. }
  10031. }
  10032. if err != nil {
  10033. return nil, err
  10034. }
  10035. defer googleapi.CloseBody(res)
  10036. if err := googleapi.CheckResponse(res); err != nil {
  10037. return nil, err
  10038. }
  10039. ret := &Roles{
  10040. ServerResponse: googleapi.ServerResponse{
  10041. Header: res.Header,
  10042. HTTPStatusCode: res.StatusCode,
  10043. },
  10044. }
  10045. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  10046. return nil, err
  10047. }
  10048. return ret, nil
  10049. // {
  10050. // "description": "Retrieves a paginated list of all the roles in a domain.",
  10051. // "httpMethod": "GET",
  10052. // "id": "directory.roles.list",
  10053. // "parameterOrder": [
  10054. // "customer"
  10055. // ],
  10056. // "parameters": {
  10057. // "customer": {
  10058. // "description": "Immutable id of the Google Apps account.",
  10059. // "location": "path",
  10060. // "required": true,
  10061. // "type": "string"
  10062. // },
  10063. // "maxResults": {
  10064. // "description": "Maximum number of results to return.",
  10065. // "format": "int32",
  10066. // "location": "query",
  10067. // "maximum": "100",
  10068. // "minimum": "1",
  10069. // "type": "integer"
  10070. // },
  10071. // "pageToken": {
  10072. // "description": "Token to specify the next page in the list.",
  10073. // "location": "query",
  10074. // "type": "string"
  10075. // }
  10076. // },
  10077. // "path": "customer/{customer}/roles",
  10078. // "response": {
  10079. // "$ref": "Roles"
  10080. // },
  10081. // "scopes": [
  10082. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  10083. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  10084. // ]
  10085. // }
  10086. }
  10087. // Pages invokes f for each page of results.
  10088. // A non-nil error returned from f will halt the iteration.
  10089. // The provided context supersedes any context provided to the Context method.
  10090. func (c *RolesListCall) Pages(ctx context.Context, f func(*Roles) error) error {
  10091. c.ctx_ = ctx
  10092. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  10093. for {
  10094. x, err := c.Do()
  10095. if err != nil {
  10096. return err
  10097. }
  10098. if err := f(x); err != nil {
  10099. return err
  10100. }
  10101. if x.NextPageToken == "" {
  10102. return nil
  10103. }
  10104. c.PageToken(x.NextPageToken)
  10105. }
  10106. }
  10107. // method id "directory.roles.patch":
  10108. type RolesPatchCall struct {
  10109. s *Service
  10110. customer string
  10111. roleId string
  10112. role *Role
  10113. urlParams_ gensupport.URLParams
  10114. ctx_ context.Context
  10115. }
  10116. // Patch: Updates a role. This method supports patch semantics.
  10117. func (r *RolesService) Patch(customer string, roleId string, role *Role) *RolesPatchCall {
  10118. c := &RolesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10119. c.customer = customer
  10120. c.roleId = roleId
  10121. c.role = role
  10122. return c
  10123. }
  10124. // Fields allows partial responses to be retrieved. See
  10125. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10126. // for more information.
  10127. func (c *RolesPatchCall) Fields(s ...googleapi.Field) *RolesPatchCall {
  10128. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10129. return c
  10130. }
  10131. // Context sets the context to be used in this call's Do method. Any
  10132. // pending HTTP request will be aborted if the provided context is
  10133. // canceled.
  10134. func (c *RolesPatchCall) Context(ctx context.Context) *RolesPatchCall {
  10135. c.ctx_ = ctx
  10136. return c
  10137. }
  10138. func (c *RolesPatchCall) doRequest(alt string) (*http.Response, error) {
  10139. var body io.Reader = nil
  10140. body, err := googleapi.WithoutDataWrapper.JSONReader(c.role)
  10141. if err != nil {
  10142. return nil, err
  10143. }
  10144. ctype := "application/json"
  10145. c.urlParams_.Set("alt", alt)
  10146. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/{roleId}")
  10147. urls += "?" + c.urlParams_.Encode()
  10148. req, _ := http.NewRequest("PATCH", urls, body)
  10149. googleapi.Expand(req.URL, map[string]string{
  10150. "customer": c.customer,
  10151. "roleId": c.roleId,
  10152. })
  10153. req.Header.Set("Content-Type", ctype)
  10154. req.Header.Set("User-Agent", c.s.userAgent())
  10155. if c.ctx_ != nil {
  10156. return ctxhttp.Do(c.ctx_, c.s.client, req)
  10157. }
  10158. return c.s.client.Do(req)
  10159. }
  10160. // Do executes the "directory.roles.patch" call.
  10161. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  10162. // code is an error. Response headers are in either
  10163. // *Role.ServerResponse.Header or (if a response was returned at all) in
  10164. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  10165. // whether the returned error was because http.StatusNotModified was
  10166. // returned.
  10167. func (c *RolesPatchCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  10168. gensupport.SetOptions(c.urlParams_, opts...)
  10169. res, err := c.doRequest("json")
  10170. if res != nil && res.StatusCode == http.StatusNotModified {
  10171. if res.Body != nil {
  10172. res.Body.Close()
  10173. }
  10174. return nil, &googleapi.Error{
  10175. Code: res.StatusCode,
  10176. Header: res.Header,
  10177. }
  10178. }
  10179. if err != nil {
  10180. return nil, err
  10181. }
  10182. defer googleapi.CloseBody(res)
  10183. if err := googleapi.CheckResponse(res); err != nil {
  10184. return nil, err
  10185. }
  10186. ret := &Role{
  10187. ServerResponse: googleapi.ServerResponse{
  10188. Header: res.Header,
  10189. HTTPStatusCode: res.StatusCode,
  10190. },
  10191. }
  10192. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  10193. return nil, err
  10194. }
  10195. return ret, nil
  10196. // {
  10197. // "description": "Updates a role. This method supports patch semantics.",
  10198. // "httpMethod": "PATCH",
  10199. // "id": "directory.roles.patch",
  10200. // "parameterOrder": [
  10201. // "customer",
  10202. // "roleId"
  10203. // ],
  10204. // "parameters": {
  10205. // "customer": {
  10206. // "description": "Immutable ID of the Google Apps account.",
  10207. // "location": "path",
  10208. // "required": true,
  10209. // "type": "string"
  10210. // },
  10211. // "roleId": {
  10212. // "description": "Immutable ID of the role.",
  10213. // "location": "path",
  10214. // "required": true,
  10215. // "type": "string"
  10216. // }
  10217. // },
  10218. // "path": "customer/{customer}/roles/{roleId}",
  10219. // "request": {
  10220. // "$ref": "Role"
  10221. // },
  10222. // "response": {
  10223. // "$ref": "Role"
  10224. // },
  10225. // "scopes": [
  10226. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  10227. // ]
  10228. // }
  10229. }
  10230. // method id "directory.roles.update":
  10231. type RolesUpdateCall struct {
  10232. s *Service
  10233. customer string
  10234. roleId string
  10235. role *Role
  10236. urlParams_ gensupport.URLParams
  10237. ctx_ context.Context
  10238. }
  10239. // Update: Updates a role.
  10240. func (r *RolesService) Update(customer string, roleId string, role *Role) *RolesUpdateCall {
  10241. c := &RolesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10242. c.customer = customer
  10243. c.roleId = roleId
  10244. c.role = role
  10245. return c
  10246. }
  10247. // Fields allows partial responses to be retrieved. See
  10248. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10249. // for more information.
  10250. func (c *RolesUpdateCall) Fields(s ...googleapi.Field) *RolesUpdateCall {
  10251. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10252. return c
  10253. }
  10254. // Context sets the context to be used in this call's Do method. Any
  10255. // pending HTTP request will be aborted if the provided context is
  10256. // canceled.
  10257. func (c *RolesUpdateCall) Context(ctx context.Context) *RolesUpdateCall {
  10258. c.ctx_ = ctx
  10259. return c
  10260. }
  10261. func (c *RolesUpdateCall) doRequest(alt string) (*http.Response, error) {
  10262. var body io.Reader = nil
  10263. body, err := googleapi.WithoutDataWrapper.JSONReader(c.role)
  10264. if err != nil {
  10265. return nil, err
  10266. }
  10267. ctype := "application/json"
  10268. c.urlParams_.Set("alt", alt)
  10269. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/{roleId}")
  10270. urls += "?" + c.urlParams_.Encode()
  10271. req, _ := http.NewRequest("PUT", urls, body)
  10272. googleapi.Expand(req.URL, map[string]string{
  10273. "customer": c.customer,
  10274. "roleId": c.roleId,
  10275. })
  10276. req.Header.Set("Content-Type", ctype)
  10277. req.Header.Set("User-Agent", c.s.userAgent())
  10278. if c.ctx_ != nil {
  10279. return ctxhttp.Do(c.ctx_, c.s.client, req)
  10280. }
  10281. return c.s.client.Do(req)
  10282. }
  10283. // Do executes the "directory.roles.update" call.
  10284. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  10285. // code is an error. Response headers are in either
  10286. // *Role.ServerResponse.Header or (if a response was returned at all) in
  10287. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  10288. // whether the returned error was because http.StatusNotModified was
  10289. // returned.
  10290. func (c *RolesUpdateCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  10291. gensupport.SetOptions(c.urlParams_, opts...)
  10292. res, err := c.doRequest("json")
  10293. if res != nil && res.StatusCode == http.StatusNotModified {
  10294. if res.Body != nil {
  10295. res.Body.Close()
  10296. }
  10297. return nil, &googleapi.Error{
  10298. Code: res.StatusCode,
  10299. Header: res.Header,
  10300. }
  10301. }
  10302. if err != nil {
  10303. return nil, err
  10304. }
  10305. defer googleapi.CloseBody(res)
  10306. if err := googleapi.CheckResponse(res); err != nil {
  10307. return nil, err
  10308. }
  10309. ret := &Role{
  10310. ServerResponse: googleapi.ServerResponse{
  10311. Header: res.Header,
  10312. HTTPStatusCode: res.StatusCode,
  10313. },
  10314. }
  10315. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  10316. return nil, err
  10317. }
  10318. return ret, nil
  10319. // {
  10320. // "description": "Updates a role.",
  10321. // "httpMethod": "PUT",
  10322. // "id": "directory.roles.update",
  10323. // "parameterOrder": [
  10324. // "customer",
  10325. // "roleId"
  10326. // ],
  10327. // "parameters": {
  10328. // "customer": {
  10329. // "description": "Immutable ID of the Google Apps account.",
  10330. // "location": "path",
  10331. // "required": true,
  10332. // "type": "string"
  10333. // },
  10334. // "roleId": {
  10335. // "description": "Immutable ID of the role.",
  10336. // "location": "path",
  10337. // "required": true,
  10338. // "type": "string"
  10339. // }
  10340. // },
  10341. // "path": "customer/{customer}/roles/{roleId}",
  10342. // "request": {
  10343. // "$ref": "Role"
  10344. // },
  10345. // "response": {
  10346. // "$ref": "Role"
  10347. // },
  10348. // "scopes": [
  10349. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  10350. // ]
  10351. // }
  10352. }
  10353. // method id "directory.schemas.delete":
  10354. type SchemasDeleteCall struct {
  10355. s *Service
  10356. customerId string
  10357. schemaKey string
  10358. urlParams_ gensupport.URLParams
  10359. ctx_ context.Context
  10360. }
  10361. // Delete: Delete schema
  10362. func (r *SchemasService) Delete(customerId string, schemaKey string) *SchemasDeleteCall {
  10363. c := &SchemasDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10364. c.customerId = customerId
  10365. c.schemaKey = schemaKey
  10366. return c
  10367. }
  10368. // Fields allows partial responses to be retrieved. See
  10369. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10370. // for more information.
  10371. func (c *SchemasDeleteCall) Fields(s ...googleapi.Field) *SchemasDeleteCall {
  10372. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10373. return c
  10374. }
  10375. // Context sets the context to be used in this call's Do method. Any
  10376. // pending HTTP request will be aborted if the provided context is
  10377. // canceled.
  10378. func (c *SchemasDeleteCall) Context(ctx context.Context) *SchemasDeleteCall {
  10379. c.ctx_ = ctx
  10380. return c
  10381. }
  10382. func (c *SchemasDeleteCall) doRequest(alt string) (*http.Response, error) {
  10383. var body io.Reader = nil
  10384. c.urlParams_.Set("alt", alt)
  10385. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas/{schemaKey}")
  10386. urls += "?" + c.urlParams_.Encode()
  10387. req, _ := http.NewRequest("DELETE", urls, body)
  10388. googleapi.Expand(req.URL, map[string]string{
  10389. "customerId": c.customerId,
  10390. "schemaKey": c.schemaKey,
  10391. })
  10392. req.Header.Set("User-Agent", c.s.userAgent())
  10393. if c.ctx_ != nil {
  10394. return ctxhttp.Do(c.ctx_, c.s.client, req)
  10395. }
  10396. return c.s.client.Do(req)
  10397. }
  10398. // Do executes the "directory.schemas.delete" call.
  10399. func (c *SchemasDeleteCall) Do(opts ...googleapi.CallOption) error {
  10400. gensupport.SetOptions(c.urlParams_, opts...)
  10401. res, err := c.doRequest("json")
  10402. if err != nil {
  10403. return err
  10404. }
  10405. defer googleapi.CloseBody(res)
  10406. if err := googleapi.CheckResponse(res); err != nil {
  10407. return err
  10408. }
  10409. return nil
  10410. // {
  10411. // "description": "Delete schema",
  10412. // "httpMethod": "DELETE",
  10413. // "id": "directory.schemas.delete",
  10414. // "parameterOrder": [
  10415. // "customerId",
  10416. // "schemaKey"
  10417. // ],
  10418. // "parameters": {
  10419. // "customerId": {
  10420. // "description": "Immutable id of the Google Apps account",
  10421. // "location": "path",
  10422. // "required": true,
  10423. // "type": "string"
  10424. // },
  10425. // "schemaKey": {
  10426. // "description": "Name or immutable Id of the schema",
  10427. // "location": "path",
  10428. // "required": true,
  10429. // "type": "string"
  10430. // }
  10431. // },
  10432. // "path": "customer/{customerId}/schemas/{schemaKey}",
  10433. // "scopes": [
  10434. // "https://www.googleapis.com/auth/admin.directory.userschema"
  10435. // ]
  10436. // }
  10437. }
  10438. // method id "directory.schemas.get":
  10439. type SchemasGetCall struct {
  10440. s *Service
  10441. customerId string
  10442. schemaKey string
  10443. urlParams_ gensupport.URLParams
  10444. ifNoneMatch_ string
  10445. ctx_ context.Context
  10446. }
  10447. // Get: Retrieve schema
  10448. func (r *SchemasService) Get(customerId string, schemaKey string) *SchemasGetCall {
  10449. c := &SchemasGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10450. c.customerId = customerId
  10451. c.schemaKey = schemaKey
  10452. return c
  10453. }
  10454. // Fields allows partial responses to be retrieved. See
  10455. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10456. // for more information.
  10457. func (c *SchemasGetCall) Fields(s ...googleapi.Field) *SchemasGetCall {
  10458. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10459. return c
  10460. }
  10461. // IfNoneMatch sets the optional parameter which makes the operation
  10462. // fail if the object's ETag matches the given value. This is useful for
  10463. // getting updates only after the object has changed since the last
  10464. // request. Use googleapi.IsNotModified to check whether the response
  10465. // error from Do is the result of In-None-Match.
  10466. func (c *SchemasGetCall) IfNoneMatch(entityTag string) *SchemasGetCall {
  10467. c.ifNoneMatch_ = entityTag
  10468. return c
  10469. }
  10470. // Context sets the context to be used in this call's Do method. Any
  10471. // pending HTTP request will be aborted if the provided context is
  10472. // canceled.
  10473. func (c *SchemasGetCall) Context(ctx context.Context) *SchemasGetCall {
  10474. c.ctx_ = ctx
  10475. return c
  10476. }
  10477. func (c *SchemasGetCall) doRequest(alt string) (*http.Response, error) {
  10478. var body io.Reader = nil
  10479. c.urlParams_.Set("alt", alt)
  10480. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas/{schemaKey}")
  10481. urls += "?" + c.urlParams_.Encode()
  10482. req, _ := http.NewRequest("GET", urls, body)
  10483. googleapi.Expand(req.URL, map[string]string{
  10484. "customerId": c.customerId,
  10485. "schemaKey": c.schemaKey,
  10486. })
  10487. req.Header.Set("User-Agent", c.s.userAgent())
  10488. if c.ifNoneMatch_ != "" {
  10489. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  10490. }
  10491. if c.ctx_ != nil {
  10492. return ctxhttp.Do(c.ctx_, c.s.client, req)
  10493. }
  10494. return c.s.client.Do(req)
  10495. }
  10496. // Do executes the "directory.schemas.get" call.
  10497. // Exactly one of *Schema or error will be non-nil. Any non-2xx status
  10498. // code is an error. Response headers are in either
  10499. // *Schema.ServerResponse.Header or (if a response was returned at all)
  10500. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10501. // check whether the returned error was because http.StatusNotModified
  10502. // was returned.
  10503. func (c *SchemasGetCall) Do(opts ...googleapi.CallOption) (*Schema, error) {
  10504. gensupport.SetOptions(c.urlParams_, opts...)
  10505. res, err := c.doRequest("json")
  10506. if res != nil && res.StatusCode == http.StatusNotModified {
  10507. if res.Body != nil {
  10508. res.Body.Close()
  10509. }
  10510. return nil, &googleapi.Error{
  10511. Code: res.StatusCode,
  10512. Header: res.Header,
  10513. }
  10514. }
  10515. if err != nil {
  10516. return nil, err
  10517. }
  10518. defer googleapi.CloseBody(res)
  10519. if err := googleapi.CheckResponse(res); err != nil {
  10520. return nil, err
  10521. }
  10522. ret := &Schema{
  10523. ServerResponse: googleapi.ServerResponse{
  10524. Header: res.Header,
  10525. HTTPStatusCode: res.StatusCode,
  10526. },
  10527. }
  10528. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  10529. return nil, err
  10530. }
  10531. return ret, nil
  10532. // {
  10533. // "description": "Retrieve schema",
  10534. // "httpMethod": "GET",
  10535. // "id": "directory.schemas.get",
  10536. // "parameterOrder": [
  10537. // "customerId",
  10538. // "schemaKey"
  10539. // ],
  10540. // "parameters": {
  10541. // "customerId": {
  10542. // "description": "Immutable id of the Google Apps account",
  10543. // "location": "path",
  10544. // "required": true,
  10545. // "type": "string"
  10546. // },
  10547. // "schemaKey": {
  10548. // "description": "Name or immutable Id of the schema",
  10549. // "location": "path",
  10550. // "required": true,
  10551. // "type": "string"
  10552. // }
  10553. // },
  10554. // "path": "customer/{customerId}/schemas/{schemaKey}",
  10555. // "response": {
  10556. // "$ref": "Schema"
  10557. // },
  10558. // "scopes": [
  10559. // "https://www.googleapis.com/auth/admin.directory.userschema",
  10560. // "https://www.googleapis.com/auth/admin.directory.userschema.readonly"
  10561. // ]
  10562. // }
  10563. }
  10564. // method id "directory.schemas.insert":
  10565. type SchemasInsertCall struct {
  10566. s *Service
  10567. customerId string
  10568. schema *Schema
  10569. urlParams_ gensupport.URLParams
  10570. ctx_ context.Context
  10571. }
  10572. // Insert: Create schema.
  10573. func (r *SchemasService) Insert(customerId string, schema *Schema) *SchemasInsertCall {
  10574. c := &SchemasInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10575. c.customerId = customerId
  10576. c.schema = schema
  10577. return c
  10578. }
  10579. // Fields allows partial responses to be retrieved. See
  10580. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10581. // for more information.
  10582. func (c *SchemasInsertCall) Fields(s ...googleapi.Field) *SchemasInsertCall {
  10583. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10584. return c
  10585. }
  10586. // Context sets the context to be used in this call's Do method. Any
  10587. // pending HTTP request will be aborted if the provided context is
  10588. // canceled.
  10589. func (c *SchemasInsertCall) Context(ctx context.Context) *SchemasInsertCall {
  10590. c.ctx_ = ctx
  10591. return c
  10592. }
  10593. func (c *SchemasInsertCall) doRequest(alt string) (*http.Response, error) {
  10594. var body io.Reader = nil
  10595. body, err := googleapi.WithoutDataWrapper.JSONReader(c.schema)
  10596. if err != nil {
  10597. return nil, err
  10598. }
  10599. ctype := "application/json"
  10600. c.urlParams_.Set("alt", alt)
  10601. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas")
  10602. urls += "?" + c.urlParams_.Encode()
  10603. req, _ := http.NewRequest("POST", urls, body)
  10604. googleapi.Expand(req.URL, map[string]string{
  10605. "customerId": c.customerId,
  10606. })
  10607. req.Header.Set("Content-Type", ctype)
  10608. req.Header.Set("User-Agent", c.s.userAgent())
  10609. if c.ctx_ != nil {
  10610. return ctxhttp.Do(c.ctx_, c.s.client, req)
  10611. }
  10612. return c.s.client.Do(req)
  10613. }
  10614. // Do executes the "directory.schemas.insert" call.
  10615. // Exactly one of *Schema or error will be non-nil. Any non-2xx status
  10616. // code is an error. Response headers are in either
  10617. // *Schema.ServerResponse.Header or (if a response was returned at all)
  10618. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10619. // check whether the returned error was because http.StatusNotModified
  10620. // was returned.
  10621. func (c *SchemasInsertCall) Do(opts ...googleapi.CallOption) (*Schema, error) {
  10622. gensupport.SetOptions(c.urlParams_, opts...)
  10623. res, err := c.doRequest("json")
  10624. if res != nil && res.StatusCode == http.StatusNotModified {
  10625. if res.Body != nil {
  10626. res.Body.Close()
  10627. }
  10628. return nil, &googleapi.Error{
  10629. Code: res.StatusCode,
  10630. Header: res.Header,
  10631. }
  10632. }
  10633. if err != nil {
  10634. return nil, err
  10635. }
  10636. defer googleapi.CloseBody(res)
  10637. if err := googleapi.CheckResponse(res); err != nil {
  10638. return nil, err
  10639. }
  10640. ret := &Schema{
  10641. ServerResponse: googleapi.ServerResponse{
  10642. Header: res.Header,
  10643. HTTPStatusCode: res.StatusCode,
  10644. },
  10645. }
  10646. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  10647. return nil, err
  10648. }
  10649. return ret, nil
  10650. // {
  10651. // "description": "Create schema.",
  10652. // "httpMethod": "POST",
  10653. // "id": "directory.schemas.insert",
  10654. // "parameterOrder": [
  10655. // "customerId"
  10656. // ],
  10657. // "parameters": {
  10658. // "customerId": {
  10659. // "description": "Immutable id of the Google Apps account",
  10660. // "location": "path",
  10661. // "required": true,
  10662. // "type": "string"
  10663. // }
  10664. // },
  10665. // "path": "customer/{customerId}/schemas",
  10666. // "request": {
  10667. // "$ref": "Schema"
  10668. // },
  10669. // "response": {
  10670. // "$ref": "Schema"
  10671. // },
  10672. // "scopes": [
  10673. // "https://www.googleapis.com/auth/admin.directory.userschema"
  10674. // ]
  10675. // }
  10676. }
  10677. // method id "directory.schemas.list":
  10678. type SchemasListCall struct {
  10679. s *Service
  10680. customerId string
  10681. urlParams_ gensupport.URLParams
  10682. ifNoneMatch_ string
  10683. ctx_ context.Context
  10684. }
  10685. // List: Retrieve all schemas for a customer
  10686. func (r *SchemasService) List(customerId string) *SchemasListCall {
  10687. c := &SchemasListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10688. c.customerId = customerId
  10689. return c
  10690. }
  10691. // Fields allows partial responses to be retrieved. See
  10692. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10693. // for more information.
  10694. func (c *SchemasListCall) Fields(s ...googleapi.Field) *SchemasListCall {
  10695. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10696. return c
  10697. }
  10698. // IfNoneMatch sets the optional parameter which makes the operation
  10699. // fail if the object's ETag matches the given value. This is useful for
  10700. // getting updates only after the object has changed since the last
  10701. // request. Use googleapi.IsNotModified to check whether the response
  10702. // error from Do is the result of In-None-Match.
  10703. func (c *SchemasListCall) IfNoneMatch(entityTag string) *SchemasListCall {
  10704. c.ifNoneMatch_ = entityTag
  10705. return c
  10706. }
  10707. // Context sets the context to be used in this call's Do method. Any
  10708. // pending HTTP request will be aborted if the provided context is
  10709. // canceled.
  10710. func (c *SchemasListCall) Context(ctx context.Context) *SchemasListCall {
  10711. c.ctx_ = ctx
  10712. return c
  10713. }
  10714. func (c *SchemasListCall) doRequest(alt string) (*http.Response, error) {
  10715. var body io.Reader = nil
  10716. c.urlParams_.Set("alt", alt)
  10717. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas")
  10718. urls += "?" + c.urlParams_.Encode()
  10719. req, _ := http.NewRequest("GET", urls, body)
  10720. googleapi.Expand(req.URL, map[string]string{
  10721. "customerId": c.customerId,
  10722. })
  10723. req.Header.Set("User-Agent", c.s.userAgent())
  10724. if c.ifNoneMatch_ != "" {
  10725. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  10726. }
  10727. if c.ctx_ != nil {
  10728. return ctxhttp.Do(c.ctx_, c.s.client, req)
  10729. }
  10730. return c.s.client.Do(req)
  10731. }
  10732. // Do executes the "directory.schemas.list" call.
  10733. // Exactly one of *Schemas or error will be non-nil. Any non-2xx status
  10734. // code is an error. Response headers are in either
  10735. // *Schemas.ServerResponse.Header or (if a response was returned at all)
  10736. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10737. // check whether the returned error was because http.StatusNotModified
  10738. // was returned.
  10739. func (c *SchemasListCall) Do(opts ...googleapi.CallOption) (*Schemas, error) {
  10740. gensupport.SetOptions(c.urlParams_, opts...)
  10741. res, err := c.doRequest("json")
  10742. if res != nil && res.StatusCode == http.StatusNotModified {
  10743. if res.Body != nil {
  10744. res.Body.Close()
  10745. }
  10746. return nil, &googleapi.Error{
  10747. Code: res.StatusCode,
  10748. Header: res.Header,
  10749. }
  10750. }
  10751. if err != nil {
  10752. return nil, err
  10753. }
  10754. defer googleapi.CloseBody(res)
  10755. if err := googleapi.CheckResponse(res); err != nil {
  10756. return nil, err
  10757. }
  10758. ret := &Schemas{
  10759. ServerResponse: googleapi.ServerResponse{
  10760. Header: res.Header,
  10761. HTTPStatusCode: res.StatusCode,
  10762. },
  10763. }
  10764. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  10765. return nil, err
  10766. }
  10767. return ret, nil
  10768. // {
  10769. // "description": "Retrieve all schemas for a customer",
  10770. // "httpMethod": "GET",
  10771. // "id": "directory.schemas.list",
  10772. // "parameterOrder": [
  10773. // "customerId"
  10774. // ],
  10775. // "parameters": {
  10776. // "customerId": {
  10777. // "description": "Immutable id of the Google Apps account",
  10778. // "location": "path",
  10779. // "required": true,
  10780. // "type": "string"
  10781. // }
  10782. // },
  10783. // "path": "customer/{customerId}/schemas",
  10784. // "response": {
  10785. // "$ref": "Schemas"
  10786. // },
  10787. // "scopes": [
  10788. // "https://www.googleapis.com/auth/admin.directory.userschema",
  10789. // "https://www.googleapis.com/auth/admin.directory.userschema.readonly"
  10790. // ]
  10791. // }
  10792. }
  10793. // method id "directory.schemas.patch":
  10794. type SchemasPatchCall struct {
  10795. s *Service
  10796. customerId string
  10797. schemaKey string
  10798. schema *Schema
  10799. urlParams_ gensupport.URLParams
  10800. ctx_ context.Context
  10801. }
  10802. // Patch: Update schema. This method supports patch semantics.
  10803. func (r *SchemasService) Patch(customerId string, schemaKey string, schema *Schema) *SchemasPatchCall {
  10804. c := &SchemasPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10805. c.customerId = customerId
  10806. c.schemaKey = schemaKey
  10807. c.schema = schema
  10808. return c
  10809. }
  10810. // Fields allows partial responses to be retrieved. See
  10811. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10812. // for more information.
  10813. func (c *SchemasPatchCall) Fields(s ...googleapi.Field) *SchemasPatchCall {
  10814. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10815. return c
  10816. }
  10817. // Context sets the context to be used in this call's Do method. Any
  10818. // pending HTTP request will be aborted if the provided context is
  10819. // canceled.
  10820. func (c *SchemasPatchCall) Context(ctx context.Context) *SchemasPatchCall {
  10821. c.ctx_ = ctx
  10822. return c
  10823. }
  10824. func (c *SchemasPatchCall) doRequest(alt string) (*http.Response, error) {
  10825. var body io.Reader = nil
  10826. body, err := googleapi.WithoutDataWrapper.JSONReader(c.schema)
  10827. if err != nil {
  10828. return nil, err
  10829. }
  10830. ctype := "application/json"
  10831. c.urlParams_.Set("alt", alt)
  10832. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas/{schemaKey}")
  10833. urls += "?" + c.urlParams_.Encode()
  10834. req, _ := http.NewRequest("PATCH", urls, body)
  10835. googleapi.Expand(req.URL, map[string]string{
  10836. "customerId": c.customerId,
  10837. "schemaKey": c.schemaKey,
  10838. })
  10839. req.Header.Set("Content-Type", ctype)
  10840. req.Header.Set("User-Agent", c.s.userAgent())
  10841. if c.ctx_ != nil {
  10842. return ctxhttp.Do(c.ctx_, c.s.client, req)
  10843. }
  10844. return c.s.client.Do(req)
  10845. }
  10846. // Do executes the "directory.schemas.patch" call.
  10847. // Exactly one of *Schema or error will be non-nil. Any non-2xx status
  10848. // code is an error. Response headers are in either
  10849. // *Schema.ServerResponse.Header or (if a response was returned at all)
  10850. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10851. // check whether the returned error was because http.StatusNotModified
  10852. // was returned.
  10853. func (c *SchemasPatchCall) Do(opts ...googleapi.CallOption) (*Schema, error) {
  10854. gensupport.SetOptions(c.urlParams_, opts...)
  10855. res, err := c.doRequest("json")
  10856. if res != nil && res.StatusCode == http.StatusNotModified {
  10857. if res.Body != nil {
  10858. res.Body.Close()
  10859. }
  10860. return nil, &googleapi.Error{
  10861. Code: res.StatusCode,
  10862. Header: res.Header,
  10863. }
  10864. }
  10865. if err != nil {
  10866. return nil, err
  10867. }
  10868. defer googleapi.CloseBody(res)
  10869. if err := googleapi.CheckResponse(res); err != nil {
  10870. return nil, err
  10871. }
  10872. ret := &Schema{
  10873. ServerResponse: googleapi.ServerResponse{
  10874. Header: res.Header,
  10875. HTTPStatusCode: res.StatusCode,
  10876. },
  10877. }
  10878. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  10879. return nil, err
  10880. }
  10881. return ret, nil
  10882. // {
  10883. // "description": "Update schema. This method supports patch semantics.",
  10884. // "httpMethod": "PATCH",
  10885. // "id": "directory.schemas.patch",
  10886. // "parameterOrder": [
  10887. // "customerId",
  10888. // "schemaKey"
  10889. // ],
  10890. // "parameters": {
  10891. // "customerId": {
  10892. // "description": "Immutable id of the Google Apps account",
  10893. // "location": "path",
  10894. // "required": true,
  10895. // "type": "string"
  10896. // },
  10897. // "schemaKey": {
  10898. // "description": "Name or immutable Id of the schema.",
  10899. // "location": "path",
  10900. // "required": true,
  10901. // "type": "string"
  10902. // }
  10903. // },
  10904. // "path": "customer/{customerId}/schemas/{schemaKey}",
  10905. // "request": {
  10906. // "$ref": "Schema"
  10907. // },
  10908. // "response": {
  10909. // "$ref": "Schema"
  10910. // },
  10911. // "scopes": [
  10912. // "https://www.googleapis.com/auth/admin.directory.userschema"
  10913. // ]
  10914. // }
  10915. }
  10916. // method id "directory.schemas.update":
  10917. type SchemasUpdateCall struct {
  10918. s *Service
  10919. customerId string
  10920. schemaKey string
  10921. schema *Schema
  10922. urlParams_ gensupport.URLParams
  10923. ctx_ context.Context
  10924. }
  10925. // Update: Update schema
  10926. func (r *SchemasService) Update(customerId string, schemaKey string, schema *Schema) *SchemasUpdateCall {
  10927. c := &SchemasUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10928. c.customerId = customerId
  10929. c.schemaKey = schemaKey
  10930. c.schema = schema
  10931. return c
  10932. }
  10933. // Fields allows partial responses to be retrieved. See
  10934. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10935. // for more information.
  10936. func (c *SchemasUpdateCall) Fields(s ...googleapi.Field) *SchemasUpdateCall {
  10937. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10938. return c
  10939. }
  10940. // Context sets the context to be used in this call's Do method. Any
  10941. // pending HTTP request will be aborted if the provided context is
  10942. // canceled.
  10943. func (c *SchemasUpdateCall) Context(ctx context.Context) *SchemasUpdateCall {
  10944. c.ctx_ = ctx
  10945. return c
  10946. }
  10947. func (c *SchemasUpdateCall) doRequest(alt string) (*http.Response, error) {
  10948. var body io.Reader = nil
  10949. body, err := googleapi.WithoutDataWrapper.JSONReader(c.schema)
  10950. if err != nil {
  10951. return nil, err
  10952. }
  10953. ctype := "application/json"
  10954. c.urlParams_.Set("alt", alt)
  10955. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas/{schemaKey}")
  10956. urls += "?" + c.urlParams_.Encode()
  10957. req, _ := http.NewRequest("PUT", urls, body)
  10958. googleapi.Expand(req.URL, map[string]string{
  10959. "customerId": c.customerId,
  10960. "schemaKey": c.schemaKey,
  10961. })
  10962. req.Header.Set("Content-Type", ctype)
  10963. req.Header.Set("User-Agent", c.s.userAgent())
  10964. if c.ctx_ != nil {
  10965. return ctxhttp.Do(c.ctx_, c.s.client, req)
  10966. }
  10967. return c.s.client.Do(req)
  10968. }
  10969. // Do executes the "directory.schemas.update" call.
  10970. // Exactly one of *Schema or error will be non-nil. Any non-2xx status
  10971. // code is an error. Response headers are in either
  10972. // *Schema.ServerResponse.Header or (if a response was returned at all)
  10973. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10974. // check whether the returned error was because http.StatusNotModified
  10975. // was returned.
  10976. func (c *SchemasUpdateCall) Do(opts ...googleapi.CallOption) (*Schema, error) {
  10977. gensupport.SetOptions(c.urlParams_, opts...)
  10978. res, err := c.doRequest("json")
  10979. if res != nil && res.StatusCode == http.StatusNotModified {
  10980. if res.Body != nil {
  10981. res.Body.Close()
  10982. }
  10983. return nil, &googleapi.Error{
  10984. Code: res.StatusCode,
  10985. Header: res.Header,
  10986. }
  10987. }
  10988. if err != nil {
  10989. return nil, err
  10990. }
  10991. defer googleapi.CloseBody(res)
  10992. if err := googleapi.CheckResponse(res); err != nil {
  10993. return nil, err
  10994. }
  10995. ret := &Schema{
  10996. ServerResponse: googleapi.ServerResponse{
  10997. Header: res.Header,
  10998. HTTPStatusCode: res.StatusCode,
  10999. },
  11000. }
  11001. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  11002. return nil, err
  11003. }
  11004. return ret, nil
  11005. // {
  11006. // "description": "Update schema",
  11007. // "httpMethod": "PUT",
  11008. // "id": "directory.schemas.update",
  11009. // "parameterOrder": [
  11010. // "customerId",
  11011. // "schemaKey"
  11012. // ],
  11013. // "parameters": {
  11014. // "customerId": {
  11015. // "description": "Immutable id of the Google Apps account",
  11016. // "location": "path",
  11017. // "required": true,
  11018. // "type": "string"
  11019. // },
  11020. // "schemaKey": {
  11021. // "description": "Name or immutable Id of the schema.",
  11022. // "location": "path",
  11023. // "required": true,
  11024. // "type": "string"
  11025. // }
  11026. // },
  11027. // "path": "customer/{customerId}/schemas/{schemaKey}",
  11028. // "request": {
  11029. // "$ref": "Schema"
  11030. // },
  11031. // "response": {
  11032. // "$ref": "Schema"
  11033. // },
  11034. // "scopes": [
  11035. // "https://www.googleapis.com/auth/admin.directory.userschema"
  11036. // ]
  11037. // }
  11038. }
  11039. // method id "directory.tokens.delete":
  11040. type TokensDeleteCall struct {
  11041. s *Service
  11042. userKey string
  11043. clientId string
  11044. urlParams_ gensupport.URLParams
  11045. ctx_ context.Context
  11046. }
  11047. // Delete: Delete all access tokens issued by a user for an application.
  11048. func (r *TokensService) Delete(userKey string, clientId string) *TokensDeleteCall {
  11049. c := &TokensDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11050. c.userKey = userKey
  11051. c.clientId = clientId
  11052. return c
  11053. }
  11054. // Fields allows partial responses to be retrieved. See
  11055. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11056. // for more information.
  11057. func (c *TokensDeleteCall) Fields(s ...googleapi.Field) *TokensDeleteCall {
  11058. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11059. return c
  11060. }
  11061. // Context sets the context to be used in this call's Do method. Any
  11062. // pending HTTP request will be aborted if the provided context is
  11063. // canceled.
  11064. func (c *TokensDeleteCall) Context(ctx context.Context) *TokensDeleteCall {
  11065. c.ctx_ = ctx
  11066. return c
  11067. }
  11068. func (c *TokensDeleteCall) doRequest(alt string) (*http.Response, error) {
  11069. var body io.Reader = nil
  11070. c.urlParams_.Set("alt", alt)
  11071. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/tokens/{clientId}")
  11072. urls += "?" + c.urlParams_.Encode()
  11073. req, _ := http.NewRequest("DELETE", urls, body)
  11074. googleapi.Expand(req.URL, map[string]string{
  11075. "userKey": c.userKey,
  11076. "clientId": c.clientId,
  11077. })
  11078. req.Header.Set("User-Agent", c.s.userAgent())
  11079. if c.ctx_ != nil {
  11080. return ctxhttp.Do(c.ctx_, c.s.client, req)
  11081. }
  11082. return c.s.client.Do(req)
  11083. }
  11084. // Do executes the "directory.tokens.delete" call.
  11085. func (c *TokensDeleteCall) Do(opts ...googleapi.CallOption) error {
  11086. gensupport.SetOptions(c.urlParams_, opts...)
  11087. res, err := c.doRequest("json")
  11088. if err != nil {
  11089. return err
  11090. }
  11091. defer googleapi.CloseBody(res)
  11092. if err := googleapi.CheckResponse(res); err != nil {
  11093. return err
  11094. }
  11095. return nil
  11096. // {
  11097. // "description": "Delete all access tokens issued by a user for an application.",
  11098. // "httpMethod": "DELETE",
  11099. // "id": "directory.tokens.delete",
  11100. // "parameterOrder": [
  11101. // "userKey",
  11102. // "clientId"
  11103. // ],
  11104. // "parameters": {
  11105. // "clientId": {
  11106. // "description": "The Client ID of the application the token is issued to.",
  11107. // "location": "path",
  11108. // "required": true,
  11109. // "type": "string"
  11110. // },
  11111. // "userKey": {
  11112. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  11113. // "location": "path",
  11114. // "required": true,
  11115. // "type": "string"
  11116. // }
  11117. // },
  11118. // "path": "users/{userKey}/tokens/{clientId}",
  11119. // "scopes": [
  11120. // "https://www.googleapis.com/auth/admin.directory.user.security"
  11121. // ]
  11122. // }
  11123. }
  11124. // method id "directory.tokens.get":
  11125. type TokensGetCall struct {
  11126. s *Service
  11127. userKey string
  11128. clientId string
  11129. urlParams_ gensupport.URLParams
  11130. ifNoneMatch_ string
  11131. ctx_ context.Context
  11132. }
  11133. // Get: Get information about an access token issued by a user.
  11134. func (r *TokensService) Get(userKey string, clientId string) *TokensGetCall {
  11135. c := &TokensGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11136. c.userKey = userKey
  11137. c.clientId = clientId
  11138. return c
  11139. }
  11140. // Fields allows partial responses to be retrieved. See
  11141. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11142. // for more information.
  11143. func (c *TokensGetCall) Fields(s ...googleapi.Field) *TokensGetCall {
  11144. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11145. return c
  11146. }
  11147. // IfNoneMatch sets the optional parameter which makes the operation
  11148. // fail if the object's ETag matches the given value. This is useful for
  11149. // getting updates only after the object has changed since the last
  11150. // request. Use googleapi.IsNotModified to check whether the response
  11151. // error from Do is the result of In-None-Match.
  11152. func (c *TokensGetCall) IfNoneMatch(entityTag string) *TokensGetCall {
  11153. c.ifNoneMatch_ = entityTag
  11154. return c
  11155. }
  11156. // Context sets the context to be used in this call's Do method. Any
  11157. // pending HTTP request will be aborted if the provided context is
  11158. // canceled.
  11159. func (c *TokensGetCall) Context(ctx context.Context) *TokensGetCall {
  11160. c.ctx_ = ctx
  11161. return c
  11162. }
  11163. func (c *TokensGetCall) doRequest(alt string) (*http.Response, error) {
  11164. var body io.Reader = nil
  11165. c.urlParams_.Set("alt", alt)
  11166. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/tokens/{clientId}")
  11167. urls += "?" + c.urlParams_.Encode()
  11168. req, _ := http.NewRequest("GET", urls, body)
  11169. googleapi.Expand(req.URL, map[string]string{
  11170. "userKey": c.userKey,
  11171. "clientId": c.clientId,
  11172. })
  11173. req.Header.Set("User-Agent", c.s.userAgent())
  11174. if c.ifNoneMatch_ != "" {
  11175. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  11176. }
  11177. if c.ctx_ != nil {
  11178. return ctxhttp.Do(c.ctx_, c.s.client, req)
  11179. }
  11180. return c.s.client.Do(req)
  11181. }
  11182. // Do executes the "directory.tokens.get" call.
  11183. // Exactly one of *Token or error will be non-nil. Any non-2xx status
  11184. // code is an error. Response headers are in either
  11185. // *Token.ServerResponse.Header or (if a response was returned at all)
  11186. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  11187. // check whether the returned error was because http.StatusNotModified
  11188. // was returned.
  11189. func (c *TokensGetCall) Do(opts ...googleapi.CallOption) (*Token, error) {
  11190. gensupport.SetOptions(c.urlParams_, opts...)
  11191. res, err := c.doRequest("json")
  11192. if res != nil && res.StatusCode == http.StatusNotModified {
  11193. if res.Body != nil {
  11194. res.Body.Close()
  11195. }
  11196. return nil, &googleapi.Error{
  11197. Code: res.StatusCode,
  11198. Header: res.Header,
  11199. }
  11200. }
  11201. if err != nil {
  11202. return nil, err
  11203. }
  11204. defer googleapi.CloseBody(res)
  11205. if err := googleapi.CheckResponse(res); err != nil {
  11206. return nil, err
  11207. }
  11208. ret := &Token{
  11209. ServerResponse: googleapi.ServerResponse{
  11210. Header: res.Header,
  11211. HTTPStatusCode: res.StatusCode,
  11212. },
  11213. }
  11214. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  11215. return nil, err
  11216. }
  11217. return ret, nil
  11218. // {
  11219. // "description": "Get information about an access token issued by a user.",
  11220. // "httpMethod": "GET",
  11221. // "id": "directory.tokens.get",
  11222. // "parameterOrder": [
  11223. // "userKey",
  11224. // "clientId"
  11225. // ],
  11226. // "parameters": {
  11227. // "clientId": {
  11228. // "description": "The Client ID of the application the token is issued to.",
  11229. // "location": "path",
  11230. // "required": true,
  11231. // "type": "string"
  11232. // },
  11233. // "userKey": {
  11234. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  11235. // "location": "path",
  11236. // "required": true,
  11237. // "type": "string"
  11238. // }
  11239. // },
  11240. // "path": "users/{userKey}/tokens/{clientId}",
  11241. // "response": {
  11242. // "$ref": "Token"
  11243. // },
  11244. // "scopes": [
  11245. // "https://www.googleapis.com/auth/admin.directory.user.security"
  11246. // ]
  11247. // }
  11248. }
  11249. // method id "directory.tokens.list":
  11250. type TokensListCall struct {
  11251. s *Service
  11252. userKey string
  11253. urlParams_ gensupport.URLParams
  11254. ifNoneMatch_ string
  11255. ctx_ context.Context
  11256. }
  11257. // List: Returns the set of tokens specified user has issued to 3rd
  11258. // party applications.
  11259. func (r *TokensService) List(userKey string) *TokensListCall {
  11260. c := &TokensListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11261. c.userKey = userKey
  11262. return c
  11263. }
  11264. // Fields allows partial responses to be retrieved. See
  11265. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11266. // for more information.
  11267. func (c *TokensListCall) Fields(s ...googleapi.Field) *TokensListCall {
  11268. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11269. return c
  11270. }
  11271. // IfNoneMatch sets the optional parameter which makes the operation
  11272. // fail if the object's ETag matches the given value. This is useful for
  11273. // getting updates only after the object has changed since the last
  11274. // request. Use googleapi.IsNotModified to check whether the response
  11275. // error from Do is the result of In-None-Match.
  11276. func (c *TokensListCall) IfNoneMatch(entityTag string) *TokensListCall {
  11277. c.ifNoneMatch_ = entityTag
  11278. return c
  11279. }
  11280. // Context sets the context to be used in this call's Do method. Any
  11281. // pending HTTP request will be aborted if the provided context is
  11282. // canceled.
  11283. func (c *TokensListCall) Context(ctx context.Context) *TokensListCall {
  11284. c.ctx_ = ctx
  11285. return c
  11286. }
  11287. func (c *TokensListCall) doRequest(alt string) (*http.Response, error) {
  11288. var body io.Reader = nil
  11289. c.urlParams_.Set("alt", alt)
  11290. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/tokens")
  11291. urls += "?" + c.urlParams_.Encode()
  11292. req, _ := http.NewRequest("GET", urls, body)
  11293. googleapi.Expand(req.URL, map[string]string{
  11294. "userKey": c.userKey,
  11295. })
  11296. req.Header.Set("User-Agent", c.s.userAgent())
  11297. if c.ifNoneMatch_ != "" {
  11298. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  11299. }
  11300. if c.ctx_ != nil {
  11301. return ctxhttp.Do(c.ctx_, c.s.client, req)
  11302. }
  11303. return c.s.client.Do(req)
  11304. }
  11305. // Do executes the "directory.tokens.list" call.
  11306. // Exactly one of *Tokens or error will be non-nil. Any non-2xx status
  11307. // code is an error. Response headers are in either
  11308. // *Tokens.ServerResponse.Header or (if a response was returned at all)
  11309. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  11310. // check whether the returned error was because http.StatusNotModified
  11311. // was returned.
  11312. func (c *TokensListCall) Do(opts ...googleapi.CallOption) (*Tokens, error) {
  11313. gensupport.SetOptions(c.urlParams_, opts...)
  11314. res, err := c.doRequest("json")
  11315. if res != nil && res.StatusCode == http.StatusNotModified {
  11316. if res.Body != nil {
  11317. res.Body.Close()
  11318. }
  11319. return nil, &googleapi.Error{
  11320. Code: res.StatusCode,
  11321. Header: res.Header,
  11322. }
  11323. }
  11324. if err != nil {
  11325. return nil, err
  11326. }
  11327. defer googleapi.CloseBody(res)
  11328. if err := googleapi.CheckResponse(res); err != nil {
  11329. return nil, err
  11330. }
  11331. ret := &Tokens{
  11332. ServerResponse: googleapi.ServerResponse{
  11333. Header: res.Header,
  11334. HTTPStatusCode: res.StatusCode,
  11335. },
  11336. }
  11337. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  11338. return nil, err
  11339. }
  11340. return ret, nil
  11341. // {
  11342. // "description": "Returns the set of tokens specified user has issued to 3rd party applications.",
  11343. // "httpMethod": "GET",
  11344. // "id": "directory.tokens.list",
  11345. // "parameterOrder": [
  11346. // "userKey"
  11347. // ],
  11348. // "parameters": {
  11349. // "userKey": {
  11350. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  11351. // "location": "path",
  11352. // "required": true,
  11353. // "type": "string"
  11354. // }
  11355. // },
  11356. // "path": "users/{userKey}/tokens",
  11357. // "response": {
  11358. // "$ref": "Tokens"
  11359. // },
  11360. // "scopes": [
  11361. // "https://www.googleapis.com/auth/admin.directory.user.security"
  11362. // ]
  11363. // }
  11364. }
  11365. // method id "directory.users.delete":
  11366. type UsersDeleteCall struct {
  11367. s *Service
  11368. userKey string
  11369. urlParams_ gensupport.URLParams
  11370. ctx_ context.Context
  11371. }
  11372. // Delete: Delete user
  11373. func (r *UsersService) Delete(userKey string) *UsersDeleteCall {
  11374. c := &UsersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11375. c.userKey = userKey
  11376. return c
  11377. }
  11378. // Fields allows partial responses to be retrieved. See
  11379. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11380. // for more information.
  11381. func (c *UsersDeleteCall) Fields(s ...googleapi.Field) *UsersDeleteCall {
  11382. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11383. return c
  11384. }
  11385. // Context sets the context to be used in this call's Do method. Any
  11386. // pending HTTP request will be aborted if the provided context is
  11387. // canceled.
  11388. func (c *UsersDeleteCall) Context(ctx context.Context) *UsersDeleteCall {
  11389. c.ctx_ = ctx
  11390. return c
  11391. }
  11392. func (c *UsersDeleteCall) doRequest(alt string) (*http.Response, error) {
  11393. var body io.Reader = nil
  11394. c.urlParams_.Set("alt", alt)
  11395. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}")
  11396. urls += "?" + c.urlParams_.Encode()
  11397. req, _ := http.NewRequest("DELETE", urls, body)
  11398. googleapi.Expand(req.URL, map[string]string{
  11399. "userKey": c.userKey,
  11400. })
  11401. req.Header.Set("User-Agent", c.s.userAgent())
  11402. if c.ctx_ != nil {
  11403. return ctxhttp.Do(c.ctx_, c.s.client, req)
  11404. }
  11405. return c.s.client.Do(req)
  11406. }
  11407. // Do executes the "directory.users.delete" call.
  11408. func (c *UsersDeleteCall) Do(opts ...googleapi.CallOption) error {
  11409. gensupport.SetOptions(c.urlParams_, opts...)
  11410. res, err := c.doRequest("json")
  11411. if err != nil {
  11412. return err
  11413. }
  11414. defer googleapi.CloseBody(res)
  11415. if err := googleapi.CheckResponse(res); err != nil {
  11416. return err
  11417. }
  11418. return nil
  11419. // {
  11420. // "description": "Delete user",
  11421. // "httpMethod": "DELETE",
  11422. // "id": "directory.users.delete",
  11423. // "parameterOrder": [
  11424. // "userKey"
  11425. // ],
  11426. // "parameters": {
  11427. // "userKey": {
  11428. // "description": "Email or immutable Id of the user",
  11429. // "location": "path",
  11430. // "required": true,
  11431. // "type": "string"
  11432. // }
  11433. // },
  11434. // "path": "users/{userKey}",
  11435. // "scopes": [
  11436. // "https://www.googleapis.com/auth/admin.directory.user"
  11437. // ]
  11438. // }
  11439. }
  11440. // method id "directory.users.get":
  11441. type UsersGetCall struct {
  11442. s *Service
  11443. userKey string
  11444. urlParams_ gensupport.URLParams
  11445. ifNoneMatch_ string
  11446. ctx_ context.Context
  11447. }
  11448. // Get: retrieve user
  11449. func (r *UsersService) Get(userKey string) *UsersGetCall {
  11450. c := &UsersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11451. c.userKey = userKey
  11452. return c
  11453. }
  11454. // CustomFieldMask sets the optional parameter "customFieldMask":
  11455. // Comma-separated list of schema names. All fields from these schemas
  11456. // are fetched. This should only be set when projection=custom.
  11457. func (c *UsersGetCall) CustomFieldMask(customFieldMask string) *UsersGetCall {
  11458. c.urlParams_.Set("customFieldMask", customFieldMask)
  11459. return c
  11460. }
  11461. // Projection sets the optional parameter "projection": What subset of
  11462. // fields to fetch for this user.
  11463. //
  11464. // Possible values:
  11465. // "basic" (default) - Do not include any custom fields for the user.
  11466. // "custom" - Include custom fields from schemas mentioned in
  11467. // customFieldMask.
  11468. // "full" - Include all fields associated with this user.
  11469. func (c *UsersGetCall) Projection(projection string) *UsersGetCall {
  11470. c.urlParams_.Set("projection", projection)
  11471. return c
  11472. }
  11473. // ViewType sets the optional parameter "viewType": Whether to fetch the
  11474. // ADMIN_VIEW or DOMAIN_PUBLIC view of the user.
  11475. //
  11476. // Possible values:
  11477. // "admin_view" (default) - Fetches the ADMIN_VIEW of the user.
  11478. // "domain_public" - Fetches the DOMAIN_PUBLIC view of the user.
  11479. func (c *UsersGetCall) ViewType(viewType string) *UsersGetCall {
  11480. c.urlParams_.Set("viewType", viewType)
  11481. return c
  11482. }
  11483. // Fields allows partial responses to be retrieved. See
  11484. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11485. // for more information.
  11486. func (c *UsersGetCall) Fields(s ...googleapi.Field) *UsersGetCall {
  11487. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11488. return c
  11489. }
  11490. // IfNoneMatch sets the optional parameter which makes the operation
  11491. // fail if the object's ETag matches the given value. This is useful for
  11492. // getting updates only after the object has changed since the last
  11493. // request. Use googleapi.IsNotModified to check whether the response
  11494. // error from Do is the result of In-None-Match.
  11495. func (c *UsersGetCall) IfNoneMatch(entityTag string) *UsersGetCall {
  11496. c.ifNoneMatch_ = entityTag
  11497. return c
  11498. }
  11499. // Context sets the context to be used in this call's Do method. Any
  11500. // pending HTTP request will be aborted if the provided context is
  11501. // canceled.
  11502. func (c *UsersGetCall) Context(ctx context.Context) *UsersGetCall {
  11503. c.ctx_ = ctx
  11504. return c
  11505. }
  11506. func (c *UsersGetCall) doRequest(alt string) (*http.Response, error) {
  11507. var body io.Reader = nil
  11508. c.urlParams_.Set("alt", alt)
  11509. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}")
  11510. urls += "?" + c.urlParams_.Encode()
  11511. req, _ := http.NewRequest("GET", urls, body)
  11512. googleapi.Expand(req.URL, map[string]string{
  11513. "userKey": c.userKey,
  11514. })
  11515. req.Header.Set("User-Agent", c.s.userAgent())
  11516. if c.ifNoneMatch_ != "" {
  11517. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  11518. }
  11519. if c.ctx_ != nil {
  11520. return ctxhttp.Do(c.ctx_, c.s.client, req)
  11521. }
  11522. return c.s.client.Do(req)
  11523. }
  11524. // Do executes the "directory.users.get" call.
  11525. // Exactly one of *User or error will be non-nil. Any non-2xx status
  11526. // code is an error. Response headers are in either
  11527. // *User.ServerResponse.Header or (if a response was returned at all) in
  11528. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  11529. // whether the returned error was because http.StatusNotModified was
  11530. // returned.
  11531. func (c *UsersGetCall) Do(opts ...googleapi.CallOption) (*User, error) {
  11532. gensupport.SetOptions(c.urlParams_, opts...)
  11533. res, err := c.doRequest("json")
  11534. if res != nil && res.StatusCode == http.StatusNotModified {
  11535. if res.Body != nil {
  11536. res.Body.Close()
  11537. }
  11538. return nil, &googleapi.Error{
  11539. Code: res.StatusCode,
  11540. Header: res.Header,
  11541. }
  11542. }
  11543. if err != nil {
  11544. return nil, err
  11545. }
  11546. defer googleapi.CloseBody(res)
  11547. if err := googleapi.CheckResponse(res); err != nil {
  11548. return nil, err
  11549. }
  11550. ret := &User{
  11551. ServerResponse: googleapi.ServerResponse{
  11552. Header: res.Header,
  11553. HTTPStatusCode: res.StatusCode,
  11554. },
  11555. }
  11556. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  11557. return nil, err
  11558. }
  11559. return ret, nil
  11560. // {
  11561. // "description": "retrieve user",
  11562. // "httpMethod": "GET",
  11563. // "id": "directory.users.get",
  11564. // "parameterOrder": [
  11565. // "userKey"
  11566. // ],
  11567. // "parameters": {
  11568. // "customFieldMask": {
  11569. // "description": "Comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom.",
  11570. // "location": "query",
  11571. // "type": "string"
  11572. // },
  11573. // "projection": {
  11574. // "default": "basic",
  11575. // "description": "What subset of fields to fetch for this user.",
  11576. // "enum": [
  11577. // "basic",
  11578. // "custom",
  11579. // "full"
  11580. // ],
  11581. // "enumDescriptions": [
  11582. // "Do not include any custom fields for the user.",
  11583. // "Include custom fields from schemas mentioned in customFieldMask.",
  11584. // "Include all fields associated with this user."
  11585. // ],
  11586. // "location": "query",
  11587. // "type": "string"
  11588. // },
  11589. // "userKey": {
  11590. // "description": "Email or immutable Id of the user",
  11591. // "location": "path",
  11592. // "required": true,
  11593. // "type": "string"
  11594. // },
  11595. // "viewType": {
  11596. // "default": "admin_view",
  11597. // "description": "Whether to fetch the ADMIN_VIEW or DOMAIN_PUBLIC view of the user.",
  11598. // "enum": [
  11599. // "admin_view",
  11600. // "domain_public"
  11601. // ],
  11602. // "enumDescriptions": [
  11603. // "Fetches the ADMIN_VIEW of the user.",
  11604. // "Fetches the DOMAIN_PUBLIC view of the user."
  11605. // ],
  11606. // "location": "query",
  11607. // "type": "string"
  11608. // }
  11609. // },
  11610. // "path": "users/{userKey}",
  11611. // "response": {
  11612. // "$ref": "User"
  11613. // },
  11614. // "scopes": [
  11615. // "https://www.googleapis.com/auth/admin.directory.user",
  11616. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  11617. // ]
  11618. // }
  11619. }
  11620. // method id "directory.users.insert":
  11621. type UsersInsertCall struct {
  11622. s *Service
  11623. user *User
  11624. urlParams_ gensupport.URLParams
  11625. ctx_ context.Context
  11626. }
  11627. // Insert: create user.
  11628. func (r *UsersService) Insert(user *User) *UsersInsertCall {
  11629. c := &UsersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11630. c.user = user
  11631. return c
  11632. }
  11633. // Fields allows partial responses to be retrieved. See
  11634. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11635. // for more information.
  11636. func (c *UsersInsertCall) Fields(s ...googleapi.Field) *UsersInsertCall {
  11637. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11638. return c
  11639. }
  11640. // Context sets the context to be used in this call's Do method. Any
  11641. // pending HTTP request will be aborted if the provided context is
  11642. // canceled.
  11643. func (c *UsersInsertCall) Context(ctx context.Context) *UsersInsertCall {
  11644. c.ctx_ = ctx
  11645. return c
  11646. }
  11647. func (c *UsersInsertCall) doRequest(alt string) (*http.Response, error) {
  11648. var body io.Reader = nil
  11649. body, err := googleapi.WithoutDataWrapper.JSONReader(c.user)
  11650. if err != nil {
  11651. return nil, err
  11652. }
  11653. ctype := "application/json"
  11654. c.urlParams_.Set("alt", alt)
  11655. urls := googleapi.ResolveRelative(c.s.BasePath, "users")
  11656. urls += "?" + c.urlParams_.Encode()
  11657. req, _ := http.NewRequest("POST", urls, body)
  11658. googleapi.SetOpaque(req.URL)
  11659. req.Header.Set("Content-Type", ctype)
  11660. req.Header.Set("User-Agent", c.s.userAgent())
  11661. if c.ctx_ != nil {
  11662. return ctxhttp.Do(c.ctx_, c.s.client, req)
  11663. }
  11664. return c.s.client.Do(req)
  11665. }
  11666. // Do executes the "directory.users.insert" call.
  11667. // Exactly one of *User or error will be non-nil. Any non-2xx status
  11668. // code is an error. Response headers are in either
  11669. // *User.ServerResponse.Header or (if a response was returned at all) in
  11670. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  11671. // whether the returned error was because http.StatusNotModified was
  11672. // returned.
  11673. func (c *UsersInsertCall) Do(opts ...googleapi.CallOption) (*User, error) {
  11674. gensupport.SetOptions(c.urlParams_, opts...)
  11675. res, err := c.doRequest("json")
  11676. if res != nil && res.StatusCode == http.StatusNotModified {
  11677. if res.Body != nil {
  11678. res.Body.Close()
  11679. }
  11680. return nil, &googleapi.Error{
  11681. Code: res.StatusCode,
  11682. Header: res.Header,
  11683. }
  11684. }
  11685. if err != nil {
  11686. return nil, err
  11687. }
  11688. defer googleapi.CloseBody(res)
  11689. if err := googleapi.CheckResponse(res); err != nil {
  11690. return nil, err
  11691. }
  11692. ret := &User{
  11693. ServerResponse: googleapi.ServerResponse{
  11694. Header: res.Header,
  11695. HTTPStatusCode: res.StatusCode,
  11696. },
  11697. }
  11698. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  11699. return nil, err
  11700. }
  11701. return ret, nil
  11702. // {
  11703. // "description": "create user.",
  11704. // "httpMethod": "POST",
  11705. // "id": "directory.users.insert",
  11706. // "path": "users",
  11707. // "request": {
  11708. // "$ref": "User"
  11709. // },
  11710. // "response": {
  11711. // "$ref": "User"
  11712. // },
  11713. // "scopes": [
  11714. // "https://www.googleapis.com/auth/admin.directory.user"
  11715. // ]
  11716. // }
  11717. }
  11718. // method id "directory.users.list":
  11719. type UsersListCall struct {
  11720. s *Service
  11721. urlParams_ gensupport.URLParams
  11722. ifNoneMatch_ string
  11723. ctx_ context.Context
  11724. }
  11725. // List: Retrieve either deleted users or all users in a domain
  11726. // (paginated)
  11727. func (r *UsersService) List() *UsersListCall {
  11728. c := &UsersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11729. return c
  11730. }
  11731. // CustomFieldMask sets the optional parameter "customFieldMask":
  11732. // Comma-separated list of schema names. All fields from these schemas
  11733. // are fetched. This should only be set when projection=custom.
  11734. func (c *UsersListCall) CustomFieldMask(customFieldMask string) *UsersListCall {
  11735. c.urlParams_.Set("customFieldMask", customFieldMask)
  11736. return c
  11737. }
  11738. // Customer sets the optional parameter "customer": Immutable id of the
  11739. // Google Apps account. In case of multi-domain, to fetch all users for
  11740. // a customer, fill this field instead of domain.
  11741. func (c *UsersListCall) Customer(customer string) *UsersListCall {
  11742. c.urlParams_.Set("customer", customer)
  11743. return c
  11744. }
  11745. // Domain sets the optional parameter "domain": Name of the domain. Fill
  11746. // this field to get users from only this domain. To return all users in
  11747. // a multi-domain fill customer field instead.
  11748. func (c *UsersListCall) Domain(domain string) *UsersListCall {
  11749. c.urlParams_.Set("domain", domain)
  11750. return c
  11751. }
  11752. // Event sets the optional parameter "event": Event on which
  11753. // subscription is intended (if subscribing)
  11754. //
  11755. // Possible values:
  11756. // "add" - User Created Event
  11757. // "delete" - User Deleted Event
  11758. // "makeAdmin" - User Admin Status Change Event
  11759. // "undelete" - User Undeleted Event
  11760. // "update" - User Updated Event
  11761. func (c *UsersListCall) Event(event string) *UsersListCall {
  11762. c.urlParams_.Set("event", event)
  11763. return c
  11764. }
  11765. // MaxResults sets the optional parameter "maxResults": Maximum number
  11766. // of results to return. Default is 100. Max allowed is 500
  11767. func (c *UsersListCall) MaxResults(maxResults int64) *UsersListCall {
  11768. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  11769. return c
  11770. }
  11771. // OrderBy sets the optional parameter "orderBy": Column to use for
  11772. // sorting results
  11773. //
  11774. // Possible values:
  11775. // "email" - Primary email of the user.
  11776. // "familyName" - User's family name.
  11777. // "givenName" - User's given name.
  11778. func (c *UsersListCall) OrderBy(orderBy string) *UsersListCall {
  11779. c.urlParams_.Set("orderBy", orderBy)
  11780. return c
  11781. }
  11782. // PageToken sets the optional parameter "pageToken": Token to specify
  11783. // next page in the list
  11784. func (c *UsersListCall) PageToken(pageToken string) *UsersListCall {
  11785. c.urlParams_.Set("pageToken", pageToken)
  11786. return c
  11787. }
  11788. // Projection sets the optional parameter "projection": What subset of
  11789. // fields to fetch for this user.
  11790. //
  11791. // Possible values:
  11792. // "basic" (default) - Do not include any custom fields for the user.
  11793. // "custom" - Include custom fields from schemas mentioned in
  11794. // customFieldMask.
  11795. // "full" - Include all fields associated with this user.
  11796. func (c *UsersListCall) Projection(projection string) *UsersListCall {
  11797. c.urlParams_.Set("projection", projection)
  11798. return c
  11799. }
  11800. // Query sets the optional parameter "query": Query string search.
  11801. // Should be of the form "". Complete documentation is at
  11802. // https://developers.google.com/admin-sdk/directory/v1/guides/search-users
  11803. func (c *UsersListCall) Query(query string) *UsersListCall {
  11804. c.urlParams_.Set("query", query)
  11805. return c
  11806. }
  11807. // ShowDeleted sets the optional parameter "showDeleted": If set to true
  11808. // retrieves the list of deleted users. Default is false
  11809. func (c *UsersListCall) ShowDeleted(showDeleted string) *UsersListCall {
  11810. c.urlParams_.Set("showDeleted", showDeleted)
  11811. return c
  11812. }
  11813. // SortOrder sets the optional parameter "sortOrder": Whether to return
  11814. // results in ascending or descending order.
  11815. //
  11816. // Possible values:
  11817. // "ASCENDING" - Ascending order.
  11818. // "DESCENDING" - Descending order.
  11819. func (c *UsersListCall) SortOrder(sortOrder string) *UsersListCall {
  11820. c.urlParams_.Set("sortOrder", sortOrder)
  11821. return c
  11822. }
  11823. // ViewType sets the optional parameter "viewType": Whether to fetch the
  11824. // ADMIN_VIEW or DOMAIN_PUBLIC view of the user.
  11825. //
  11826. // Possible values:
  11827. // "admin_view" (default) - Fetches the ADMIN_VIEW of the user.
  11828. // "domain_public" - Fetches the DOMAIN_PUBLIC view of the user.
  11829. func (c *UsersListCall) ViewType(viewType string) *UsersListCall {
  11830. c.urlParams_.Set("viewType", viewType)
  11831. return c
  11832. }
  11833. // Fields allows partial responses to be retrieved. See
  11834. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11835. // for more information.
  11836. func (c *UsersListCall) Fields(s ...googleapi.Field) *UsersListCall {
  11837. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11838. return c
  11839. }
  11840. // IfNoneMatch sets the optional parameter which makes the operation
  11841. // fail if the object's ETag matches the given value. This is useful for
  11842. // getting updates only after the object has changed since the last
  11843. // request. Use googleapi.IsNotModified to check whether the response
  11844. // error from Do is the result of In-None-Match.
  11845. func (c *UsersListCall) IfNoneMatch(entityTag string) *UsersListCall {
  11846. c.ifNoneMatch_ = entityTag
  11847. return c
  11848. }
  11849. // Context sets the context to be used in this call's Do method. Any
  11850. // pending HTTP request will be aborted if the provided context is
  11851. // canceled.
  11852. func (c *UsersListCall) Context(ctx context.Context) *UsersListCall {
  11853. c.ctx_ = ctx
  11854. return c
  11855. }
  11856. func (c *UsersListCall) doRequest(alt string) (*http.Response, error) {
  11857. var body io.Reader = nil
  11858. c.urlParams_.Set("alt", alt)
  11859. urls := googleapi.ResolveRelative(c.s.BasePath, "users")
  11860. urls += "?" + c.urlParams_.Encode()
  11861. req, _ := http.NewRequest("GET", urls, body)
  11862. googleapi.SetOpaque(req.URL)
  11863. req.Header.Set("User-Agent", c.s.userAgent())
  11864. if c.ifNoneMatch_ != "" {
  11865. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  11866. }
  11867. if c.ctx_ != nil {
  11868. return ctxhttp.Do(c.ctx_, c.s.client, req)
  11869. }
  11870. return c.s.client.Do(req)
  11871. }
  11872. // Do executes the "directory.users.list" call.
  11873. // Exactly one of *Users or error will be non-nil. Any non-2xx status
  11874. // code is an error. Response headers are in either
  11875. // *Users.ServerResponse.Header or (if a response was returned at all)
  11876. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  11877. // check whether the returned error was because http.StatusNotModified
  11878. // was returned.
  11879. func (c *UsersListCall) Do(opts ...googleapi.CallOption) (*Users, error) {
  11880. gensupport.SetOptions(c.urlParams_, opts...)
  11881. res, err := c.doRequest("json")
  11882. if res != nil && res.StatusCode == http.StatusNotModified {
  11883. if res.Body != nil {
  11884. res.Body.Close()
  11885. }
  11886. return nil, &googleapi.Error{
  11887. Code: res.StatusCode,
  11888. Header: res.Header,
  11889. }
  11890. }
  11891. if err != nil {
  11892. return nil, err
  11893. }
  11894. defer googleapi.CloseBody(res)
  11895. if err := googleapi.CheckResponse(res); err != nil {
  11896. return nil, err
  11897. }
  11898. ret := &Users{
  11899. ServerResponse: googleapi.ServerResponse{
  11900. Header: res.Header,
  11901. HTTPStatusCode: res.StatusCode,
  11902. },
  11903. }
  11904. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  11905. return nil, err
  11906. }
  11907. return ret, nil
  11908. // {
  11909. // "description": "Retrieve either deleted users or all users in a domain (paginated)",
  11910. // "httpMethod": "GET",
  11911. // "id": "directory.users.list",
  11912. // "parameters": {
  11913. // "customFieldMask": {
  11914. // "description": "Comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom.",
  11915. // "location": "query",
  11916. // "type": "string"
  11917. // },
  11918. // "customer": {
  11919. // "description": "Immutable id of the Google Apps account. In case of multi-domain, to fetch all users for a customer, fill this field instead of domain.",
  11920. // "location": "query",
  11921. // "type": "string"
  11922. // },
  11923. // "domain": {
  11924. // "description": "Name of the domain. Fill this field to get users from only this domain. To return all users in a multi-domain fill customer field instead.",
  11925. // "location": "query",
  11926. // "type": "string"
  11927. // },
  11928. // "event": {
  11929. // "description": "Event on which subscription is intended (if subscribing)",
  11930. // "enum": [
  11931. // "add",
  11932. // "delete",
  11933. // "makeAdmin",
  11934. // "undelete",
  11935. // "update"
  11936. // ],
  11937. // "enumDescriptions": [
  11938. // "User Created Event",
  11939. // "User Deleted Event",
  11940. // "User Admin Status Change Event",
  11941. // "User Undeleted Event",
  11942. // "User Updated Event"
  11943. // ],
  11944. // "location": "query",
  11945. // "type": "string"
  11946. // },
  11947. // "maxResults": {
  11948. // "description": "Maximum number of results to return. Default is 100. Max allowed is 500",
  11949. // "format": "int32",
  11950. // "location": "query",
  11951. // "maximum": "500",
  11952. // "minimum": "1",
  11953. // "type": "integer"
  11954. // },
  11955. // "orderBy": {
  11956. // "description": "Column to use for sorting results",
  11957. // "enum": [
  11958. // "email",
  11959. // "familyName",
  11960. // "givenName"
  11961. // ],
  11962. // "enumDescriptions": [
  11963. // "Primary email of the user.",
  11964. // "User's family name.",
  11965. // "User's given name."
  11966. // ],
  11967. // "location": "query",
  11968. // "type": "string"
  11969. // },
  11970. // "pageToken": {
  11971. // "description": "Token to specify next page in the list",
  11972. // "location": "query",
  11973. // "type": "string"
  11974. // },
  11975. // "projection": {
  11976. // "default": "basic",
  11977. // "description": "What subset of fields to fetch for this user.",
  11978. // "enum": [
  11979. // "basic",
  11980. // "custom",
  11981. // "full"
  11982. // ],
  11983. // "enumDescriptions": [
  11984. // "Do not include any custom fields for the user.",
  11985. // "Include custom fields from schemas mentioned in customFieldMask.",
  11986. // "Include all fields associated with this user."
  11987. // ],
  11988. // "location": "query",
  11989. // "type": "string"
  11990. // },
  11991. // "query": {
  11992. // "description": "Query string search. Should be of the form \"\". Complete documentation is at https://developers.google.com/admin-sdk/directory/v1/guides/search-users",
  11993. // "location": "query",
  11994. // "type": "string"
  11995. // },
  11996. // "showDeleted": {
  11997. // "description": "If set to true retrieves the list of deleted users. Default is false",
  11998. // "location": "query",
  11999. // "type": "string"
  12000. // },
  12001. // "sortOrder": {
  12002. // "description": "Whether to return results in ascending or descending order.",
  12003. // "enum": [
  12004. // "ASCENDING",
  12005. // "DESCENDING"
  12006. // ],
  12007. // "enumDescriptions": [
  12008. // "Ascending order.",
  12009. // "Descending order."
  12010. // ],
  12011. // "location": "query",
  12012. // "type": "string"
  12013. // },
  12014. // "viewType": {
  12015. // "default": "admin_view",
  12016. // "description": "Whether to fetch the ADMIN_VIEW or DOMAIN_PUBLIC view of the user.",
  12017. // "enum": [
  12018. // "admin_view",
  12019. // "domain_public"
  12020. // ],
  12021. // "enumDescriptions": [
  12022. // "Fetches the ADMIN_VIEW of the user.",
  12023. // "Fetches the DOMAIN_PUBLIC view of the user."
  12024. // ],
  12025. // "location": "query",
  12026. // "type": "string"
  12027. // }
  12028. // },
  12029. // "path": "users",
  12030. // "response": {
  12031. // "$ref": "Users"
  12032. // },
  12033. // "scopes": [
  12034. // "https://www.googleapis.com/auth/admin.directory.user",
  12035. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  12036. // ],
  12037. // "supportsSubscription": true
  12038. // }
  12039. }
  12040. // Pages invokes f for each page of results.
  12041. // A non-nil error returned from f will halt the iteration.
  12042. // The provided context supersedes any context provided to the Context method.
  12043. func (c *UsersListCall) Pages(ctx context.Context, f func(*Users) error) error {
  12044. c.ctx_ = ctx
  12045. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  12046. for {
  12047. x, err := c.Do()
  12048. if err != nil {
  12049. return err
  12050. }
  12051. if err := f(x); err != nil {
  12052. return err
  12053. }
  12054. if x.NextPageToken == "" {
  12055. return nil
  12056. }
  12057. c.PageToken(x.NextPageToken)
  12058. }
  12059. }
  12060. // method id "directory.users.makeAdmin":
  12061. type UsersMakeAdminCall struct {
  12062. s *Service
  12063. userKey string
  12064. usermakeadmin *UserMakeAdmin
  12065. urlParams_ gensupport.URLParams
  12066. ctx_ context.Context
  12067. }
  12068. // MakeAdmin: change admin status of a user
  12069. func (r *UsersService) MakeAdmin(userKey string, usermakeadmin *UserMakeAdmin) *UsersMakeAdminCall {
  12070. c := &UsersMakeAdminCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12071. c.userKey = userKey
  12072. c.usermakeadmin = usermakeadmin
  12073. return c
  12074. }
  12075. // Fields allows partial responses to be retrieved. See
  12076. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12077. // for more information.
  12078. func (c *UsersMakeAdminCall) Fields(s ...googleapi.Field) *UsersMakeAdminCall {
  12079. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12080. return c
  12081. }
  12082. // Context sets the context to be used in this call's Do method. Any
  12083. // pending HTTP request will be aborted if the provided context is
  12084. // canceled.
  12085. func (c *UsersMakeAdminCall) Context(ctx context.Context) *UsersMakeAdminCall {
  12086. c.ctx_ = ctx
  12087. return c
  12088. }
  12089. func (c *UsersMakeAdminCall) doRequest(alt string) (*http.Response, error) {
  12090. var body io.Reader = nil
  12091. body, err := googleapi.WithoutDataWrapper.JSONReader(c.usermakeadmin)
  12092. if err != nil {
  12093. return nil, err
  12094. }
  12095. ctype := "application/json"
  12096. c.urlParams_.Set("alt", alt)
  12097. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/makeAdmin")
  12098. urls += "?" + c.urlParams_.Encode()
  12099. req, _ := http.NewRequest("POST", urls, body)
  12100. googleapi.Expand(req.URL, map[string]string{
  12101. "userKey": c.userKey,
  12102. })
  12103. req.Header.Set("Content-Type", ctype)
  12104. req.Header.Set("User-Agent", c.s.userAgent())
  12105. if c.ctx_ != nil {
  12106. return ctxhttp.Do(c.ctx_, c.s.client, req)
  12107. }
  12108. return c.s.client.Do(req)
  12109. }
  12110. // Do executes the "directory.users.makeAdmin" call.
  12111. func (c *UsersMakeAdminCall) Do(opts ...googleapi.CallOption) error {
  12112. gensupport.SetOptions(c.urlParams_, opts...)
  12113. res, err := c.doRequest("json")
  12114. if err != nil {
  12115. return err
  12116. }
  12117. defer googleapi.CloseBody(res)
  12118. if err := googleapi.CheckResponse(res); err != nil {
  12119. return err
  12120. }
  12121. return nil
  12122. // {
  12123. // "description": "change admin status of a user",
  12124. // "httpMethod": "POST",
  12125. // "id": "directory.users.makeAdmin",
  12126. // "parameterOrder": [
  12127. // "userKey"
  12128. // ],
  12129. // "parameters": {
  12130. // "userKey": {
  12131. // "description": "Email or immutable Id of the user as admin",
  12132. // "location": "path",
  12133. // "required": true,
  12134. // "type": "string"
  12135. // }
  12136. // },
  12137. // "path": "users/{userKey}/makeAdmin",
  12138. // "request": {
  12139. // "$ref": "UserMakeAdmin"
  12140. // },
  12141. // "scopes": [
  12142. // "https://www.googleapis.com/auth/admin.directory.user"
  12143. // ]
  12144. // }
  12145. }
  12146. // method id "directory.users.patch":
  12147. type UsersPatchCall struct {
  12148. s *Service
  12149. userKey string
  12150. user *User
  12151. urlParams_ gensupport.URLParams
  12152. ctx_ context.Context
  12153. }
  12154. // Patch: update user. This method supports patch semantics.
  12155. func (r *UsersService) Patch(userKey string, user *User) *UsersPatchCall {
  12156. c := &UsersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12157. c.userKey = userKey
  12158. c.user = user
  12159. return c
  12160. }
  12161. // Fields allows partial responses to be retrieved. See
  12162. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12163. // for more information.
  12164. func (c *UsersPatchCall) Fields(s ...googleapi.Field) *UsersPatchCall {
  12165. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12166. return c
  12167. }
  12168. // Context sets the context to be used in this call's Do method. Any
  12169. // pending HTTP request will be aborted if the provided context is
  12170. // canceled.
  12171. func (c *UsersPatchCall) Context(ctx context.Context) *UsersPatchCall {
  12172. c.ctx_ = ctx
  12173. return c
  12174. }
  12175. func (c *UsersPatchCall) doRequest(alt string) (*http.Response, error) {
  12176. var body io.Reader = nil
  12177. body, err := googleapi.WithoutDataWrapper.JSONReader(c.user)
  12178. if err != nil {
  12179. return nil, err
  12180. }
  12181. ctype := "application/json"
  12182. c.urlParams_.Set("alt", alt)
  12183. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}")
  12184. urls += "?" + c.urlParams_.Encode()
  12185. req, _ := http.NewRequest("PATCH", urls, body)
  12186. googleapi.Expand(req.URL, map[string]string{
  12187. "userKey": c.userKey,
  12188. })
  12189. req.Header.Set("Content-Type", ctype)
  12190. req.Header.Set("User-Agent", c.s.userAgent())
  12191. if c.ctx_ != nil {
  12192. return ctxhttp.Do(c.ctx_, c.s.client, req)
  12193. }
  12194. return c.s.client.Do(req)
  12195. }
  12196. // Do executes the "directory.users.patch" call.
  12197. // Exactly one of *User or error will be non-nil. Any non-2xx status
  12198. // code is an error. Response headers are in either
  12199. // *User.ServerResponse.Header or (if a response was returned at all) in
  12200. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  12201. // whether the returned error was because http.StatusNotModified was
  12202. // returned.
  12203. func (c *UsersPatchCall) Do(opts ...googleapi.CallOption) (*User, error) {
  12204. gensupport.SetOptions(c.urlParams_, opts...)
  12205. res, err := c.doRequest("json")
  12206. if res != nil && res.StatusCode == http.StatusNotModified {
  12207. if res.Body != nil {
  12208. res.Body.Close()
  12209. }
  12210. return nil, &googleapi.Error{
  12211. Code: res.StatusCode,
  12212. Header: res.Header,
  12213. }
  12214. }
  12215. if err != nil {
  12216. return nil, err
  12217. }
  12218. defer googleapi.CloseBody(res)
  12219. if err := googleapi.CheckResponse(res); err != nil {
  12220. return nil, err
  12221. }
  12222. ret := &User{
  12223. ServerResponse: googleapi.ServerResponse{
  12224. Header: res.Header,
  12225. HTTPStatusCode: res.StatusCode,
  12226. },
  12227. }
  12228. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  12229. return nil, err
  12230. }
  12231. return ret, nil
  12232. // {
  12233. // "description": "update user. This method supports patch semantics.",
  12234. // "httpMethod": "PATCH",
  12235. // "id": "directory.users.patch",
  12236. // "parameterOrder": [
  12237. // "userKey"
  12238. // ],
  12239. // "parameters": {
  12240. // "userKey": {
  12241. // "description": "Email or immutable Id of the user. If Id, it should match with id of user object",
  12242. // "location": "path",
  12243. // "required": true,
  12244. // "type": "string"
  12245. // }
  12246. // },
  12247. // "path": "users/{userKey}",
  12248. // "request": {
  12249. // "$ref": "User"
  12250. // },
  12251. // "response": {
  12252. // "$ref": "User"
  12253. // },
  12254. // "scopes": [
  12255. // "https://www.googleapis.com/auth/admin.directory.user"
  12256. // ]
  12257. // }
  12258. }
  12259. // method id "directory.users.undelete":
  12260. type UsersUndeleteCall struct {
  12261. s *Service
  12262. userKey string
  12263. userundelete *UserUndelete
  12264. urlParams_ gensupport.URLParams
  12265. ctx_ context.Context
  12266. }
  12267. // Undelete: Undelete a deleted user
  12268. func (r *UsersService) Undelete(userKey string, userundelete *UserUndelete) *UsersUndeleteCall {
  12269. c := &UsersUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12270. c.userKey = userKey
  12271. c.userundelete = userundelete
  12272. return c
  12273. }
  12274. // Fields allows partial responses to be retrieved. See
  12275. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12276. // for more information.
  12277. func (c *UsersUndeleteCall) Fields(s ...googleapi.Field) *UsersUndeleteCall {
  12278. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12279. return c
  12280. }
  12281. // Context sets the context to be used in this call's Do method. Any
  12282. // pending HTTP request will be aborted if the provided context is
  12283. // canceled.
  12284. func (c *UsersUndeleteCall) Context(ctx context.Context) *UsersUndeleteCall {
  12285. c.ctx_ = ctx
  12286. return c
  12287. }
  12288. func (c *UsersUndeleteCall) doRequest(alt string) (*http.Response, error) {
  12289. var body io.Reader = nil
  12290. body, err := googleapi.WithoutDataWrapper.JSONReader(c.userundelete)
  12291. if err != nil {
  12292. return nil, err
  12293. }
  12294. ctype := "application/json"
  12295. c.urlParams_.Set("alt", alt)
  12296. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/undelete")
  12297. urls += "?" + c.urlParams_.Encode()
  12298. req, _ := http.NewRequest("POST", urls, body)
  12299. googleapi.Expand(req.URL, map[string]string{
  12300. "userKey": c.userKey,
  12301. })
  12302. req.Header.Set("Content-Type", ctype)
  12303. req.Header.Set("User-Agent", c.s.userAgent())
  12304. if c.ctx_ != nil {
  12305. return ctxhttp.Do(c.ctx_, c.s.client, req)
  12306. }
  12307. return c.s.client.Do(req)
  12308. }
  12309. // Do executes the "directory.users.undelete" call.
  12310. func (c *UsersUndeleteCall) Do(opts ...googleapi.CallOption) error {
  12311. gensupport.SetOptions(c.urlParams_, opts...)
  12312. res, err := c.doRequest("json")
  12313. if err != nil {
  12314. return err
  12315. }
  12316. defer googleapi.CloseBody(res)
  12317. if err := googleapi.CheckResponse(res); err != nil {
  12318. return err
  12319. }
  12320. return nil
  12321. // {
  12322. // "description": "Undelete a deleted user",
  12323. // "httpMethod": "POST",
  12324. // "id": "directory.users.undelete",
  12325. // "parameterOrder": [
  12326. // "userKey"
  12327. // ],
  12328. // "parameters": {
  12329. // "userKey": {
  12330. // "description": "The immutable id of the user",
  12331. // "location": "path",
  12332. // "required": true,
  12333. // "type": "string"
  12334. // }
  12335. // },
  12336. // "path": "users/{userKey}/undelete",
  12337. // "request": {
  12338. // "$ref": "UserUndelete"
  12339. // },
  12340. // "scopes": [
  12341. // "https://www.googleapis.com/auth/admin.directory.user"
  12342. // ]
  12343. // }
  12344. }
  12345. // method id "directory.users.update":
  12346. type UsersUpdateCall struct {
  12347. s *Service
  12348. userKey string
  12349. user *User
  12350. urlParams_ gensupport.URLParams
  12351. ctx_ context.Context
  12352. }
  12353. // Update: update user
  12354. func (r *UsersService) Update(userKey string, user *User) *UsersUpdateCall {
  12355. c := &UsersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12356. c.userKey = userKey
  12357. c.user = user
  12358. return c
  12359. }
  12360. // Fields allows partial responses to be retrieved. See
  12361. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12362. // for more information.
  12363. func (c *UsersUpdateCall) Fields(s ...googleapi.Field) *UsersUpdateCall {
  12364. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12365. return c
  12366. }
  12367. // Context sets the context to be used in this call's Do method. Any
  12368. // pending HTTP request will be aborted if the provided context is
  12369. // canceled.
  12370. func (c *UsersUpdateCall) Context(ctx context.Context) *UsersUpdateCall {
  12371. c.ctx_ = ctx
  12372. return c
  12373. }
  12374. func (c *UsersUpdateCall) doRequest(alt string) (*http.Response, error) {
  12375. var body io.Reader = nil
  12376. body, err := googleapi.WithoutDataWrapper.JSONReader(c.user)
  12377. if err != nil {
  12378. return nil, err
  12379. }
  12380. ctype := "application/json"
  12381. c.urlParams_.Set("alt", alt)
  12382. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}")
  12383. urls += "?" + c.urlParams_.Encode()
  12384. req, _ := http.NewRequest("PUT", urls, body)
  12385. googleapi.Expand(req.URL, map[string]string{
  12386. "userKey": c.userKey,
  12387. })
  12388. req.Header.Set("Content-Type", ctype)
  12389. req.Header.Set("User-Agent", c.s.userAgent())
  12390. if c.ctx_ != nil {
  12391. return ctxhttp.Do(c.ctx_, c.s.client, req)
  12392. }
  12393. return c.s.client.Do(req)
  12394. }
  12395. // Do executes the "directory.users.update" call.
  12396. // Exactly one of *User or error will be non-nil. Any non-2xx status
  12397. // code is an error. Response headers are in either
  12398. // *User.ServerResponse.Header or (if a response was returned at all) in
  12399. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  12400. // whether the returned error was because http.StatusNotModified was
  12401. // returned.
  12402. func (c *UsersUpdateCall) Do(opts ...googleapi.CallOption) (*User, error) {
  12403. gensupport.SetOptions(c.urlParams_, opts...)
  12404. res, err := c.doRequest("json")
  12405. if res != nil && res.StatusCode == http.StatusNotModified {
  12406. if res.Body != nil {
  12407. res.Body.Close()
  12408. }
  12409. return nil, &googleapi.Error{
  12410. Code: res.StatusCode,
  12411. Header: res.Header,
  12412. }
  12413. }
  12414. if err != nil {
  12415. return nil, err
  12416. }
  12417. defer googleapi.CloseBody(res)
  12418. if err := googleapi.CheckResponse(res); err != nil {
  12419. return nil, err
  12420. }
  12421. ret := &User{
  12422. ServerResponse: googleapi.ServerResponse{
  12423. Header: res.Header,
  12424. HTTPStatusCode: res.StatusCode,
  12425. },
  12426. }
  12427. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  12428. return nil, err
  12429. }
  12430. return ret, nil
  12431. // {
  12432. // "description": "update user",
  12433. // "httpMethod": "PUT",
  12434. // "id": "directory.users.update",
  12435. // "parameterOrder": [
  12436. // "userKey"
  12437. // ],
  12438. // "parameters": {
  12439. // "userKey": {
  12440. // "description": "Email or immutable Id of the user. If Id, it should match with id of user object",
  12441. // "location": "path",
  12442. // "required": true,
  12443. // "type": "string"
  12444. // }
  12445. // },
  12446. // "path": "users/{userKey}",
  12447. // "request": {
  12448. // "$ref": "User"
  12449. // },
  12450. // "response": {
  12451. // "$ref": "User"
  12452. // },
  12453. // "scopes": [
  12454. // "https://www.googleapis.com/auth/admin.directory.user"
  12455. // ]
  12456. // }
  12457. }
  12458. // method id "directory.users.watch":
  12459. type UsersWatchCall struct {
  12460. s *Service
  12461. channel *Channel
  12462. urlParams_ gensupport.URLParams
  12463. ctx_ context.Context
  12464. }
  12465. // Watch: Watch for changes in users list
  12466. func (r *UsersService) Watch(channel *Channel) *UsersWatchCall {
  12467. c := &UsersWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12468. c.channel = channel
  12469. return c
  12470. }
  12471. // CustomFieldMask sets the optional parameter "customFieldMask":
  12472. // Comma-separated list of schema names. All fields from these schemas
  12473. // are fetched. This should only be set when projection=custom.
  12474. func (c *UsersWatchCall) CustomFieldMask(customFieldMask string) *UsersWatchCall {
  12475. c.urlParams_.Set("customFieldMask", customFieldMask)
  12476. return c
  12477. }
  12478. // Customer sets the optional parameter "customer": Immutable id of the
  12479. // Google Apps account. In case of multi-domain, to fetch all users for
  12480. // a customer, fill this field instead of domain.
  12481. func (c *UsersWatchCall) Customer(customer string) *UsersWatchCall {
  12482. c.urlParams_.Set("customer", customer)
  12483. return c
  12484. }
  12485. // Domain sets the optional parameter "domain": Name of the domain. Fill
  12486. // this field to get users from only this domain. To return all users in
  12487. // a multi-domain fill customer field instead.
  12488. func (c *UsersWatchCall) Domain(domain string) *UsersWatchCall {
  12489. c.urlParams_.Set("domain", domain)
  12490. return c
  12491. }
  12492. // Event sets the optional parameter "event": Event on which
  12493. // subscription is intended (if subscribing)
  12494. //
  12495. // Possible values:
  12496. // "add" - User Created Event
  12497. // "delete" - User Deleted Event
  12498. // "makeAdmin" - User Admin Status Change Event
  12499. // "undelete" - User Undeleted Event
  12500. // "update" - User Updated Event
  12501. func (c *UsersWatchCall) Event(event string) *UsersWatchCall {
  12502. c.urlParams_.Set("event", event)
  12503. return c
  12504. }
  12505. // MaxResults sets the optional parameter "maxResults": Maximum number
  12506. // of results to return. Default is 100. Max allowed is 500
  12507. func (c *UsersWatchCall) MaxResults(maxResults int64) *UsersWatchCall {
  12508. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  12509. return c
  12510. }
  12511. // OrderBy sets the optional parameter "orderBy": Column to use for
  12512. // sorting results
  12513. //
  12514. // Possible values:
  12515. // "email" - Primary email of the user.
  12516. // "familyName" - User's family name.
  12517. // "givenName" - User's given name.
  12518. func (c *UsersWatchCall) OrderBy(orderBy string) *UsersWatchCall {
  12519. c.urlParams_.Set("orderBy", orderBy)
  12520. return c
  12521. }
  12522. // PageToken sets the optional parameter "pageToken": Token to specify
  12523. // next page in the list
  12524. func (c *UsersWatchCall) PageToken(pageToken string) *UsersWatchCall {
  12525. c.urlParams_.Set("pageToken", pageToken)
  12526. return c
  12527. }
  12528. // Projection sets the optional parameter "projection": What subset of
  12529. // fields to fetch for this user.
  12530. //
  12531. // Possible values:
  12532. // "basic" (default) - Do not include any custom fields for the user.
  12533. // "custom" - Include custom fields from schemas mentioned in
  12534. // customFieldMask.
  12535. // "full" - Include all fields associated with this user.
  12536. func (c *UsersWatchCall) Projection(projection string) *UsersWatchCall {
  12537. c.urlParams_.Set("projection", projection)
  12538. return c
  12539. }
  12540. // Query sets the optional parameter "query": Query string search.
  12541. // Should be of the form "". Complete documentation is at
  12542. // https://developers.google.com/admin-sdk/directory/v1/guides/search-users
  12543. func (c *UsersWatchCall) Query(query string) *UsersWatchCall {
  12544. c.urlParams_.Set("query", query)
  12545. return c
  12546. }
  12547. // ShowDeleted sets the optional parameter "showDeleted": If set to true
  12548. // retrieves the list of deleted users. Default is false
  12549. func (c *UsersWatchCall) ShowDeleted(showDeleted string) *UsersWatchCall {
  12550. c.urlParams_.Set("showDeleted", showDeleted)
  12551. return c
  12552. }
  12553. // SortOrder sets the optional parameter "sortOrder": Whether to return
  12554. // results in ascending or descending order.
  12555. //
  12556. // Possible values:
  12557. // "ASCENDING" - Ascending order.
  12558. // "DESCENDING" - Descending order.
  12559. func (c *UsersWatchCall) SortOrder(sortOrder string) *UsersWatchCall {
  12560. c.urlParams_.Set("sortOrder", sortOrder)
  12561. return c
  12562. }
  12563. // ViewType sets the optional parameter "viewType": Whether to fetch the
  12564. // ADMIN_VIEW or DOMAIN_PUBLIC view of the user.
  12565. //
  12566. // Possible values:
  12567. // "admin_view" (default) - Fetches the ADMIN_VIEW of the user.
  12568. // "domain_public" - Fetches the DOMAIN_PUBLIC view of the user.
  12569. func (c *UsersWatchCall) ViewType(viewType string) *UsersWatchCall {
  12570. c.urlParams_.Set("viewType", viewType)
  12571. return c
  12572. }
  12573. // Fields allows partial responses to be retrieved. See
  12574. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12575. // for more information.
  12576. func (c *UsersWatchCall) Fields(s ...googleapi.Field) *UsersWatchCall {
  12577. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12578. return c
  12579. }
  12580. // Context sets the context to be used in this call's Do method. Any
  12581. // pending HTTP request will be aborted if the provided context is
  12582. // canceled.
  12583. func (c *UsersWatchCall) Context(ctx context.Context) *UsersWatchCall {
  12584. c.ctx_ = ctx
  12585. return c
  12586. }
  12587. func (c *UsersWatchCall) doRequest(alt string) (*http.Response, error) {
  12588. var body io.Reader = nil
  12589. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  12590. if err != nil {
  12591. return nil, err
  12592. }
  12593. ctype := "application/json"
  12594. c.urlParams_.Set("alt", alt)
  12595. urls := googleapi.ResolveRelative(c.s.BasePath, "users/watch")
  12596. urls += "?" + c.urlParams_.Encode()
  12597. req, _ := http.NewRequest("POST", urls, body)
  12598. googleapi.SetOpaque(req.URL)
  12599. req.Header.Set("Content-Type", ctype)
  12600. req.Header.Set("User-Agent", c.s.userAgent())
  12601. if c.ctx_ != nil {
  12602. return ctxhttp.Do(c.ctx_, c.s.client, req)
  12603. }
  12604. return c.s.client.Do(req)
  12605. }
  12606. // Do executes the "directory.users.watch" call.
  12607. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  12608. // code is an error. Response headers are in either
  12609. // *Channel.ServerResponse.Header or (if a response was returned at all)
  12610. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  12611. // check whether the returned error was because http.StatusNotModified
  12612. // was returned.
  12613. func (c *UsersWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  12614. gensupport.SetOptions(c.urlParams_, opts...)
  12615. res, err := c.doRequest("json")
  12616. if res != nil && res.StatusCode == http.StatusNotModified {
  12617. if res.Body != nil {
  12618. res.Body.Close()
  12619. }
  12620. return nil, &googleapi.Error{
  12621. Code: res.StatusCode,
  12622. Header: res.Header,
  12623. }
  12624. }
  12625. if err != nil {
  12626. return nil, err
  12627. }
  12628. defer googleapi.CloseBody(res)
  12629. if err := googleapi.CheckResponse(res); err != nil {
  12630. return nil, err
  12631. }
  12632. ret := &Channel{
  12633. ServerResponse: googleapi.ServerResponse{
  12634. Header: res.Header,
  12635. HTTPStatusCode: res.StatusCode,
  12636. },
  12637. }
  12638. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  12639. return nil, err
  12640. }
  12641. return ret, nil
  12642. // {
  12643. // "description": "Watch for changes in users list",
  12644. // "httpMethod": "POST",
  12645. // "id": "directory.users.watch",
  12646. // "parameters": {
  12647. // "customFieldMask": {
  12648. // "description": "Comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom.",
  12649. // "location": "query",
  12650. // "type": "string"
  12651. // },
  12652. // "customer": {
  12653. // "description": "Immutable id of the Google Apps account. In case of multi-domain, to fetch all users for a customer, fill this field instead of domain.",
  12654. // "location": "query",
  12655. // "type": "string"
  12656. // },
  12657. // "domain": {
  12658. // "description": "Name of the domain. Fill this field to get users from only this domain. To return all users in a multi-domain fill customer field instead.",
  12659. // "location": "query",
  12660. // "type": "string"
  12661. // },
  12662. // "event": {
  12663. // "description": "Event on which subscription is intended (if subscribing)",
  12664. // "enum": [
  12665. // "add",
  12666. // "delete",
  12667. // "makeAdmin",
  12668. // "undelete",
  12669. // "update"
  12670. // ],
  12671. // "enumDescriptions": [
  12672. // "User Created Event",
  12673. // "User Deleted Event",
  12674. // "User Admin Status Change Event",
  12675. // "User Undeleted Event",
  12676. // "User Updated Event"
  12677. // ],
  12678. // "location": "query",
  12679. // "type": "string"
  12680. // },
  12681. // "maxResults": {
  12682. // "description": "Maximum number of results to return. Default is 100. Max allowed is 500",
  12683. // "format": "int32",
  12684. // "location": "query",
  12685. // "maximum": "500",
  12686. // "minimum": "1",
  12687. // "type": "integer"
  12688. // },
  12689. // "orderBy": {
  12690. // "description": "Column to use for sorting results",
  12691. // "enum": [
  12692. // "email",
  12693. // "familyName",
  12694. // "givenName"
  12695. // ],
  12696. // "enumDescriptions": [
  12697. // "Primary email of the user.",
  12698. // "User's family name.",
  12699. // "User's given name."
  12700. // ],
  12701. // "location": "query",
  12702. // "type": "string"
  12703. // },
  12704. // "pageToken": {
  12705. // "description": "Token to specify next page in the list",
  12706. // "location": "query",
  12707. // "type": "string"
  12708. // },
  12709. // "projection": {
  12710. // "default": "basic",
  12711. // "description": "What subset of fields to fetch for this user.",
  12712. // "enum": [
  12713. // "basic",
  12714. // "custom",
  12715. // "full"
  12716. // ],
  12717. // "enumDescriptions": [
  12718. // "Do not include any custom fields for the user.",
  12719. // "Include custom fields from schemas mentioned in customFieldMask.",
  12720. // "Include all fields associated with this user."
  12721. // ],
  12722. // "location": "query",
  12723. // "type": "string"
  12724. // },
  12725. // "query": {
  12726. // "description": "Query string search. Should be of the form \"\". Complete documentation is at https://developers.google.com/admin-sdk/directory/v1/guides/search-users",
  12727. // "location": "query",
  12728. // "type": "string"
  12729. // },
  12730. // "showDeleted": {
  12731. // "description": "If set to true retrieves the list of deleted users. Default is false",
  12732. // "location": "query",
  12733. // "type": "string"
  12734. // },
  12735. // "sortOrder": {
  12736. // "description": "Whether to return results in ascending or descending order.",
  12737. // "enum": [
  12738. // "ASCENDING",
  12739. // "DESCENDING"
  12740. // ],
  12741. // "enumDescriptions": [
  12742. // "Ascending order.",
  12743. // "Descending order."
  12744. // ],
  12745. // "location": "query",
  12746. // "type": "string"
  12747. // },
  12748. // "viewType": {
  12749. // "default": "admin_view",
  12750. // "description": "Whether to fetch the ADMIN_VIEW or DOMAIN_PUBLIC view of the user.",
  12751. // "enum": [
  12752. // "admin_view",
  12753. // "domain_public"
  12754. // ],
  12755. // "enumDescriptions": [
  12756. // "Fetches the ADMIN_VIEW of the user.",
  12757. // "Fetches the DOMAIN_PUBLIC view of the user."
  12758. // ],
  12759. // "location": "query",
  12760. // "type": "string"
  12761. // }
  12762. // },
  12763. // "path": "users/watch",
  12764. // "request": {
  12765. // "$ref": "Channel",
  12766. // "parameterName": "resource"
  12767. // },
  12768. // "response": {
  12769. // "$ref": "Channel"
  12770. // },
  12771. // "scopes": [
  12772. // "https://www.googleapis.com/auth/admin.directory.user",
  12773. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  12774. // ],
  12775. // "supportsSubscription": true
  12776. // }
  12777. }
  12778. // method id "directory.users.aliases.delete":
  12779. type UsersAliasesDeleteCall struct {
  12780. s *Service
  12781. userKey string
  12782. alias string
  12783. urlParams_ gensupport.URLParams
  12784. ctx_ context.Context
  12785. }
  12786. // Delete: Remove a alias for the user
  12787. func (r *UsersAliasesService) Delete(userKey string, alias string) *UsersAliasesDeleteCall {
  12788. c := &UsersAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12789. c.userKey = userKey
  12790. c.alias = alias
  12791. return c
  12792. }
  12793. // Fields allows partial responses to be retrieved. See
  12794. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12795. // for more information.
  12796. func (c *UsersAliasesDeleteCall) Fields(s ...googleapi.Field) *UsersAliasesDeleteCall {
  12797. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12798. return c
  12799. }
  12800. // Context sets the context to be used in this call's Do method. Any
  12801. // pending HTTP request will be aborted if the provided context is
  12802. // canceled.
  12803. func (c *UsersAliasesDeleteCall) Context(ctx context.Context) *UsersAliasesDeleteCall {
  12804. c.ctx_ = ctx
  12805. return c
  12806. }
  12807. func (c *UsersAliasesDeleteCall) doRequest(alt string) (*http.Response, error) {
  12808. var body io.Reader = nil
  12809. c.urlParams_.Set("alt", alt)
  12810. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/aliases/{alias}")
  12811. urls += "?" + c.urlParams_.Encode()
  12812. req, _ := http.NewRequest("DELETE", urls, body)
  12813. googleapi.Expand(req.URL, map[string]string{
  12814. "userKey": c.userKey,
  12815. "alias": c.alias,
  12816. })
  12817. req.Header.Set("User-Agent", c.s.userAgent())
  12818. if c.ctx_ != nil {
  12819. return ctxhttp.Do(c.ctx_, c.s.client, req)
  12820. }
  12821. return c.s.client.Do(req)
  12822. }
  12823. // Do executes the "directory.users.aliases.delete" call.
  12824. func (c *UsersAliasesDeleteCall) Do(opts ...googleapi.CallOption) error {
  12825. gensupport.SetOptions(c.urlParams_, opts...)
  12826. res, err := c.doRequest("json")
  12827. if err != nil {
  12828. return err
  12829. }
  12830. defer googleapi.CloseBody(res)
  12831. if err := googleapi.CheckResponse(res); err != nil {
  12832. return err
  12833. }
  12834. return nil
  12835. // {
  12836. // "description": "Remove a alias for the user",
  12837. // "httpMethod": "DELETE",
  12838. // "id": "directory.users.aliases.delete",
  12839. // "parameterOrder": [
  12840. // "userKey",
  12841. // "alias"
  12842. // ],
  12843. // "parameters": {
  12844. // "alias": {
  12845. // "description": "The alias to be removed",
  12846. // "location": "path",
  12847. // "required": true,
  12848. // "type": "string"
  12849. // },
  12850. // "userKey": {
  12851. // "description": "Email or immutable Id of the user",
  12852. // "location": "path",
  12853. // "required": true,
  12854. // "type": "string"
  12855. // }
  12856. // },
  12857. // "path": "users/{userKey}/aliases/{alias}",
  12858. // "scopes": [
  12859. // "https://www.googleapis.com/auth/admin.directory.user",
  12860. // "https://www.googleapis.com/auth/admin.directory.user.alias"
  12861. // ]
  12862. // }
  12863. }
  12864. // method id "directory.users.aliases.insert":
  12865. type UsersAliasesInsertCall struct {
  12866. s *Service
  12867. userKey string
  12868. alias *Alias
  12869. urlParams_ gensupport.URLParams
  12870. ctx_ context.Context
  12871. }
  12872. // Insert: Add a alias for the user
  12873. func (r *UsersAliasesService) Insert(userKey string, alias *Alias) *UsersAliasesInsertCall {
  12874. c := &UsersAliasesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12875. c.userKey = userKey
  12876. c.alias = alias
  12877. return c
  12878. }
  12879. // Fields allows partial responses to be retrieved. See
  12880. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12881. // for more information.
  12882. func (c *UsersAliasesInsertCall) Fields(s ...googleapi.Field) *UsersAliasesInsertCall {
  12883. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12884. return c
  12885. }
  12886. // Context sets the context to be used in this call's Do method. Any
  12887. // pending HTTP request will be aborted if the provided context is
  12888. // canceled.
  12889. func (c *UsersAliasesInsertCall) Context(ctx context.Context) *UsersAliasesInsertCall {
  12890. c.ctx_ = ctx
  12891. return c
  12892. }
  12893. func (c *UsersAliasesInsertCall) doRequest(alt string) (*http.Response, error) {
  12894. var body io.Reader = nil
  12895. body, err := googleapi.WithoutDataWrapper.JSONReader(c.alias)
  12896. if err != nil {
  12897. return nil, err
  12898. }
  12899. ctype := "application/json"
  12900. c.urlParams_.Set("alt", alt)
  12901. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/aliases")
  12902. urls += "?" + c.urlParams_.Encode()
  12903. req, _ := http.NewRequest("POST", urls, body)
  12904. googleapi.Expand(req.URL, map[string]string{
  12905. "userKey": c.userKey,
  12906. })
  12907. req.Header.Set("Content-Type", ctype)
  12908. req.Header.Set("User-Agent", c.s.userAgent())
  12909. if c.ctx_ != nil {
  12910. return ctxhttp.Do(c.ctx_, c.s.client, req)
  12911. }
  12912. return c.s.client.Do(req)
  12913. }
  12914. // Do executes the "directory.users.aliases.insert" call.
  12915. // Exactly one of *Alias or error will be non-nil. Any non-2xx status
  12916. // code is an error. Response headers are in either
  12917. // *Alias.ServerResponse.Header or (if a response was returned at all)
  12918. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  12919. // check whether the returned error was because http.StatusNotModified
  12920. // was returned.
  12921. func (c *UsersAliasesInsertCall) Do(opts ...googleapi.CallOption) (*Alias, error) {
  12922. gensupport.SetOptions(c.urlParams_, opts...)
  12923. res, err := c.doRequest("json")
  12924. if res != nil && res.StatusCode == http.StatusNotModified {
  12925. if res.Body != nil {
  12926. res.Body.Close()
  12927. }
  12928. return nil, &googleapi.Error{
  12929. Code: res.StatusCode,
  12930. Header: res.Header,
  12931. }
  12932. }
  12933. if err != nil {
  12934. return nil, err
  12935. }
  12936. defer googleapi.CloseBody(res)
  12937. if err := googleapi.CheckResponse(res); err != nil {
  12938. return nil, err
  12939. }
  12940. ret := &Alias{
  12941. ServerResponse: googleapi.ServerResponse{
  12942. Header: res.Header,
  12943. HTTPStatusCode: res.StatusCode,
  12944. },
  12945. }
  12946. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  12947. return nil, err
  12948. }
  12949. return ret, nil
  12950. // {
  12951. // "description": "Add a alias for the user",
  12952. // "httpMethod": "POST",
  12953. // "id": "directory.users.aliases.insert",
  12954. // "parameterOrder": [
  12955. // "userKey"
  12956. // ],
  12957. // "parameters": {
  12958. // "userKey": {
  12959. // "description": "Email or immutable Id of the user",
  12960. // "location": "path",
  12961. // "required": true,
  12962. // "type": "string"
  12963. // }
  12964. // },
  12965. // "path": "users/{userKey}/aliases",
  12966. // "request": {
  12967. // "$ref": "Alias"
  12968. // },
  12969. // "response": {
  12970. // "$ref": "Alias"
  12971. // },
  12972. // "scopes": [
  12973. // "https://www.googleapis.com/auth/admin.directory.user",
  12974. // "https://www.googleapis.com/auth/admin.directory.user.alias"
  12975. // ]
  12976. // }
  12977. }
  12978. // method id "directory.users.aliases.list":
  12979. type UsersAliasesListCall struct {
  12980. s *Service
  12981. userKey string
  12982. urlParams_ gensupport.URLParams
  12983. ifNoneMatch_ string
  12984. ctx_ context.Context
  12985. }
  12986. // List: List all aliases for a user
  12987. func (r *UsersAliasesService) List(userKey string) *UsersAliasesListCall {
  12988. c := &UsersAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12989. c.userKey = userKey
  12990. return c
  12991. }
  12992. // Event sets the optional parameter "event": Event on which
  12993. // subscription is intended (if subscribing)
  12994. //
  12995. // Possible values:
  12996. // "add" - Alias Created Event
  12997. // "delete" - Alias Deleted Event
  12998. func (c *UsersAliasesListCall) Event(event string) *UsersAliasesListCall {
  12999. c.urlParams_.Set("event", event)
  13000. return c
  13001. }
  13002. // Fields allows partial responses to be retrieved. See
  13003. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13004. // for more information.
  13005. func (c *UsersAliasesListCall) Fields(s ...googleapi.Field) *UsersAliasesListCall {
  13006. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13007. return c
  13008. }
  13009. // IfNoneMatch sets the optional parameter which makes the operation
  13010. // fail if the object's ETag matches the given value. This is useful for
  13011. // getting updates only after the object has changed since the last
  13012. // request. Use googleapi.IsNotModified to check whether the response
  13013. // error from Do is the result of In-None-Match.
  13014. func (c *UsersAliasesListCall) IfNoneMatch(entityTag string) *UsersAliasesListCall {
  13015. c.ifNoneMatch_ = entityTag
  13016. return c
  13017. }
  13018. // Context sets the context to be used in this call's Do method. Any
  13019. // pending HTTP request will be aborted if the provided context is
  13020. // canceled.
  13021. func (c *UsersAliasesListCall) Context(ctx context.Context) *UsersAliasesListCall {
  13022. c.ctx_ = ctx
  13023. return c
  13024. }
  13025. func (c *UsersAliasesListCall) doRequest(alt string) (*http.Response, error) {
  13026. var body io.Reader = nil
  13027. c.urlParams_.Set("alt", alt)
  13028. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/aliases")
  13029. urls += "?" + c.urlParams_.Encode()
  13030. req, _ := http.NewRequest("GET", urls, body)
  13031. googleapi.Expand(req.URL, map[string]string{
  13032. "userKey": c.userKey,
  13033. })
  13034. req.Header.Set("User-Agent", c.s.userAgent())
  13035. if c.ifNoneMatch_ != "" {
  13036. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  13037. }
  13038. if c.ctx_ != nil {
  13039. return ctxhttp.Do(c.ctx_, c.s.client, req)
  13040. }
  13041. return c.s.client.Do(req)
  13042. }
  13043. // Do executes the "directory.users.aliases.list" call.
  13044. // Exactly one of *Aliases or error will be non-nil. Any non-2xx status
  13045. // code is an error. Response headers are in either
  13046. // *Aliases.ServerResponse.Header or (if a response was returned at all)
  13047. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  13048. // check whether the returned error was because http.StatusNotModified
  13049. // was returned.
  13050. func (c *UsersAliasesListCall) Do(opts ...googleapi.CallOption) (*Aliases, error) {
  13051. gensupport.SetOptions(c.urlParams_, opts...)
  13052. res, err := c.doRequest("json")
  13053. if res != nil && res.StatusCode == http.StatusNotModified {
  13054. if res.Body != nil {
  13055. res.Body.Close()
  13056. }
  13057. return nil, &googleapi.Error{
  13058. Code: res.StatusCode,
  13059. Header: res.Header,
  13060. }
  13061. }
  13062. if err != nil {
  13063. return nil, err
  13064. }
  13065. defer googleapi.CloseBody(res)
  13066. if err := googleapi.CheckResponse(res); err != nil {
  13067. return nil, err
  13068. }
  13069. ret := &Aliases{
  13070. ServerResponse: googleapi.ServerResponse{
  13071. Header: res.Header,
  13072. HTTPStatusCode: res.StatusCode,
  13073. },
  13074. }
  13075. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  13076. return nil, err
  13077. }
  13078. return ret, nil
  13079. // {
  13080. // "description": "List all aliases for a user",
  13081. // "httpMethod": "GET",
  13082. // "id": "directory.users.aliases.list",
  13083. // "parameterOrder": [
  13084. // "userKey"
  13085. // ],
  13086. // "parameters": {
  13087. // "event": {
  13088. // "description": "Event on which subscription is intended (if subscribing)",
  13089. // "enum": [
  13090. // "add",
  13091. // "delete"
  13092. // ],
  13093. // "enumDescriptions": [
  13094. // "Alias Created Event",
  13095. // "Alias Deleted Event"
  13096. // ],
  13097. // "location": "query",
  13098. // "type": "string"
  13099. // },
  13100. // "userKey": {
  13101. // "description": "Email or immutable Id of the user",
  13102. // "location": "path",
  13103. // "required": true,
  13104. // "type": "string"
  13105. // }
  13106. // },
  13107. // "path": "users/{userKey}/aliases",
  13108. // "response": {
  13109. // "$ref": "Aliases"
  13110. // },
  13111. // "scopes": [
  13112. // "https://www.googleapis.com/auth/admin.directory.user",
  13113. // "https://www.googleapis.com/auth/admin.directory.user.alias",
  13114. // "https://www.googleapis.com/auth/admin.directory.user.alias.readonly",
  13115. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  13116. // ],
  13117. // "supportsSubscription": true
  13118. // }
  13119. }
  13120. // method id "directory.users.aliases.watch":
  13121. type UsersAliasesWatchCall struct {
  13122. s *Service
  13123. userKey string
  13124. channel *Channel
  13125. urlParams_ gensupport.URLParams
  13126. ctx_ context.Context
  13127. }
  13128. // Watch: Watch for changes in user aliases list
  13129. func (r *UsersAliasesService) Watch(userKey string, channel *Channel) *UsersAliasesWatchCall {
  13130. c := &UsersAliasesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13131. c.userKey = userKey
  13132. c.channel = channel
  13133. return c
  13134. }
  13135. // Event sets the optional parameter "event": Event on which
  13136. // subscription is intended (if subscribing)
  13137. //
  13138. // Possible values:
  13139. // "add" - Alias Created Event
  13140. // "delete" - Alias Deleted Event
  13141. func (c *UsersAliasesWatchCall) Event(event string) *UsersAliasesWatchCall {
  13142. c.urlParams_.Set("event", event)
  13143. return c
  13144. }
  13145. // Fields allows partial responses to be retrieved. See
  13146. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13147. // for more information.
  13148. func (c *UsersAliasesWatchCall) Fields(s ...googleapi.Field) *UsersAliasesWatchCall {
  13149. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13150. return c
  13151. }
  13152. // Context sets the context to be used in this call's Do method. Any
  13153. // pending HTTP request will be aborted if the provided context is
  13154. // canceled.
  13155. func (c *UsersAliasesWatchCall) Context(ctx context.Context) *UsersAliasesWatchCall {
  13156. c.ctx_ = ctx
  13157. return c
  13158. }
  13159. func (c *UsersAliasesWatchCall) doRequest(alt string) (*http.Response, error) {
  13160. var body io.Reader = nil
  13161. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  13162. if err != nil {
  13163. return nil, err
  13164. }
  13165. ctype := "application/json"
  13166. c.urlParams_.Set("alt", alt)
  13167. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/aliases/watch")
  13168. urls += "?" + c.urlParams_.Encode()
  13169. req, _ := http.NewRequest("POST", urls, body)
  13170. googleapi.Expand(req.URL, map[string]string{
  13171. "userKey": c.userKey,
  13172. })
  13173. req.Header.Set("Content-Type", ctype)
  13174. req.Header.Set("User-Agent", c.s.userAgent())
  13175. if c.ctx_ != nil {
  13176. return ctxhttp.Do(c.ctx_, c.s.client, req)
  13177. }
  13178. return c.s.client.Do(req)
  13179. }
  13180. // Do executes the "directory.users.aliases.watch" call.
  13181. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  13182. // code is an error. Response headers are in either
  13183. // *Channel.ServerResponse.Header or (if a response was returned at all)
  13184. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  13185. // check whether the returned error was because http.StatusNotModified
  13186. // was returned.
  13187. func (c *UsersAliasesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  13188. gensupport.SetOptions(c.urlParams_, opts...)
  13189. res, err := c.doRequest("json")
  13190. if res != nil && res.StatusCode == http.StatusNotModified {
  13191. if res.Body != nil {
  13192. res.Body.Close()
  13193. }
  13194. return nil, &googleapi.Error{
  13195. Code: res.StatusCode,
  13196. Header: res.Header,
  13197. }
  13198. }
  13199. if err != nil {
  13200. return nil, err
  13201. }
  13202. defer googleapi.CloseBody(res)
  13203. if err := googleapi.CheckResponse(res); err != nil {
  13204. return nil, err
  13205. }
  13206. ret := &Channel{
  13207. ServerResponse: googleapi.ServerResponse{
  13208. Header: res.Header,
  13209. HTTPStatusCode: res.StatusCode,
  13210. },
  13211. }
  13212. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  13213. return nil, err
  13214. }
  13215. return ret, nil
  13216. // {
  13217. // "description": "Watch for changes in user aliases list",
  13218. // "httpMethod": "POST",
  13219. // "id": "directory.users.aliases.watch",
  13220. // "parameterOrder": [
  13221. // "userKey"
  13222. // ],
  13223. // "parameters": {
  13224. // "event": {
  13225. // "description": "Event on which subscription is intended (if subscribing)",
  13226. // "enum": [
  13227. // "add",
  13228. // "delete"
  13229. // ],
  13230. // "enumDescriptions": [
  13231. // "Alias Created Event",
  13232. // "Alias Deleted Event"
  13233. // ],
  13234. // "location": "query",
  13235. // "type": "string"
  13236. // },
  13237. // "userKey": {
  13238. // "description": "Email or immutable Id of the user",
  13239. // "location": "path",
  13240. // "required": true,
  13241. // "type": "string"
  13242. // }
  13243. // },
  13244. // "path": "users/{userKey}/aliases/watch",
  13245. // "request": {
  13246. // "$ref": "Channel",
  13247. // "parameterName": "resource"
  13248. // },
  13249. // "response": {
  13250. // "$ref": "Channel"
  13251. // },
  13252. // "scopes": [
  13253. // "https://www.googleapis.com/auth/admin.directory.user",
  13254. // "https://www.googleapis.com/auth/admin.directory.user.alias",
  13255. // "https://www.googleapis.com/auth/admin.directory.user.alias.readonly",
  13256. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  13257. // ],
  13258. // "supportsSubscription": true
  13259. // }
  13260. }
  13261. // method id "directory.users.photos.delete":
  13262. type UsersPhotosDeleteCall struct {
  13263. s *Service
  13264. userKey string
  13265. urlParams_ gensupport.URLParams
  13266. ctx_ context.Context
  13267. }
  13268. // Delete: Remove photos for the user
  13269. func (r *UsersPhotosService) Delete(userKey string) *UsersPhotosDeleteCall {
  13270. c := &UsersPhotosDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13271. c.userKey = userKey
  13272. return c
  13273. }
  13274. // Fields allows partial responses to be retrieved. See
  13275. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13276. // for more information.
  13277. func (c *UsersPhotosDeleteCall) Fields(s ...googleapi.Field) *UsersPhotosDeleteCall {
  13278. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13279. return c
  13280. }
  13281. // Context sets the context to be used in this call's Do method. Any
  13282. // pending HTTP request will be aborted if the provided context is
  13283. // canceled.
  13284. func (c *UsersPhotosDeleteCall) Context(ctx context.Context) *UsersPhotosDeleteCall {
  13285. c.ctx_ = ctx
  13286. return c
  13287. }
  13288. func (c *UsersPhotosDeleteCall) doRequest(alt string) (*http.Response, error) {
  13289. var body io.Reader = nil
  13290. c.urlParams_.Set("alt", alt)
  13291. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/photos/thumbnail")
  13292. urls += "?" + c.urlParams_.Encode()
  13293. req, _ := http.NewRequest("DELETE", urls, body)
  13294. googleapi.Expand(req.URL, map[string]string{
  13295. "userKey": c.userKey,
  13296. })
  13297. req.Header.Set("User-Agent", c.s.userAgent())
  13298. if c.ctx_ != nil {
  13299. return ctxhttp.Do(c.ctx_, c.s.client, req)
  13300. }
  13301. return c.s.client.Do(req)
  13302. }
  13303. // Do executes the "directory.users.photos.delete" call.
  13304. func (c *UsersPhotosDeleteCall) Do(opts ...googleapi.CallOption) error {
  13305. gensupport.SetOptions(c.urlParams_, opts...)
  13306. res, err := c.doRequest("json")
  13307. if err != nil {
  13308. return err
  13309. }
  13310. defer googleapi.CloseBody(res)
  13311. if err := googleapi.CheckResponse(res); err != nil {
  13312. return err
  13313. }
  13314. return nil
  13315. // {
  13316. // "description": "Remove photos for the user",
  13317. // "httpMethod": "DELETE",
  13318. // "id": "directory.users.photos.delete",
  13319. // "parameterOrder": [
  13320. // "userKey"
  13321. // ],
  13322. // "parameters": {
  13323. // "userKey": {
  13324. // "description": "Email or immutable Id of the user",
  13325. // "location": "path",
  13326. // "required": true,
  13327. // "type": "string"
  13328. // }
  13329. // },
  13330. // "path": "users/{userKey}/photos/thumbnail",
  13331. // "scopes": [
  13332. // "https://www.googleapis.com/auth/admin.directory.user"
  13333. // ]
  13334. // }
  13335. }
  13336. // method id "directory.users.photos.get":
  13337. type UsersPhotosGetCall struct {
  13338. s *Service
  13339. userKey string
  13340. urlParams_ gensupport.URLParams
  13341. ifNoneMatch_ string
  13342. ctx_ context.Context
  13343. }
  13344. // Get: Retrieve photo of a user
  13345. func (r *UsersPhotosService) Get(userKey string) *UsersPhotosGetCall {
  13346. c := &UsersPhotosGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13347. c.userKey = userKey
  13348. return c
  13349. }
  13350. // Fields allows partial responses to be retrieved. See
  13351. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13352. // for more information.
  13353. func (c *UsersPhotosGetCall) Fields(s ...googleapi.Field) *UsersPhotosGetCall {
  13354. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13355. return c
  13356. }
  13357. // IfNoneMatch sets the optional parameter which makes the operation
  13358. // fail if the object's ETag matches the given value. This is useful for
  13359. // getting updates only after the object has changed since the last
  13360. // request. Use googleapi.IsNotModified to check whether the response
  13361. // error from Do is the result of In-None-Match.
  13362. func (c *UsersPhotosGetCall) IfNoneMatch(entityTag string) *UsersPhotosGetCall {
  13363. c.ifNoneMatch_ = entityTag
  13364. return c
  13365. }
  13366. // Context sets the context to be used in this call's Do method. Any
  13367. // pending HTTP request will be aborted if the provided context is
  13368. // canceled.
  13369. func (c *UsersPhotosGetCall) Context(ctx context.Context) *UsersPhotosGetCall {
  13370. c.ctx_ = ctx
  13371. return c
  13372. }
  13373. func (c *UsersPhotosGetCall) doRequest(alt string) (*http.Response, error) {
  13374. var body io.Reader = nil
  13375. c.urlParams_.Set("alt", alt)
  13376. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/photos/thumbnail")
  13377. urls += "?" + c.urlParams_.Encode()
  13378. req, _ := http.NewRequest("GET", urls, body)
  13379. googleapi.Expand(req.URL, map[string]string{
  13380. "userKey": c.userKey,
  13381. })
  13382. req.Header.Set("User-Agent", c.s.userAgent())
  13383. if c.ifNoneMatch_ != "" {
  13384. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  13385. }
  13386. if c.ctx_ != nil {
  13387. return ctxhttp.Do(c.ctx_, c.s.client, req)
  13388. }
  13389. return c.s.client.Do(req)
  13390. }
  13391. // Do executes the "directory.users.photos.get" call.
  13392. // Exactly one of *UserPhoto or error will be non-nil. Any non-2xx
  13393. // status code is an error. Response headers are in either
  13394. // *UserPhoto.ServerResponse.Header or (if a response was returned at
  13395. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  13396. // to check whether the returned error was because
  13397. // http.StatusNotModified was returned.
  13398. func (c *UsersPhotosGetCall) Do(opts ...googleapi.CallOption) (*UserPhoto, error) {
  13399. gensupport.SetOptions(c.urlParams_, opts...)
  13400. res, err := c.doRequest("json")
  13401. if res != nil && res.StatusCode == http.StatusNotModified {
  13402. if res.Body != nil {
  13403. res.Body.Close()
  13404. }
  13405. return nil, &googleapi.Error{
  13406. Code: res.StatusCode,
  13407. Header: res.Header,
  13408. }
  13409. }
  13410. if err != nil {
  13411. return nil, err
  13412. }
  13413. defer googleapi.CloseBody(res)
  13414. if err := googleapi.CheckResponse(res); err != nil {
  13415. return nil, err
  13416. }
  13417. ret := &UserPhoto{
  13418. ServerResponse: googleapi.ServerResponse{
  13419. Header: res.Header,
  13420. HTTPStatusCode: res.StatusCode,
  13421. },
  13422. }
  13423. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  13424. return nil, err
  13425. }
  13426. return ret, nil
  13427. // {
  13428. // "description": "Retrieve photo of a user",
  13429. // "httpMethod": "GET",
  13430. // "id": "directory.users.photos.get",
  13431. // "parameterOrder": [
  13432. // "userKey"
  13433. // ],
  13434. // "parameters": {
  13435. // "userKey": {
  13436. // "description": "Email or immutable Id of the user",
  13437. // "location": "path",
  13438. // "required": true,
  13439. // "type": "string"
  13440. // }
  13441. // },
  13442. // "path": "users/{userKey}/photos/thumbnail",
  13443. // "response": {
  13444. // "$ref": "UserPhoto"
  13445. // },
  13446. // "scopes": [
  13447. // "https://www.googleapis.com/auth/admin.directory.user",
  13448. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  13449. // ]
  13450. // }
  13451. }
  13452. // method id "directory.users.photos.patch":
  13453. type UsersPhotosPatchCall struct {
  13454. s *Service
  13455. userKey string
  13456. userphoto *UserPhoto
  13457. urlParams_ gensupport.URLParams
  13458. ctx_ context.Context
  13459. }
  13460. // Patch: Add a photo for the user. This method supports patch
  13461. // semantics.
  13462. func (r *UsersPhotosService) Patch(userKey string, userphoto *UserPhoto) *UsersPhotosPatchCall {
  13463. c := &UsersPhotosPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13464. c.userKey = userKey
  13465. c.userphoto = userphoto
  13466. return c
  13467. }
  13468. // Fields allows partial responses to be retrieved. See
  13469. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13470. // for more information.
  13471. func (c *UsersPhotosPatchCall) Fields(s ...googleapi.Field) *UsersPhotosPatchCall {
  13472. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13473. return c
  13474. }
  13475. // Context sets the context to be used in this call's Do method. Any
  13476. // pending HTTP request will be aborted if the provided context is
  13477. // canceled.
  13478. func (c *UsersPhotosPatchCall) Context(ctx context.Context) *UsersPhotosPatchCall {
  13479. c.ctx_ = ctx
  13480. return c
  13481. }
  13482. func (c *UsersPhotosPatchCall) doRequest(alt string) (*http.Response, error) {
  13483. var body io.Reader = nil
  13484. body, err := googleapi.WithoutDataWrapper.JSONReader(c.userphoto)
  13485. if err != nil {
  13486. return nil, err
  13487. }
  13488. ctype := "application/json"
  13489. c.urlParams_.Set("alt", alt)
  13490. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/photos/thumbnail")
  13491. urls += "?" + c.urlParams_.Encode()
  13492. req, _ := http.NewRequest("PATCH", urls, body)
  13493. googleapi.Expand(req.URL, map[string]string{
  13494. "userKey": c.userKey,
  13495. })
  13496. req.Header.Set("Content-Type", ctype)
  13497. req.Header.Set("User-Agent", c.s.userAgent())
  13498. if c.ctx_ != nil {
  13499. return ctxhttp.Do(c.ctx_, c.s.client, req)
  13500. }
  13501. return c.s.client.Do(req)
  13502. }
  13503. // Do executes the "directory.users.photos.patch" call.
  13504. // Exactly one of *UserPhoto or error will be non-nil. Any non-2xx
  13505. // status code is an error. Response headers are in either
  13506. // *UserPhoto.ServerResponse.Header or (if a response was returned at
  13507. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  13508. // to check whether the returned error was because
  13509. // http.StatusNotModified was returned.
  13510. func (c *UsersPhotosPatchCall) Do(opts ...googleapi.CallOption) (*UserPhoto, error) {
  13511. gensupport.SetOptions(c.urlParams_, opts...)
  13512. res, err := c.doRequest("json")
  13513. if res != nil && res.StatusCode == http.StatusNotModified {
  13514. if res.Body != nil {
  13515. res.Body.Close()
  13516. }
  13517. return nil, &googleapi.Error{
  13518. Code: res.StatusCode,
  13519. Header: res.Header,
  13520. }
  13521. }
  13522. if err != nil {
  13523. return nil, err
  13524. }
  13525. defer googleapi.CloseBody(res)
  13526. if err := googleapi.CheckResponse(res); err != nil {
  13527. return nil, err
  13528. }
  13529. ret := &UserPhoto{
  13530. ServerResponse: googleapi.ServerResponse{
  13531. Header: res.Header,
  13532. HTTPStatusCode: res.StatusCode,
  13533. },
  13534. }
  13535. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  13536. return nil, err
  13537. }
  13538. return ret, nil
  13539. // {
  13540. // "description": "Add a photo for the user. This method supports patch semantics.",
  13541. // "httpMethod": "PATCH",
  13542. // "id": "directory.users.photos.patch",
  13543. // "parameterOrder": [
  13544. // "userKey"
  13545. // ],
  13546. // "parameters": {
  13547. // "userKey": {
  13548. // "description": "Email or immutable Id of the user",
  13549. // "location": "path",
  13550. // "required": true,
  13551. // "type": "string"
  13552. // }
  13553. // },
  13554. // "path": "users/{userKey}/photos/thumbnail",
  13555. // "request": {
  13556. // "$ref": "UserPhoto"
  13557. // },
  13558. // "response": {
  13559. // "$ref": "UserPhoto"
  13560. // },
  13561. // "scopes": [
  13562. // "https://www.googleapis.com/auth/admin.directory.user"
  13563. // ]
  13564. // }
  13565. }
  13566. // method id "directory.users.photos.update":
  13567. type UsersPhotosUpdateCall struct {
  13568. s *Service
  13569. userKey string
  13570. userphoto *UserPhoto
  13571. urlParams_ gensupport.URLParams
  13572. ctx_ context.Context
  13573. }
  13574. // Update: Add a photo for the user
  13575. func (r *UsersPhotosService) Update(userKey string, userphoto *UserPhoto) *UsersPhotosUpdateCall {
  13576. c := &UsersPhotosUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13577. c.userKey = userKey
  13578. c.userphoto = userphoto
  13579. return c
  13580. }
  13581. // Fields allows partial responses to be retrieved. See
  13582. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13583. // for more information.
  13584. func (c *UsersPhotosUpdateCall) Fields(s ...googleapi.Field) *UsersPhotosUpdateCall {
  13585. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13586. return c
  13587. }
  13588. // Context sets the context to be used in this call's Do method. Any
  13589. // pending HTTP request will be aborted if the provided context is
  13590. // canceled.
  13591. func (c *UsersPhotosUpdateCall) Context(ctx context.Context) *UsersPhotosUpdateCall {
  13592. c.ctx_ = ctx
  13593. return c
  13594. }
  13595. func (c *UsersPhotosUpdateCall) doRequest(alt string) (*http.Response, error) {
  13596. var body io.Reader = nil
  13597. body, err := googleapi.WithoutDataWrapper.JSONReader(c.userphoto)
  13598. if err != nil {
  13599. return nil, err
  13600. }
  13601. ctype := "application/json"
  13602. c.urlParams_.Set("alt", alt)
  13603. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/photos/thumbnail")
  13604. urls += "?" + c.urlParams_.Encode()
  13605. req, _ := http.NewRequest("PUT", urls, body)
  13606. googleapi.Expand(req.URL, map[string]string{
  13607. "userKey": c.userKey,
  13608. })
  13609. req.Header.Set("Content-Type", ctype)
  13610. req.Header.Set("User-Agent", c.s.userAgent())
  13611. if c.ctx_ != nil {
  13612. return ctxhttp.Do(c.ctx_, c.s.client, req)
  13613. }
  13614. return c.s.client.Do(req)
  13615. }
  13616. // Do executes the "directory.users.photos.update" call.
  13617. // Exactly one of *UserPhoto or error will be non-nil. Any non-2xx
  13618. // status code is an error. Response headers are in either
  13619. // *UserPhoto.ServerResponse.Header or (if a response was returned at
  13620. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  13621. // to check whether the returned error was because
  13622. // http.StatusNotModified was returned.
  13623. func (c *UsersPhotosUpdateCall) Do(opts ...googleapi.CallOption) (*UserPhoto, error) {
  13624. gensupport.SetOptions(c.urlParams_, opts...)
  13625. res, err := c.doRequest("json")
  13626. if res != nil && res.StatusCode == http.StatusNotModified {
  13627. if res.Body != nil {
  13628. res.Body.Close()
  13629. }
  13630. return nil, &googleapi.Error{
  13631. Code: res.StatusCode,
  13632. Header: res.Header,
  13633. }
  13634. }
  13635. if err != nil {
  13636. return nil, err
  13637. }
  13638. defer googleapi.CloseBody(res)
  13639. if err := googleapi.CheckResponse(res); err != nil {
  13640. return nil, err
  13641. }
  13642. ret := &UserPhoto{
  13643. ServerResponse: googleapi.ServerResponse{
  13644. Header: res.Header,
  13645. HTTPStatusCode: res.StatusCode,
  13646. },
  13647. }
  13648. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  13649. return nil, err
  13650. }
  13651. return ret, nil
  13652. // {
  13653. // "description": "Add a photo for the user",
  13654. // "httpMethod": "PUT",
  13655. // "id": "directory.users.photos.update",
  13656. // "parameterOrder": [
  13657. // "userKey"
  13658. // ],
  13659. // "parameters": {
  13660. // "userKey": {
  13661. // "description": "Email or immutable Id of the user",
  13662. // "location": "path",
  13663. // "required": true,
  13664. // "type": "string"
  13665. // }
  13666. // },
  13667. // "path": "users/{userKey}/photos/thumbnail",
  13668. // "request": {
  13669. // "$ref": "UserPhoto"
  13670. // },
  13671. // "response": {
  13672. // "$ref": "UserPhoto"
  13673. // },
  13674. // "scopes": [
  13675. // "https://www.googleapis.com/auth/admin.directory.user"
  13676. // ]
  13677. // }
  13678. }
  13679. // method id "directory.verificationCodes.generate":
  13680. type VerificationCodesGenerateCall struct {
  13681. s *Service
  13682. userKey string
  13683. urlParams_ gensupport.URLParams
  13684. ctx_ context.Context
  13685. }
  13686. // Generate: Generate new backup verification codes for the user.
  13687. func (r *VerificationCodesService) Generate(userKey string) *VerificationCodesGenerateCall {
  13688. c := &VerificationCodesGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13689. c.userKey = userKey
  13690. return c
  13691. }
  13692. // Fields allows partial responses to be retrieved. See
  13693. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13694. // for more information.
  13695. func (c *VerificationCodesGenerateCall) Fields(s ...googleapi.Field) *VerificationCodesGenerateCall {
  13696. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13697. return c
  13698. }
  13699. // Context sets the context to be used in this call's Do method. Any
  13700. // pending HTTP request will be aborted if the provided context is
  13701. // canceled.
  13702. func (c *VerificationCodesGenerateCall) Context(ctx context.Context) *VerificationCodesGenerateCall {
  13703. c.ctx_ = ctx
  13704. return c
  13705. }
  13706. func (c *VerificationCodesGenerateCall) doRequest(alt string) (*http.Response, error) {
  13707. var body io.Reader = nil
  13708. c.urlParams_.Set("alt", alt)
  13709. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/verificationCodes/generate")
  13710. urls += "?" + c.urlParams_.Encode()
  13711. req, _ := http.NewRequest("POST", urls, body)
  13712. googleapi.Expand(req.URL, map[string]string{
  13713. "userKey": c.userKey,
  13714. })
  13715. req.Header.Set("User-Agent", c.s.userAgent())
  13716. if c.ctx_ != nil {
  13717. return ctxhttp.Do(c.ctx_, c.s.client, req)
  13718. }
  13719. return c.s.client.Do(req)
  13720. }
  13721. // Do executes the "directory.verificationCodes.generate" call.
  13722. func (c *VerificationCodesGenerateCall) Do(opts ...googleapi.CallOption) error {
  13723. gensupport.SetOptions(c.urlParams_, opts...)
  13724. res, err := c.doRequest("json")
  13725. if err != nil {
  13726. return err
  13727. }
  13728. defer googleapi.CloseBody(res)
  13729. if err := googleapi.CheckResponse(res); err != nil {
  13730. return err
  13731. }
  13732. return nil
  13733. // {
  13734. // "description": "Generate new backup verification codes for the user.",
  13735. // "httpMethod": "POST",
  13736. // "id": "directory.verificationCodes.generate",
  13737. // "parameterOrder": [
  13738. // "userKey"
  13739. // ],
  13740. // "parameters": {
  13741. // "userKey": {
  13742. // "description": "Email or immutable Id of the user",
  13743. // "location": "path",
  13744. // "required": true,
  13745. // "type": "string"
  13746. // }
  13747. // },
  13748. // "path": "users/{userKey}/verificationCodes/generate",
  13749. // "scopes": [
  13750. // "https://www.googleapis.com/auth/admin.directory.user.security"
  13751. // ]
  13752. // }
  13753. }
  13754. // method id "directory.verificationCodes.invalidate":
  13755. type VerificationCodesInvalidateCall struct {
  13756. s *Service
  13757. userKey string
  13758. urlParams_ gensupport.URLParams
  13759. ctx_ context.Context
  13760. }
  13761. // Invalidate: Invalidate the current backup verification codes for the
  13762. // user.
  13763. func (r *VerificationCodesService) Invalidate(userKey string) *VerificationCodesInvalidateCall {
  13764. c := &VerificationCodesInvalidateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13765. c.userKey = userKey
  13766. return c
  13767. }
  13768. // Fields allows partial responses to be retrieved. See
  13769. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13770. // for more information.
  13771. func (c *VerificationCodesInvalidateCall) Fields(s ...googleapi.Field) *VerificationCodesInvalidateCall {
  13772. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13773. return c
  13774. }
  13775. // Context sets the context to be used in this call's Do method. Any
  13776. // pending HTTP request will be aborted if the provided context is
  13777. // canceled.
  13778. func (c *VerificationCodesInvalidateCall) Context(ctx context.Context) *VerificationCodesInvalidateCall {
  13779. c.ctx_ = ctx
  13780. return c
  13781. }
  13782. func (c *VerificationCodesInvalidateCall) doRequest(alt string) (*http.Response, error) {
  13783. var body io.Reader = nil
  13784. c.urlParams_.Set("alt", alt)
  13785. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/verificationCodes/invalidate")
  13786. urls += "?" + c.urlParams_.Encode()
  13787. req, _ := http.NewRequest("POST", urls, body)
  13788. googleapi.Expand(req.URL, map[string]string{
  13789. "userKey": c.userKey,
  13790. })
  13791. req.Header.Set("User-Agent", c.s.userAgent())
  13792. if c.ctx_ != nil {
  13793. return ctxhttp.Do(c.ctx_, c.s.client, req)
  13794. }
  13795. return c.s.client.Do(req)
  13796. }
  13797. // Do executes the "directory.verificationCodes.invalidate" call.
  13798. func (c *VerificationCodesInvalidateCall) Do(opts ...googleapi.CallOption) error {
  13799. gensupport.SetOptions(c.urlParams_, opts...)
  13800. res, err := c.doRequest("json")
  13801. if err != nil {
  13802. return err
  13803. }
  13804. defer googleapi.CloseBody(res)
  13805. if err := googleapi.CheckResponse(res); err != nil {
  13806. return err
  13807. }
  13808. return nil
  13809. // {
  13810. // "description": "Invalidate the current backup verification codes for the user.",
  13811. // "httpMethod": "POST",
  13812. // "id": "directory.verificationCodes.invalidate",
  13813. // "parameterOrder": [
  13814. // "userKey"
  13815. // ],
  13816. // "parameters": {
  13817. // "userKey": {
  13818. // "description": "Email or immutable Id of the user",
  13819. // "location": "path",
  13820. // "required": true,
  13821. // "type": "string"
  13822. // }
  13823. // },
  13824. // "path": "users/{userKey}/verificationCodes/invalidate",
  13825. // "scopes": [
  13826. // "https://www.googleapis.com/auth/admin.directory.user.security"
  13827. // ]
  13828. // }
  13829. }
  13830. // method id "directory.verificationCodes.list":
  13831. type VerificationCodesListCall struct {
  13832. s *Service
  13833. userKey string
  13834. urlParams_ gensupport.URLParams
  13835. ifNoneMatch_ string
  13836. ctx_ context.Context
  13837. }
  13838. // List: Returns the current set of valid backup verification codes for
  13839. // the specified user.
  13840. func (r *VerificationCodesService) List(userKey string) *VerificationCodesListCall {
  13841. c := &VerificationCodesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13842. c.userKey = userKey
  13843. return c
  13844. }
  13845. // Fields allows partial responses to be retrieved. See
  13846. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13847. // for more information.
  13848. func (c *VerificationCodesListCall) Fields(s ...googleapi.Field) *VerificationCodesListCall {
  13849. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13850. return c
  13851. }
  13852. // IfNoneMatch sets the optional parameter which makes the operation
  13853. // fail if the object's ETag matches the given value. This is useful for
  13854. // getting updates only after the object has changed since the last
  13855. // request. Use googleapi.IsNotModified to check whether the response
  13856. // error from Do is the result of In-None-Match.
  13857. func (c *VerificationCodesListCall) IfNoneMatch(entityTag string) *VerificationCodesListCall {
  13858. c.ifNoneMatch_ = entityTag
  13859. return c
  13860. }
  13861. // Context sets the context to be used in this call's Do method. Any
  13862. // pending HTTP request will be aborted if the provided context is
  13863. // canceled.
  13864. func (c *VerificationCodesListCall) Context(ctx context.Context) *VerificationCodesListCall {
  13865. c.ctx_ = ctx
  13866. return c
  13867. }
  13868. func (c *VerificationCodesListCall) doRequest(alt string) (*http.Response, error) {
  13869. var body io.Reader = nil
  13870. c.urlParams_.Set("alt", alt)
  13871. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/verificationCodes")
  13872. urls += "?" + c.urlParams_.Encode()
  13873. req, _ := http.NewRequest("GET", urls, body)
  13874. googleapi.Expand(req.URL, map[string]string{
  13875. "userKey": c.userKey,
  13876. })
  13877. req.Header.Set("User-Agent", c.s.userAgent())
  13878. if c.ifNoneMatch_ != "" {
  13879. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  13880. }
  13881. if c.ctx_ != nil {
  13882. return ctxhttp.Do(c.ctx_, c.s.client, req)
  13883. }
  13884. return c.s.client.Do(req)
  13885. }
  13886. // Do executes the "directory.verificationCodes.list" call.
  13887. // Exactly one of *VerificationCodes or error will be non-nil. Any
  13888. // non-2xx status code is an error. Response headers are in either
  13889. // *VerificationCodes.ServerResponse.Header or (if a response was
  13890. // returned at all) in error.(*googleapi.Error).Header. Use
  13891. // googleapi.IsNotModified to check whether the returned error was
  13892. // because http.StatusNotModified was returned.
  13893. func (c *VerificationCodesListCall) Do(opts ...googleapi.CallOption) (*VerificationCodes, error) {
  13894. gensupport.SetOptions(c.urlParams_, opts...)
  13895. res, err := c.doRequest("json")
  13896. if res != nil && res.StatusCode == http.StatusNotModified {
  13897. if res.Body != nil {
  13898. res.Body.Close()
  13899. }
  13900. return nil, &googleapi.Error{
  13901. Code: res.StatusCode,
  13902. Header: res.Header,
  13903. }
  13904. }
  13905. if err != nil {
  13906. return nil, err
  13907. }
  13908. defer googleapi.CloseBody(res)
  13909. if err := googleapi.CheckResponse(res); err != nil {
  13910. return nil, err
  13911. }
  13912. ret := &VerificationCodes{
  13913. ServerResponse: googleapi.ServerResponse{
  13914. Header: res.Header,
  13915. HTTPStatusCode: res.StatusCode,
  13916. },
  13917. }
  13918. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  13919. return nil, err
  13920. }
  13921. return ret, nil
  13922. // {
  13923. // "description": "Returns the current set of valid backup verification codes for the specified user.",
  13924. // "httpMethod": "GET",
  13925. // "id": "directory.verificationCodes.list",
  13926. // "parameterOrder": [
  13927. // "userKey"
  13928. // ],
  13929. // "parameters": {
  13930. // "userKey": {
  13931. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  13932. // "location": "path",
  13933. // "required": true,
  13934. // "type": "string"
  13935. // }
  13936. // },
  13937. // "path": "users/{userKey}/verificationCodes",
  13938. // "response": {
  13939. // "$ref": "VerificationCodes"
  13940. // },
  13941. // "scopes": [
  13942. // "https://www.googleapis.com/auth/admin.directory.user.security"
  13943. // ]
  13944. // }
  13945. }