admin-gen.go 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544
  1. // Package admin provides access to the Admin Reports API.
  2. //
  3. // See https://developers.google.com/admin-sdk/reports/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/admin/reports/v1"
  8. // ...
  9. // adminService, err := admin.New(oauthHttpClient)
  10. package admin // import "google.golang.org/api/admin/reports/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:reports_v1"
  41. const apiName = "admin"
  42. const apiVersion = "reports_v1"
  43. const basePath = "https://www.googleapis.com/admin/reports/v1/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View audit reports of Google Apps for your domain
  47. AdminReportsAuditReadonlyScope = "https://www.googleapis.com/auth/admin.reports.audit.readonly"
  48. // View usage reports of Google Apps for your domain
  49. AdminReportsUsageReadonlyScope = "https://www.googleapis.com/auth/admin.reports.usage.readonly"
  50. )
  51. func New(client *http.Client) (*Service, error) {
  52. if client == nil {
  53. return nil, errors.New("client is nil")
  54. }
  55. s := &Service{client: client, BasePath: basePath}
  56. s.Activities = NewActivitiesService(s)
  57. s.Channels = NewChannelsService(s)
  58. s.CustomerUsageReports = NewCustomerUsageReportsService(s)
  59. s.UserUsageReport = NewUserUsageReportService(s)
  60. return s, nil
  61. }
  62. type Service struct {
  63. client *http.Client
  64. BasePath string // API endpoint base URL
  65. UserAgent string // optional additional User-Agent fragment
  66. Activities *ActivitiesService
  67. Channels *ChannelsService
  68. CustomerUsageReports *CustomerUsageReportsService
  69. UserUsageReport *UserUsageReportService
  70. }
  71. func (s *Service) userAgent() string {
  72. if s.UserAgent == "" {
  73. return googleapi.UserAgent
  74. }
  75. return googleapi.UserAgent + " " + s.UserAgent
  76. }
  77. func NewActivitiesService(s *Service) *ActivitiesService {
  78. rs := &ActivitiesService{s: s}
  79. return rs
  80. }
  81. type ActivitiesService struct {
  82. s *Service
  83. }
  84. func NewChannelsService(s *Service) *ChannelsService {
  85. rs := &ChannelsService{s: s}
  86. return rs
  87. }
  88. type ChannelsService struct {
  89. s *Service
  90. }
  91. func NewCustomerUsageReportsService(s *Service) *CustomerUsageReportsService {
  92. rs := &CustomerUsageReportsService{s: s}
  93. return rs
  94. }
  95. type CustomerUsageReportsService struct {
  96. s *Service
  97. }
  98. func NewUserUsageReportService(s *Service) *UserUsageReportService {
  99. rs := &UserUsageReportService{s: s}
  100. return rs
  101. }
  102. type UserUsageReportService struct {
  103. s *Service
  104. }
  105. // Activities: JSON template for a collection of activites.
  106. type Activities struct {
  107. // Etag: ETag of the resource.
  108. Etag string `json:"etag,omitempty"`
  109. // Items: Each record in read response.
  110. Items []*Activity `json:"items,omitempty"`
  111. // Kind: Kind of list response this is.
  112. Kind string `json:"kind,omitempty"`
  113. // NextPageToken: Token for retrieving the next page
  114. NextPageToken string `json:"nextPageToken,omitempty"`
  115. // ServerResponse contains the HTTP response code and headers from the
  116. // server.
  117. googleapi.ServerResponse `json:"-"`
  118. // ForceSendFields is a list of field names (e.g. "Etag") to
  119. // unconditionally include in API requests. By default, fields with
  120. // empty values are omitted from API requests. However, any non-pointer,
  121. // non-interface field appearing in ForceSendFields will be sent to the
  122. // server regardless of whether the field is empty or not. This may be
  123. // used to include empty fields in Patch requests.
  124. ForceSendFields []string `json:"-"`
  125. }
  126. func (s *Activities) MarshalJSON() ([]byte, error) {
  127. type noMethod Activities
  128. raw := noMethod(*s)
  129. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  130. }
  131. // Activity: JSON template for the activity resource.
  132. type Activity struct {
  133. // Actor: User doing the action.
  134. Actor *ActivityActor `json:"actor,omitempty"`
  135. // Etag: ETag of the entry.
  136. Etag string `json:"etag,omitempty"`
  137. // Events: Activity events.
  138. Events []*ActivityEvents `json:"events,omitempty"`
  139. // Id: Unique identifier for each activity record.
  140. Id *ActivityId `json:"id,omitempty"`
  141. // IpAddress: IP Address of the user doing the action.
  142. IpAddress string `json:"ipAddress,omitempty"`
  143. // Kind: Kind of resource this is.
  144. Kind string `json:"kind,omitempty"`
  145. // OwnerDomain: Domain of source customer.
  146. OwnerDomain string `json:"ownerDomain,omitempty"`
  147. // ForceSendFields is a list of field names (e.g. "Actor") to
  148. // unconditionally include in API requests. By default, fields with
  149. // empty values are omitted from API requests. However, any non-pointer,
  150. // non-interface field appearing in ForceSendFields will be sent to the
  151. // server regardless of whether the field is empty or not. This may be
  152. // used to include empty fields in Patch requests.
  153. ForceSendFields []string `json:"-"`
  154. }
  155. func (s *Activity) MarshalJSON() ([]byte, error) {
  156. type noMethod Activity
  157. raw := noMethod(*s)
  158. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  159. }
  160. // ActivityActor: User doing the action.
  161. type ActivityActor struct {
  162. // CallerType: User or OAuth 2LO request.
  163. CallerType string `json:"callerType,omitempty"`
  164. // Email: Email address of the user.
  165. Email string `json:"email,omitempty"`
  166. // Key: For OAuth 2LO API requests, consumer_key of the requestor.
  167. Key string `json:"key,omitempty"`
  168. // ProfileId: Obfuscated user id of the user.
  169. ProfileId string `json:"profileId,omitempty"`
  170. // ForceSendFields is a list of field names (e.g. "CallerType") to
  171. // unconditionally include in API requests. By default, fields with
  172. // empty values are omitted from API requests. However, any non-pointer,
  173. // non-interface field appearing in ForceSendFields will be sent to the
  174. // server regardless of whether the field is empty or not. This may be
  175. // used to include empty fields in Patch requests.
  176. ForceSendFields []string `json:"-"`
  177. }
  178. func (s *ActivityActor) MarshalJSON() ([]byte, error) {
  179. type noMethod ActivityActor
  180. raw := noMethod(*s)
  181. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  182. }
  183. type ActivityEvents struct {
  184. // Name: Name of event.
  185. Name string `json:"name,omitempty"`
  186. // Parameters: Parameter value pairs for various applications.
  187. Parameters []*ActivityEventsParameters `json:"parameters,omitempty"`
  188. // Type: Type of event.
  189. Type string `json:"type,omitempty"`
  190. // ForceSendFields is a list of field names (e.g. "Name") to
  191. // unconditionally include in API requests. By default, fields with
  192. // empty values are omitted from API requests. However, any non-pointer,
  193. // non-interface field appearing in ForceSendFields will be sent to the
  194. // server regardless of whether the field is empty or not. This may be
  195. // used to include empty fields in Patch requests.
  196. ForceSendFields []string `json:"-"`
  197. }
  198. func (s *ActivityEvents) MarshalJSON() ([]byte, error) {
  199. type noMethod ActivityEvents
  200. raw := noMethod(*s)
  201. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  202. }
  203. type ActivityEventsParameters struct {
  204. // BoolValue: Boolean value of the parameter.
  205. BoolValue bool `json:"boolValue,omitempty"`
  206. // IntValue: Integral value of the parameter.
  207. IntValue int64 `json:"intValue,omitempty,string"`
  208. // MultiIntValue: Multi-int value of the parameter.
  209. MultiIntValue googleapi.Int64s `json:"multiIntValue,omitempty"`
  210. // MultiValue: Multi-string value of the parameter.
  211. MultiValue []string `json:"multiValue,omitempty"`
  212. // Name: The name of the parameter.
  213. Name string `json:"name,omitempty"`
  214. // Value: String value of the parameter.
  215. Value string `json:"value,omitempty"`
  216. // ForceSendFields is a list of field names (e.g. "BoolValue") to
  217. // unconditionally include in API requests. By default, fields with
  218. // empty values are omitted from API requests. However, any non-pointer,
  219. // non-interface field appearing in ForceSendFields will be sent to the
  220. // server regardless of whether the field is empty or not. This may be
  221. // used to include empty fields in Patch requests.
  222. ForceSendFields []string `json:"-"`
  223. }
  224. func (s *ActivityEventsParameters) MarshalJSON() ([]byte, error) {
  225. type noMethod ActivityEventsParameters
  226. raw := noMethod(*s)
  227. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  228. }
  229. // ActivityId: Unique identifier for each activity record.
  230. type ActivityId struct {
  231. // ApplicationName: Application name to which the event belongs.
  232. ApplicationName string `json:"applicationName,omitempty"`
  233. // CustomerId: Obfuscated customer ID of the source customer.
  234. CustomerId string `json:"customerId,omitempty"`
  235. // Time: Time of occurrence of the activity.
  236. Time string `json:"time,omitempty"`
  237. // UniqueQualifier: Unique qualifier if multiple events have the same
  238. // time.
  239. UniqueQualifier int64 `json:"uniqueQualifier,omitempty,string"`
  240. // ForceSendFields is a list of field names (e.g. "ApplicationName") to
  241. // unconditionally include in API requests. By default, fields with
  242. // empty values are omitted from API requests. However, any non-pointer,
  243. // non-interface field appearing in ForceSendFields will be sent to the
  244. // server regardless of whether the field is empty or not. This may be
  245. // used to include empty fields in Patch requests.
  246. ForceSendFields []string `json:"-"`
  247. }
  248. func (s *ActivityId) MarshalJSON() ([]byte, error) {
  249. type noMethod ActivityId
  250. raw := noMethod(*s)
  251. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  252. }
  253. // Channel: An notification channel used to watch for resource changes.
  254. type Channel struct {
  255. // Address: The address where notifications are delivered for this
  256. // channel.
  257. Address string `json:"address,omitempty"`
  258. // Expiration: Date and time of notification channel expiration,
  259. // expressed as a Unix timestamp, in milliseconds. Optional.
  260. Expiration int64 `json:"expiration,omitempty,string"`
  261. // Id: A UUID or similar unique string that identifies this channel.
  262. Id string `json:"id,omitempty"`
  263. // Kind: Identifies this as a notification channel used to watch for
  264. // changes to a resource. Value: the fixed string "api#channel".
  265. Kind string `json:"kind,omitempty"`
  266. // Params: Additional parameters controlling delivery channel behavior.
  267. // Optional.
  268. Params map[string]string `json:"params,omitempty"`
  269. // Payload: A Boolean value to indicate whether payload is wanted.
  270. // Optional.
  271. Payload bool `json:"payload,omitempty"`
  272. // ResourceId: An opaque ID that identifies the resource being watched
  273. // on this channel. Stable across different API versions.
  274. ResourceId string `json:"resourceId,omitempty"`
  275. // ResourceUri: A version-specific identifier for the watched resource.
  276. ResourceUri string `json:"resourceUri,omitempty"`
  277. // Token: An arbitrary string delivered to the target address with each
  278. // notification delivered over this channel. Optional.
  279. Token string `json:"token,omitempty"`
  280. // Type: The type of delivery mechanism used for this channel.
  281. Type string `json:"type,omitempty"`
  282. // ServerResponse contains the HTTP response code and headers from the
  283. // server.
  284. googleapi.ServerResponse `json:"-"`
  285. // ForceSendFields is a list of field names (e.g. "Address") to
  286. // unconditionally include in API requests. By default, fields with
  287. // empty values are omitted from API requests. However, any non-pointer,
  288. // non-interface field appearing in ForceSendFields will be sent to the
  289. // server regardless of whether the field is empty or not. This may be
  290. // used to include empty fields in Patch requests.
  291. ForceSendFields []string `json:"-"`
  292. }
  293. func (s *Channel) MarshalJSON() ([]byte, error) {
  294. type noMethod Channel
  295. raw := noMethod(*s)
  296. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  297. }
  298. // UsageReport: JSON template for a usage report.
  299. type UsageReport struct {
  300. // Date: The date to which the record belongs.
  301. Date string `json:"date,omitempty"`
  302. // Entity: Information about the type of the item.
  303. Entity *UsageReportEntity `json:"entity,omitempty"`
  304. // Etag: ETag of the resource.
  305. Etag string `json:"etag,omitempty"`
  306. // Kind: The kind of object.
  307. Kind string `json:"kind,omitempty"`
  308. // Parameters: Parameter value pairs for various applications.
  309. Parameters []*UsageReportParameters `json:"parameters,omitempty"`
  310. // ForceSendFields is a list of field names (e.g. "Date") to
  311. // unconditionally include in API requests. By default, fields with
  312. // empty values are omitted from API requests. However, any non-pointer,
  313. // non-interface field appearing in ForceSendFields will be sent to the
  314. // server regardless of whether the field is empty or not. This may be
  315. // used to include empty fields in Patch requests.
  316. ForceSendFields []string `json:"-"`
  317. }
  318. func (s *UsageReport) MarshalJSON() ([]byte, error) {
  319. type noMethod UsageReport
  320. raw := noMethod(*s)
  321. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  322. }
  323. // UsageReportEntity: Information about the type of the item.
  324. type UsageReportEntity struct {
  325. // CustomerId: Obfuscated customer id for the record.
  326. CustomerId string `json:"customerId,omitempty"`
  327. // ProfileId: Obfuscated user id for the record.
  328. ProfileId string `json:"profileId,omitempty"`
  329. // Type: The type of item, can be a customer or user.
  330. Type string `json:"type,omitempty"`
  331. // UserEmail: user's email.
  332. UserEmail string `json:"userEmail,omitempty"`
  333. // ForceSendFields is a list of field names (e.g. "CustomerId") to
  334. // unconditionally include in API requests. By default, fields with
  335. // empty values are omitted from API requests. However, any non-pointer,
  336. // non-interface field appearing in ForceSendFields will be sent to the
  337. // server regardless of whether the field is empty or not. This may be
  338. // used to include empty fields in Patch requests.
  339. ForceSendFields []string `json:"-"`
  340. }
  341. func (s *UsageReportEntity) MarshalJSON() ([]byte, error) {
  342. type noMethod UsageReportEntity
  343. raw := noMethod(*s)
  344. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  345. }
  346. type UsageReportParameters struct {
  347. // BoolValue: Boolean value of the parameter.
  348. BoolValue bool `json:"boolValue,omitempty"`
  349. // DatetimeValue: RFC 3339 formatted value of the parameter.
  350. DatetimeValue string `json:"datetimeValue,omitempty"`
  351. // IntValue: Integral value of the parameter.
  352. IntValue int64 `json:"intValue,omitempty,string"`
  353. // MsgValue: Nested message value of the parameter.
  354. MsgValue []UsageReportParametersMsgValue `json:"msgValue,omitempty"`
  355. // Name: The name of the parameter.
  356. Name string `json:"name,omitempty"`
  357. // StringValue: String value of the parameter.
  358. StringValue string `json:"stringValue,omitempty"`
  359. // ForceSendFields is a list of field names (e.g. "BoolValue") to
  360. // unconditionally include in API requests. By default, fields with
  361. // empty values are omitted from API requests. However, any non-pointer,
  362. // non-interface field appearing in ForceSendFields will be sent to the
  363. // server regardless of whether the field is empty or not. This may be
  364. // used to include empty fields in Patch requests.
  365. ForceSendFields []string `json:"-"`
  366. }
  367. func (s *UsageReportParameters) MarshalJSON() ([]byte, error) {
  368. type noMethod UsageReportParameters
  369. raw := noMethod(*s)
  370. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  371. }
  372. type UsageReportParametersMsgValue interface{}
  373. // UsageReports: JSON template for a collection of usage reports.
  374. type UsageReports struct {
  375. // Etag: ETag of the resource.
  376. Etag string `json:"etag,omitempty"`
  377. // Kind: The kind of object.
  378. Kind string `json:"kind,omitempty"`
  379. // NextPageToken: Token for retrieving the next page
  380. NextPageToken string `json:"nextPageToken,omitempty"`
  381. // UsageReports: Various application parameter records.
  382. UsageReports []*UsageReport `json:"usageReports,omitempty"`
  383. // Warnings: Warnings if any.
  384. Warnings []*UsageReportsWarnings `json:"warnings,omitempty"`
  385. // ServerResponse contains the HTTP response code and headers from the
  386. // server.
  387. googleapi.ServerResponse `json:"-"`
  388. // ForceSendFields is a list of field names (e.g. "Etag") to
  389. // unconditionally include in API requests. By default, fields with
  390. // empty values are omitted from API requests. However, any non-pointer,
  391. // non-interface field appearing in ForceSendFields will be sent to the
  392. // server regardless of whether the field is empty or not. This may be
  393. // used to include empty fields in Patch requests.
  394. ForceSendFields []string `json:"-"`
  395. }
  396. func (s *UsageReports) MarshalJSON() ([]byte, error) {
  397. type noMethod UsageReports
  398. raw := noMethod(*s)
  399. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  400. }
  401. type UsageReportsWarnings struct {
  402. // Code: Machine readable code / warning type.
  403. Code string `json:"code,omitempty"`
  404. // Data: Key-Value pairs to give detailed information on the warning.
  405. Data []*UsageReportsWarningsData `json:"data,omitempty"`
  406. // Message: Human readable message for the warning.
  407. Message string `json:"message,omitempty"`
  408. // ForceSendFields is a list of field names (e.g. "Code") to
  409. // unconditionally include in API requests. By default, fields with
  410. // empty values are omitted from API requests. However, any non-pointer,
  411. // non-interface field appearing in ForceSendFields will be sent to the
  412. // server regardless of whether the field is empty or not. This may be
  413. // used to include empty fields in Patch requests.
  414. ForceSendFields []string `json:"-"`
  415. }
  416. func (s *UsageReportsWarnings) MarshalJSON() ([]byte, error) {
  417. type noMethod UsageReportsWarnings
  418. raw := noMethod(*s)
  419. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  420. }
  421. type UsageReportsWarningsData struct {
  422. // Key: Key associated with a key-value pair to give detailed
  423. // information on the warning.
  424. Key string `json:"key,omitempty"`
  425. // Value: Value associated with a key-value pair to give detailed
  426. // information on the warning.
  427. Value string `json:"value,omitempty"`
  428. // ForceSendFields is a list of field names (e.g. "Key") to
  429. // unconditionally include in API requests. By default, fields with
  430. // empty values are omitted from API requests. However, any non-pointer,
  431. // non-interface field appearing in ForceSendFields will be sent to the
  432. // server regardless of whether the field is empty or not. This may be
  433. // used to include empty fields in Patch requests.
  434. ForceSendFields []string `json:"-"`
  435. }
  436. func (s *UsageReportsWarningsData) MarshalJSON() ([]byte, error) {
  437. type noMethod UsageReportsWarningsData
  438. raw := noMethod(*s)
  439. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  440. }
  441. // method id "reports.activities.list":
  442. type ActivitiesListCall struct {
  443. s *Service
  444. userKey string
  445. applicationName string
  446. urlParams_ gensupport.URLParams
  447. ifNoneMatch_ string
  448. ctx_ context.Context
  449. }
  450. // List: Retrieves a list of activities for a specific customer and
  451. // application.
  452. func (r *ActivitiesService) List(userKey string, applicationName string) *ActivitiesListCall {
  453. c := &ActivitiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  454. c.userKey = userKey
  455. c.applicationName = applicationName
  456. return c
  457. }
  458. // ActorIpAddress sets the optional parameter "actorIpAddress": IP
  459. // Address of host where the event was performed. Supports both IPv4 and
  460. // IPv6 addresses.
  461. func (c *ActivitiesListCall) ActorIpAddress(actorIpAddress string) *ActivitiesListCall {
  462. c.urlParams_.Set("actorIpAddress", actorIpAddress)
  463. return c
  464. }
  465. // CustomerId sets the optional parameter "customerId": Represents the
  466. // customer for which the data is to be fetched.
  467. func (c *ActivitiesListCall) CustomerId(customerId string) *ActivitiesListCall {
  468. c.urlParams_.Set("customerId", customerId)
  469. return c
  470. }
  471. // EndTime sets the optional parameter "endTime": Return events which
  472. // occured at or before this time.
  473. func (c *ActivitiesListCall) EndTime(endTime string) *ActivitiesListCall {
  474. c.urlParams_.Set("endTime", endTime)
  475. return c
  476. }
  477. // EventName sets the optional parameter "eventName": Name of the event
  478. // being queried.
  479. func (c *ActivitiesListCall) EventName(eventName string) *ActivitiesListCall {
  480. c.urlParams_.Set("eventName", eventName)
  481. return c
  482. }
  483. // Filters sets the optional parameter "filters": Event parameters in
  484. // the form [parameter1 name][operator][parameter1 value],[parameter2
  485. // name][operator][parameter2 value],...
  486. func (c *ActivitiesListCall) Filters(filters string) *ActivitiesListCall {
  487. c.urlParams_.Set("filters", filters)
  488. return c
  489. }
  490. // MaxResults sets the optional parameter "maxResults": Number of
  491. // activity records to be shown in each page.
  492. func (c *ActivitiesListCall) MaxResults(maxResults int64) *ActivitiesListCall {
  493. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  494. return c
  495. }
  496. // PageToken sets the optional parameter "pageToken": Token to specify
  497. // next page.
  498. func (c *ActivitiesListCall) PageToken(pageToken string) *ActivitiesListCall {
  499. c.urlParams_.Set("pageToken", pageToken)
  500. return c
  501. }
  502. // StartTime sets the optional parameter "startTime": Return events
  503. // which occured at or after this time.
  504. func (c *ActivitiesListCall) StartTime(startTime string) *ActivitiesListCall {
  505. c.urlParams_.Set("startTime", startTime)
  506. return c
  507. }
  508. // Fields allows partial responses to be retrieved. See
  509. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  510. // for more information.
  511. func (c *ActivitiesListCall) Fields(s ...googleapi.Field) *ActivitiesListCall {
  512. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  513. return c
  514. }
  515. // IfNoneMatch sets the optional parameter which makes the operation
  516. // fail if the object's ETag matches the given value. This is useful for
  517. // getting updates only after the object has changed since the last
  518. // request. Use googleapi.IsNotModified to check whether the response
  519. // error from Do is the result of In-None-Match.
  520. func (c *ActivitiesListCall) IfNoneMatch(entityTag string) *ActivitiesListCall {
  521. c.ifNoneMatch_ = entityTag
  522. return c
  523. }
  524. // Context sets the context to be used in this call's Do method. Any
  525. // pending HTTP request will be aborted if the provided context is
  526. // canceled.
  527. func (c *ActivitiesListCall) Context(ctx context.Context) *ActivitiesListCall {
  528. c.ctx_ = ctx
  529. return c
  530. }
  531. func (c *ActivitiesListCall) doRequest(alt string) (*http.Response, error) {
  532. var body io.Reader = nil
  533. c.urlParams_.Set("alt", alt)
  534. urls := googleapi.ResolveRelative(c.s.BasePath, "activity/users/{userKey}/applications/{applicationName}")
  535. urls += "?" + c.urlParams_.Encode()
  536. req, _ := http.NewRequest("GET", urls, body)
  537. googleapi.Expand(req.URL, map[string]string{
  538. "userKey": c.userKey,
  539. "applicationName": c.applicationName,
  540. })
  541. req.Header.Set("User-Agent", c.s.userAgent())
  542. if c.ifNoneMatch_ != "" {
  543. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  544. }
  545. if c.ctx_ != nil {
  546. return ctxhttp.Do(c.ctx_, c.s.client, req)
  547. }
  548. return c.s.client.Do(req)
  549. }
  550. // Do executes the "reports.activities.list" call.
  551. // Exactly one of *Activities or error will be non-nil. Any non-2xx
  552. // status code is an error. Response headers are in either
  553. // *Activities.ServerResponse.Header or (if a response was returned at
  554. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  555. // to check whether the returned error was because
  556. // http.StatusNotModified was returned.
  557. func (c *ActivitiesListCall) Do(opts ...googleapi.CallOption) (*Activities, error) {
  558. gensupport.SetOptions(c.urlParams_, opts...)
  559. res, err := c.doRequest("json")
  560. if res != nil && res.StatusCode == http.StatusNotModified {
  561. if res.Body != nil {
  562. res.Body.Close()
  563. }
  564. return nil, &googleapi.Error{
  565. Code: res.StatusCode,
  566. Header: res.Header,
  567. }
  568. }
  569. if err != nil {
  570. return nil, err
  571. }
  572. defer googleapi.CloseBody(res)
  573. if err := googleapi.CheckResponse(res); err != nil {
  574. return nil, err
  575. }
  576. ret := &Activities{
  577. ServerResponse: googleapi.ServerResponse{
  578. Header: res.Header,
  579. HTTPStatusCode: res.StatusCode,
  580. },
  581. }
  582. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  583. return nil, err
  584. }
  585. return ret, nil
  586. // {
  587. // "description": "Retrieves a list of activities for a specific customer and application.",
  588. // "httpMethod": "GET",
  589. // "id": "reports.activities.list",
  590. // "parameterOrder": [
  591. // "userKey",
  592. // "applicationName"
  593. // ],
  594. // "parameters": {
  595. // "actorIpAddress": {
  596. // "description": "IP Address of host where the event was performed. Supports both IPv4 and IPv6 addresses.",
  597. // "location": "query",
  598. // "type": "string"
  599. // },
  600. // "applicationName": {
  601. // "description": "Application name for which the events are to be retrieved.",
  602. // "location": "path",
  603. // "pattern": "(admin)|(calendar)|(drive)|(login)|(mobile)|(token)|(groups)",
  604. // "required": true,
  605. // "type": "string"
  606. // },
  607. // "customerId": {
  608. // "description": "Represents the customer for which the data is to be fetched.",
  609. // "location": "query",
  610. // "pattern": "C.+",
  611. // "type": "string"
  612. // },
  613. // "endTime": {
  614. // "description": "Return events which occured at or before this time.",
  615. // "location": "query",
  616. // "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))",
  617. // "type": "string"
  618. // },
  619. // "eventName": {
  620. // "description": "Name of the event being queried.",
  621. // "location": "query",
  622. // "type": "string"
  623. // },
  624. // "filters": {
  625. // "description": "Event parameters in the form [parameter1 name][operator][parameter1 value],[parameter2 name][operator][parameter2 value],...",
  626. // "location": "query",
  627. // "pattern": "(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+,)*(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+)",
  628. // "type": "string"
  629. // },
  630. // "maxResults": {
  631. // "description": "Number of activity records to be shown in each page.",
  632. // "format": "int32",
  633. // "location": "query",
  634. // "maximum": "1000",
  635. // "minimum": "1",
  636. // "type": "integer"
  637. // },
  638. // "pageToken": {
  639. // "description": "Token to specify next page.",
  640. // "location": "query",
  641. // "type": "string"
  642. // },
  643. // "startTime": {
  644. // "description": "Return events which occured at or after this time.",
  645. // "location": "query",
  646. // "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))",
  647. // "type": "string"
  648. // },
  649. // "userKey": {
  650. // "description": "Represents the profile id or the user email for which the data should be filtered. When 'all' is specified as the userKey, it returns usageReports for all users.",
  651. // "location": "path",
  652. // "required": true,
  653. // "type": "string"
  654. // }
  655. // },
  656. // "path": "activity/users/{userKey}/applications/{applicationName}",
  657. // "response": {
  658. // "$ref": "Activities"
  659. // },
  660. // "scopes": [
  661. // "https://www.googleapis.com/auth/admin.reports.audit.readonly"
  662. // ],
  663. // "supportsSubscription": true
  664. // }
  665. }
  666. // Pages invokes f for each page of results.
  667. // A non-nil error returned from f will halt the iteration.
  668. // The provided context supersedes any context provided to the Context method.
  669. func (c *ActivitiesListCall) Pages(ctx context.Context, f func(*Activities) error) error {
  670. c.ctx_ = ctx
  671. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  672. for {
  673. x, err := c.Do()
  674. if err != nil {
  675. return err
  676. }
  677. if err := f(x); err != nil {
  678. return err
  679. }
  680. if x.NextPageToken == "" {
  681. return nil
  682. }
  683. c.PageToken(x.NextPageToken)
  684. }
  685. }
  686. // method id "reports.activities.watch":
  687. type ActivitiesWatchCall struct {
  688. s *Service
  689. userKey string
  690. applicationName string
  691. channel *Channel
  692. urlParams_ gensupport.URLParams
  693. ctx_ context.Context
  694. }
  695. // Watch: Push changes to activities
  696. func (r *ActivitiesService) Watch(userKey string, applicationName string, channel *Channel) *ActivitiesWatchCall {
  697. c := &ActivitiesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  698. c.userKey = userKey
  699. c.applicationName = applicationName
  700. c.channel = channel
  701. return c
  702. }
  703. // ActorIpAddress sets the optional parameter "actorIpAddress": IP
  704. // Address of host where the event was performed. Supports both IPv4 and
  705. // IPv6 addresses.
  706. func (c *ActivitiesWatchCall) ActorIpAddress(actorIpAddress string) *ActivitiesWatchCall {
  707. c.urlParams_.Set("actorIpAddress", actorIpAddress)
  708. return c
  709. }
  710. // CustomerId sets the optional parameter "customerId": Represents the
  711. // customer for which the data is to be fetched.
  712. func (c *ActivitiesWatchCall) CustomerId(customerId string) *ActivitiesWatchCall {
  713. c.urlParams_.Set("customerId", customerId)
  714. return c
  715. }
  716. // EndTime sets the optional parameter "endTime": Return events which
  717. // occured at or before this time.
  718. func (c *ActivitiesWatchCall) EndTime(endTime string) *ActivitiesWatchCall {
  719. c.urlParams_.Set("endTime", endTime)
  720. return c
  721. }
  722. // EventName sets the optional parameter "eventName": Name of the event
  723. // being queried.
  724. func (c *ActivitiesWatchCall) EventName(eventName string) *ActivitiesWatchCall {
  725. c.urlParams_.Set("eventName", eventName)
  726. return c
  727. }
  728. // Filters sets the optional parameter "filters": Event parameters in
  729. // the form [parameter1 name][operator][parameter1 value],[parameter2
  730. // name][operator][parameter2 value],...
  731. func (c *ActivitiesWatchCall) Filters(filters string) *ActivitiesWatchCall {
  732. c.urlParams_.Set("filters", filters)
  733. return c
  734. }
  735. // MaxResults sets the optional parameter "maxResults": Number of
  736. // activity records to be shown in each page.
  737. func (c *ActivitiesWatchCall) MaxResults(maxResults int64) *ActivitiesWatchCall {
  738. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  739. return c
  740. }
  741. // PageToken sets the optional parameter "pageToken": Token to specify
  742. // next page.
  743. func (c *ActivitiesWatchCall) PageToken(pageToken string) *ActivitiesWatchCall {
  744. c.urlParams_.Set("pageToken", pageToken)
  745. return c
  746. }
  747. // StartTime sets the optional parameter "startTime": Return events
  748. // which occured at or after this time.
  749. func (c *ActivitiesWatchCall) StartTime(startTime string) *ActivitiesWatchCall {
  750. c.urlParams_.Set("startTime", startTime)
  751. return c
  752. }
  753. // Fields allows partial responses to be retrieved. See
  754. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  755. // for more information.
  756. func (c *ActivitiesWatchCall) Fields(s ...googleapi.Field) *ActivitiesWatchCall {
  757. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  758. return c
  759. }
  760. // Context sets the context to be used in this call's Do method. Any
  761. // pending HTTP request will be aborted if the provided context is
  762. // canceled.
  763. func (c *ActivitiesWatchCall) Context(ctx context.Context) *ActivitiesWatchCall {
  764. c.ctx_ = ctx
  765. return c
  766. }
  767. func (c *ActivitiesWatchCall) doRequest(alt string) (*http.Response, error) {
  768. var body io.Reader = nil
  769. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  770. if err != nil {
  771. return nil, err
  772. }
  773. ctype := "application/json"
  774. c.urlParams_.Set("alt", alt)
  775. urls := googleapi.ResolveRelative(c.s.BasePath, "activity/users/{userKey}/applications/{applicationName}/watch")
  776. urls += "?" + c.urlParams_.Encode()
  777. req, _ := http.NewRequest("POST", urls, body)
  778. googleapi.Expand(req.URL, map[string]string{
  779. "userKey": c.userKey,
  780. "applicationName": c.applicationName,
  781. })
  782. req.Header.Set("Content-Type", ctype)
  783. req.Header.Set("User-Agent", c.s.userAgent())
  784. if c.ctx_ != nil {
  785. return ctxhttp.Do(c.ctx_, c.s.client, req)
  786. }
  787. return c.s.client.Do(req)
  788. }
  789. // Do executes the "reports.activities.watch" call.
  790. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  791. // code is an error. Response headers are in either
  792. // *Channel.ServerResponse.Header or (if a response was returned at all)
  793. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  794. // check whether the returned error was because http.StatusNotModified
  795. // was returned.
  796. func (c *ActivitiesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  797. gensupport.SetOptions(c.urlParams_, opts...)
  798. res, err := c.doRequest("json")
  799. if res != nil && res.StatusCode == http.StatusNotModified {
  800. if res.Body != nil {
  801. res.Body.Close()
  802. }
  803. return nil, &googleapi.Error{
  804. Code: res.StatusCode,
  805. Header: res.Header,
  806. }
  807. }
  808. if err != nil {
  809. return nil, err
  810. }
  811. defer googleapi.CloseBody(res)
  812. if err := googleapi.CheckResponse(res); err != nil {
  813. return nil, err
  814. }
  815. ret := &Channel{
  816. ServerResponse: googleapi.ServerResponse{
  817. Header: res.Header,
  818. HTTPStatusCode: res.StatusCode,
  819. },
  820. }
  821. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  822. return nil, err
  823. }
  824. return ret, nil
  825. // {
  826. // "description": "Push changes to activities",
  827. // "httpMethod": "POST",
  828. // "id": "reports.activities.watch",
  829. // "parameterOrder": [
  830. // "userKey",
  831. // "applicationName"
  832. // ],
  833. // "parameters": {
  834. // "actorIpAddress": {
  835. // "description": "IP Address of host where the event was performed. Supports both IPv4 and IPv6 addresses.",
  836. // "location": "query",
  837. // "type": "string"
  838. // },
  839. // "applicationName": {
  840. // "description": "Application name for which the events are to be retrieved.",
  841. // "location": "path",
  842. // "pattern": "(admin)|(calendar)|(drive)|(login)|(mobile)|(token)|(groups)",
  843. // "required": true,
  844. // "type": "string"
  845. // },
  846. // "customerId": {
  847. // "description": "Represents the customer for which the data is to be fetched.",
  848. // "location": "query",
  849. // "pattern": "C.+",
  850. // "type": "string"
  851. // },
  852. // "endTime": {
  853. // "description": "Return events which occured at or before this time.",
  854. // "location": "query",
  855. // "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))",
  856. // "type": "string"
  857. // },
  858. // "eventName": {
  859. // "description": "Name of the event being queried.",
  860. // "location": "query",
  861. // "type": "string"
  862. // },
  863. // "filters": {
  864. // "description": "Event parameters in the form [parameter1 name][operator][parameter1 value],[parameter2 name][operator][parameter2 value],...",
  865. // "location": "query",
  866. // "pattern": "(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+,)*(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+)",
  867. // "type": "string"
  868. // },
  869. // "maxResults": {
  870. // "description": "Number of activity records to be shown in each page.",
  871. // "format": "int32",
  872. // "location": "query",
  873. // "maximum": "1000",
  874. // "minimum": "1",
  875. // "type": "integer"
  876. // },
  877. // "pageToken": {
  878. // "description": "Token to specify next page.",
  879. // "location": "query",
  880. // "type": "string"
  881. // },
  882. // "startTime": {
  883. // "description": "Return events which occured at or after this time.",
  884. // "location": "query",
  885. // "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))",
  886. // "type": "string"
  887. // },
  888. // "userKey": {
  889. // "description": "Represents the profile id or the user email for which the data should be filtered. When 'all' is specified as the userKey, it returns usageReports for all users.",
  890. // "location": "path",
  891. // "required": true,
  892. // "type": "string"
  893. // }
  894. // },
  895. // "path": "activity/users/{userKey}/applications/{applicationName}/watch",
  896. // "request": {
  897. // "$ref": "Channel",
  898. // "parameterName": "resource"
  899. // },
  900. // "response": {
  901. // "$ref": "Channel"
  902. // },
  903. // "scopes": [
  904. // "https://www.googleapis.com/auth/admin.reports.audit.readonly"
  905. // ],
  906. // "supportsSubscription": true
  907. // }
  908. }
  909. // method id "admin.channels.stop":
  910. type ChannelsStopCall struct {
  911. s *Service
  912. channel *Channel
  913. urlParams_ gensupport.URLParams
  914. ctx_ context.Context
  915. }
  916. // Stop: Stop watching resources through this channel
  917. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  918. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  919. c.channel = channel
  920. return c
  921. }
  922. // Fields allows partial responses to be retrieved. See
  923. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  924. // for more information.
  925. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  926. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  927. return c
  928. }
  929. // Context sets the context to be used in this call's Do method. Any
  930. // pending HTTP request will be aborted if the provided context is
  931. // canceled.
  932. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  933. c.ctx_ = ctx
  934. return c
  935. }
  936. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  937. var body io.Reader = nil
  938. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  939. if err != nil {
  940. return nil, err
  941. }
  942. ctype := "application/json"
  943. c.urlParams_.Set("alt", alt)
  944. urls := googleapi.ResolveRelative(c.s.BasePath, "/admin/reports_v1/channels/stop")
  945. urls += "?" + c.urlParams_.Encode()
  946. req, _ := http.NewRequest("POST", urls, body)
  947. googleapi.SetOpaque(req.URL)
  948. req.Header.Set("Content-Type", ctype)
  949. req.Header.Set("User-Agent", c.s.userAgent())
  950. if c.ctx_ != nil {
  951. return ctxhttp.Do(c.ctx_, c.s.client, req)
  952. }
  953. return c.s.client.Do(req)
  954. }
  955. // Do executes the "admin.channels.stop" call.
  956. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  957. gensupport.SetOptions(c.urlParams_, opts...)
  958. res, err := c.doRequest("json")
  959. if err != nil {
  960. return err
  961. }
  962. defer googleapi.CloseBody(res)
  963. if err := googleapi.CheckResponse(res); err != nil {
  964. return err
  965. }
  966. return nil
  967. // {
  968. // "description": "Stop watching resources through this channel",
  969. // "httpMethod": "POST",
  970. // "id": "admin.channels.stop",
  971. // "path": "/admin/reports_v1/channels/stop",
  972. // "request": {
  973. // "$ref": "Channel",
  974. // "parameterName": "resource"
  975. // },
  976. // "scopes": [
  977. // "https://www.googleapis.com/auth/admin.reports.audit.readonly"
  978. // ]
  979. // }
  980. }
  981. // method id "reports.customerUsageReports.get":
  982. type CustomerUsageReportsGetCall struct {
  983. s *Service
  984. date string
  985. urlParams_ gensupport.URLParams
  986. ifNoneMatch_ string
  987. ctx_ context.Context
  988. }
  989. // Get: Retrieves a report which is a collection of properties /
  990. // statistics for a specific customer.
  991. func (r *CustomerUsageReportsService) Get(date string) *CustomerUsageReportsGetCall {
  992. c := &CustomerUsageReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  993. c.date = date
  994. return c
  995. }
  996. // CustomerId sets the optional parameter "customerId": Represents the
  997. // customer for which the data is to be fetched.
  998. func (c *CustomerUsageReportsGetCall) CustomerId(customerId string) *CustomerUsageReportsGetCall {
  999. c.urlParams_.Set("customerId", customerId)
  1000. return c
  1001. }
  1002. // PageToken sets the optional parameter "pageToken": Token to specify
  1003. // next page.
  1004. func (c *CustomerUsageReportsGetCall) PageToken(pageToken string) *CustomerUsageReportsGetCall {
  1005. c.urlParams_.Set("pageToken", pageToken)
  1006. return c
  1007. }
  1008. // Parameters sets the optional parameter "parameters": Represents the
  1009. // application name, parameter name pairs to fetch in csv as
  1010. // app_name1:param_name1, app_name2:param_name2.
  1011. func (c *CustomerUsageReportsGetCall) Parameters(parameters string) *CustomerUsageReportsGetCall {
  1012. c.urlParams_.Set("parameters", parameters)
  1013. return c
  1014. }
  1015. // Fields allows partial responses to be retrieved. See
  1016. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1017. // for more information.
  1018. func (c *CustomerUsageReportsGetCall) Fields(s ...googleapi.Field) *CustomerUsageReportsGetCall {
  1019. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1020. return c
  1021. }
  1022. // IfNoneMatch sets the optional parameter which makes the operation
  1023. // fail if the object's ETag matches the given value. This is useful for
  1024. // getting updates only after the object has changed since the last
  1025. // request. Use googleapi.IsNotModified to check whether the response
  1026. // error from Do is the result of In-None-Match.
  1027. func (c *CustomerUsageReportsGetCall) IfNoneMatch(entityTag string) *CustomerUsageReportsGetCall {
  1028. c.ifNoneMatch_ = entityTag
  1029. return c
  1030. }
  1031. // Context sets the context to be used in this call's Do method. Any
  1032. // pending HTTP request will be aborted if the provided context is
  1033. // canceled.
  1034. func (c *CustomerUsageReportsGetCall) Context(ctx context.Context) *CustomerUsageReportsGetCall {
  1035. c.ctx_ = ctx
  1036. return c
  1037. }
  1038. func (c *CustomerUsageReportsGetCall) doRequest(alt string) (*http.Response, error) {
  1039. var body io.Reader = nil
  1040. c.urlParams_.Set("alt", alt)
  1041. urls := googleapi.ResolveRelative(c.s.BasePath, "usage/dates/{date}")
  1042. urls += "?" + c.urlParams_.Encode()
  1043. req, _ := http.NewRequest("GET", urls, body)
  1044. googleapi.Expand(req.URL, map[string]string{
  1045. "date": c.date,
  1046. })
  1047. req.Header.Set("User-Agent", c.s.userAgent())
  1048. if c.ifNoneMatch_ != "" {
  1049. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1050. }
  1051. if c.ctx_ != nil {
  1052. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1053. }
  1054. return c.s.client.Do(req)
  1055. }
  1056. // Do executes the "reports.customerUsageReports.get" call.
  1057. // Exactly one of *UsageReports or error will be non-nil. Any non-2xx
  1058. // status code is an error. Response headers are in either
  1059. // *UsageReports.ServerResponse.Header or (if a response was returned at
  1060. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1061. // to check whether the returned error was because
  1062. // http.StatusNotModified was returned.
  1063. func (c *CustomerUsageReportsGetCall) Do(opts ...googleapi.CallOption) (*UsageReports, error) {
  1064. gensupport.SetOptions(c.urlParams_, opts...)
  1065. res, err := c.doRequest("json")
  1066. if res != nil && res.StatusCode == http.StatusNotModified {
  1067. if res.Body != nil {
  1068. res.Body.Close()
  1069. }
  1070. return nil, &googleapi.Error{
  1071. Code: res.StatusCode,
  1072. Header: res.Header,
  1073. }
  1074. }
  1075. if err != nil {
  1076. return nil, err
  1077. }
  1078. defer googleapi.CloseBody(res)
  1079. if err := googleapi.CheckResponse(res); err != nil {
  1080. return nil, err
  1081. }
  1082. ret := &UsageReports{
  1083. ServerResponse: googleapi.ServerResponse{
  1084. Header: res.Header,
  1085. HTTPStatusCode: res.StatusCode,
  1086. },
  1087. }
  1088. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1089. return nil, err
  1090. }
  1091. return ret, nil
  1092. // {
  1093. // "description": "Retrieves a report which is a collection of properties / statistics for a specific customer.",
  1094. // "httpMethod": "GET",
  1095. // "id": "reports.customerUsageReports.get",
  1096. // "parameterOrder": [
  1097. // "date"
  1098. // ],
  1099. // "parameters": {
  1100. // "customerId": {
  1101. // "description": "Represents the customer for which the data is to be fetched.",
  1102. // "location": "query",
  1103. // "pattern": "C.+",
  1104. // "type": "string"
  1105. // },
  1106. // "date": {
  1107. // "description": "Represents the date in yyyy-mm-dd format for which the data is to be fetched.",
  1108. // "location": "path",
  1109. // "pattern": "(\\d){4}-(\\d){2}-(\\d){2}",
  1110. // "required": true,
  1111. // "type": "string"
  1112. // },
  1113. // "pageToken": {
  1114. // "description": "Token to specify next page.",
  1115. // "location": "query",
  1116. // "type": "string"
  1117. // },
  1118. // "parameters": {
  1119. // "description": "Represents the application name, parameter name pairs to fetch in csv as app_name1:param_name1, app_name2:param_name2.",
  1120. // "location": "query",
  1121. // "pattern": "(((accounts)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)):[^,]+,)*(((accounts)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)):[^,]+)",
  1122. // "type": "string"
  1123. // }
  1124. // },
  1125. // "path": "usage/dates/{date}",
  1126. // "response": {
  1127. // "$ref": "UsageReports"
  1128. // },
  1129. // "scopes": [
  1130. // "https://www.googleapis.com/auth/admin.reports.usage.readonly"
  1131. // ]
  1132. // }
  1133. }
  1134. // Pages invokes f for each page of results.
  1135. // A non-nil error returned from f will halt the iteration.
  1136. // The provided context supersedes any context provided to the Context method.
  1137. func (c *CustomerUsageReportsGetCall) Pages(ctx context.Context, f func(*UsageReports) error) error {
  1138. c.ctx_ = ctx
  1139. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1140. for {
  1141. x, err := c.Do()
  1142. if err != nil {
  1143. return err
  1144. }
  1145. if err := f(x); err != nil {
  1146. return err
  1147. }
  1148. if x.NextPageToken == "" {
  1149. return nil
  1150. }
  1151. c.PageToken(x.NextPageToken)
  1152. }
  1153. }
  1154. // method id "reports.userUsageReport.get":
  1155. type UserUsageReportGetCall struct {
  1156. s *Service
  1157. userKey string
  1158. date string
  1159. urlParams_ gensupport.URLParams
  1160. ifNoneMatch_ string
  1161. ctx_ context.Context
  1162. }
  1163. // Get: Retrieves a report which is a collection of properties /
  1164. // statistics for a set of users.
  1165. func (r *UserUsageReportService) Get(userKey string, date string) *UserUsageReportGetCall {
  1166. c := &UserUsageReportGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1167. c.userKey = userKey
  1168. c.date = date
  1169. return c
  1170. }
  1171. // CustomerId sets the optional parameter "customerId": Represents the
  1172. // customer for which the data is to be fetched.
  1173. func (c *UserUsageReportGetCall) CustomerId(customerId string) *UserUsageReportGetCall {
  1174. c.urlParams_.Set("customerId", customerId)
  1175. return c
  1176. }
  1177. // Filters sets the optional parameter "filters": Represents the set of
  1178. // filters including parameter operator value.
  1179. func (c *UserUsageReportGetCall) Filters(filters string) *UserUsageReportGetCall {
  1180. c.urlParams_.Set("filters", filters)
  1181. return c
  1182. }
  1183. // MaxResults sets the optional parameter "maxResults": Maximum number
  1184. // of results to return. Maximum allowed is 1000
  1185. func (c *UserUsageReportGetCall) MaxResults(maxResults int64) *UserUsageReportGetCall {
  1186. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1187. return c
  1188. }
  1189. // PageToken sets the optional parameter "pageToken": Token to specify
  1190. // next page.
  1191. func (c *UserUsageReportGetCall) PageToken(pageToken string) *UserUsageReportGetCall {
  1192. c.urlParams_.Set("pageToken", pageToken)
  1193. return c
  1194. }
  1195. // Parameters sets the optional parameter "parameters": Represents the
  1196. // application name, parameter name pairs to fetch in csv as
  1197. // app_name1:param_name1, app_name2:param_name2.
  1198. func (c *UserUsageReportGetCall) Parameters(parameters string) *UserUsageReportGetCall {
  1199. c.urlParams_.Set("parameters", parameters)
  1200. return c
  1201. }
  1202. // Fields allows partial responses to be retrieved. See
  1203. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1204. // for more information.
  1205. func (c *UserUsageReportGetCall) Fields(s ...googleapi.Field) *UserUsageReportGetCall {
  1206. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1207. return c
  1208. }
  1209. // IfNoneMatch sets the optional parameter which makes the operation
  1210. // fail if the object's ETag matches the given value. This is useful for
  1211. // getting updates only after the object has changed since the last
  1212. // request. Use googleapi.IsNotModified to check whether the response
  1213. // error from Do is the result of In-None-Match.
  1214. func (c *UserUsageReportGetCall) IfNoneMatch(entityTag string) *UserUsageReportGetCall {
  1215. c.ifNoneMatch_ = entityTag
  1216. return c
  1217. }
  1218. // Context sets the context to be used in this call's Do method. Any
  1219. // pending HTTP request will be aborted if the provided context is
  1220. // canceled.
  1221. func (c *UserUsageReportGetCall) Context(ctx context.Context) *UserUsageReportGetCall {
  1222. c.ctx_ = ctx
  1223. return c
  1224. }
  1225. func (c *UserUsageReportGetCall) doRequest(alt string) (*http.Response, error) {
  1226. var body io.Reader = nil
  1227. c.urlParams_.Set("alt", alt)
  1228. urls := googleapi.ResolveRelative(c.s.BasePath, "usage/users/{userKey}/dates/{date}")
  1229. urls += "?" + c.urlParams_.Encode()
  1230. req, _ := http.NewRequest("GET", urls, body)
  1231. googleapi.Expand(req.URL, map[string]string{
  1232. "userKey": c.userKey,
  1233. "date": c.date,
  1234. })
  1235. req.Header.Set("User-Agent", c.s.userAgent())
  1236. if c.ifNoneMatch_ != "" {
  1237. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1238. }
  1239. if c.ctx_ != nil {
  1240. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1241. }
  1242. return c.s.client.Do(req)
  1243. }
  1244. // Do executes the "reports.userUsageReport.get" call.
  1245. // Exactly one of *UsageReports or error will be non-nil. Any non-2xx
  1246. // status code is an error. Response headers are in either
  1247. // *UsageReports.ServerResponse.Header or (if a response was returned at
  1248. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1249. // to check whether the returned error was because
  1250. // http.StatusNotModified was returned.
  1251. func (c *UserUsageReportGetCall) Do(opts ...googleapi.CallOption) (*UsageReports, error) {
  1252. gensupport.SetOptions(c.urlParams_, opts...)
  1253. res, err := c.doRequest("json")
  1254. if res != nil && res.StatusCode == http.StatusNotModified {
  1255. if res.Body != nil {
  1256. res.Body.Close()
  1257. }
  1258. return nil, &googleapi.Error{
  1259. Code: res.StatusCode,
  1260. Header: res.Header,
  1261. }
  1262. }
  1263. if err != nil {
  1264. return nil, err
  1265. }
  1266. defer googleapi.CloseBody(res)
  1267. if err := googleapi.CheckResponse(res); err != nil {
  1268. return nil, err
  1269. }
  1270. ret := &UsageReports{
  1271. ServerResponse: googleapi.ServerResponse{
  1272. Header: res.Header,
  1273. HTTPStatusCode: res.StatusCode,
  1274. },
  1275. }
  1276. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1277. return nil, err
  1278. }
  1279. return ret, nil
  1280. // {
  1281. // "description": "Retrieves a report which is a collection of properties / statistics for a set of users.",
  1282. // "httpMethod": "GET",
  1283. // "id": "reports.userUsageReport.get",
  1284. // "parameterOrder": [
  1285. // "userKey",
  1286. // "date"
  1287. // ],
  1288. // "parameters": {
  1289. // "customerId": {
  1290. // "description": "Represents the customer for which the data is to be fetched.",
  1291. // "location": "query",
  1292. // "pattern": "C.+",
  1293. // "type": "string"
  1294. // },
  1295. // "date": {
  1296. // "description": "Represents the date in yyyy-mm-dd format for which the data is to be fetched.",
  1297. // "location": "path",
  1298. // "pattern": "(\\d){4}-(\\d){2}-(\\d){2}",
  1299. // "required": true,
  1300. // "type": "string"
  1301. // },
  1302. // "filters": {
  1303. // "description": "Represents the set of filters including parameter operator value.",
  1304. // "location": "query",
  1305. // "pattern": "(((accounts)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)):[a-z0-9_]+[\u003c,\u003c=,==,\u003e=,\u003e,!=][^,]+,)*(((accounts)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)):[a-z0-9_]+[\u003c,\u003c=,==,\u003e=,\u003e,!=][^,]+)",
  1306. // "type": "string"
  1307. // },
  1308. // "maxResults": {
  1309. // "description": "Maximum number of results to return. Maximum allowed is 1000",
  1310. // "format": "uint32",
  1311. // "location": "query",
  1312. // "maximum": "1000",
  1313. // "type": "integer"
  1314. // },
  1315. // "pageToken": {
  1316. // "description": "Token to specify next page.",
  1317. // "location": "query",
  1318. // "type": "string"
  1319. // },
  1320. // "parameters": {
  1321. // "description": "Represents the application name, parameter name pairs to fetch in csv as app_name1:param_name1, app_name2:param_name2.",
  1322. // "location": "query",
  1323. // "pattern": "(((accounts)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)):[^,]+,)*(((accounts)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)):[^,]+)",
  1324. // "type": "string"
  1325. // },
  1326. // "userKey": {
  1327. // "description": "Represents the profile id or the user email for which the data should be filtered.",
  1328. // "location": "path",
  1329. // "required": true,
  1330. // "type": "string"
  1331. // }
  1332. // },
  1333. // "path": "usage/users/{userKey}/dates/{date}",
  1334. // "response": {
  1335. // "$ref": "UsageReports"
  1336. // },
  1337. // "scopes": [
  1338. // "https://www.googleapis.com/auth/admin.reports.usage.readonly"
  1339. // ]
  1340. // }
  1341. }
  1342. // Pages invokes f for each page of results.
  1343. // A non-nil error returned from f will halt the iteration.
  1344. // The provided context supersedes any context provided to the Context method.
  1345. func (c *UserUsageReportGetCall) Pages(ctx context.Context, f func(*UsageReports) error) error {
  1346. c.ctx_ = ctx
  1347. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1348. for {
  1349. x, err := c.Do()
  1350. if err != nil {
  1351. return err
  1352. }
  1353. if err := f(x); err != nil {
  1354. return err
  1355. }
  1356. if x.NextPageToken == "" {
  1357. return nil
  1358. }
  1359. c.PageToken(x.NextPageToken)
  1360. }
  1361. }