1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Code generated file. DO NOT EDIT.
6
7// Package appsactivity provides access to the Drive Activity API.
8//
9// For product documentation, see: https://developers.google.com/google-apps/activity/
10//
11// Creating a client
12//
13// Usage example:
14//
15//   import "google.golang.org/api/appsactivity/v1"
16//   ...
17//   ctx := context.Background()
18//   appsactivityService, err := appsactivity.NewService(ctx)
19//
20// In this example, Google Application Default Credentials are used for authentication.
21//
22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
23//
24// Other authentication options
25//
26// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
27//
28//   appsactivityService, err := appsactivity.NewService(ctx, option.WithAPIKey("AIza..."))
29//
30// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
31//
32//   config := &oauth2.Config{...}
33//   // ...
34//   token, err := config.Exchange(ctx, ...)
35//   appsactivityService, err := appsactivity.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
36//
37// See https://godoc.org/google.golang.org/api/option/ for details on options.
38package appsactivity // import "google.golang.org/api/appsactivity/v1"
39
40import (
41	"bytes"
42	"context"
43	"encoding/json"
44	"errors"
45	"fmt"
46	"io"
47	"net/http"
48	"net/url"
49	"strconv"
50	"strings"
51
52	gensupport "google.golang.org/api/gensupport"
53	googleapi "google.golang.org/api/googleapi"
54	option "google.golang.org/api/option"
55	htransport "google.golang.org/api/transport/http"
56)
57
58// Always reference these packages, just in case the auto-generated code
59// below doesn't.
60var _ = bytes.NewBuffer
61var _ = strconv.Itoa
62var _ = fmt.Sprintf
63var _ = json.NewDecoder
64var _ = io.Copy
65var _ = url.Parse
66var _ = gensupport.MarshalJSON
67var _ = googleapi.Version
68var _ = errors.New
69var _ = strings.Replace
70var _ = context.Canceled
71
72const apiId = "appsactivity:v1"
73const apiName = "appsactivity"
74const apiVersion = "v1"
75const basePath = "https://www.googleapis.com/appsactivity/v1/"
76
77// OAuth2 scopes used by this API.
78const (
79	// View the activity history of your Google apps
80	ActivityScope = "https://www.googleapis.com/auth/activity"
81)
82
83// NewService creates a new Service.
84func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
85	scopesOption := option.WithScopes(
86		"https://www.googleapis.com/auth/activity",
87	)
88	// NOTE: prepend, so we don't override user-specified scopes.
89	opts = append([]option.ClientOption{scopesOption}, opts...)
90	client, endpoint, err := htransport.NewClient(ctx, opts...)
91	if err != nil {
92		return nil, err
93	}
94	s, err := New(client)
95	if err != nil {
96		return nil, err
97	}
98	if endpoint != "" {
99		s.BasePath = endpoint
100	}
101	return s, nil
102}
103
104// New creates a new Service. It uses the provided http.Client for requests.
105//
106// Deprecated: please use NewService instead.
107// To provide a custom HTTP client, use option.WithHTTPClient.
108// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
109func New(client *http.Client) (*Service, error) {
110	if client == nil {
111		return nil, errors.New("client is nil")
112	}
113	s := &Service{client: client, BasePath: basePath}
114	s.Activities = NewActivitiesService(s)
115	return s, nil
116}
117
118type Service struct {
119	client    *http.Client
120	BasePath  string // API endpoint base URL
121	UserAgent string // optional additional User-Agent fragment
122
123	Activities *ActivitiesService
124}
125
126func (s *Service) userAgent() string {
127	if s.UserAgent == "" {
128		return googleapi.UserAgent
129	}
130	return googleapi.UserAgent + " " + s.UserAgent
131}
132
133func NewActivitiesService(s *Service) *ActivitiesService {
134	rs := &ActivitiesService{s: s}
135	return rs
136}
137
138type ActivitiesService struct {
139	s *Service
140}
141
142// Activity: An Activity resource is a combined view of multiple events.
143// An activity has a list of individual events and a combined view of
144// the common fields among all events.
145type Activity struct {
146	// CombinedEvent: The fields common to all of the singleEvents that make
147	// up the Activity.
148	CombinedEvent *Event `json:"combinedEvent,omitempty"`
149
150	// SingleEvents: A list of all the Events that make up the Activity.
151	SingleEvents []*Event `json:"singleEvents,omitempty"`
152
153	// ForceSendFields is a list of field names (e.g. "CombinedEvent") to
154	// unconditionally include in API requests. By default, fields with
155	// empty values are omitted from API requests. However, any non-pointer,
156	// non-interface field appearing in ForceSendFields will be sent to the
157	// server regardless of whether the field is empty or not. This may be
158	// used to include empty fields in Patch requests.
159	ForceSendFields []string `json:"-"`
160
161	// NullFields is a list of field names (e.g. "CombinedEvent") to include
162	// in API requests with the JSON null value. By default, fields with
163	// empty values are omitted from API requests. However, any field with
164	// an empty value appearing in NullFields will be sent to the server as
165	// null. It is an error if a field in this list has a non-empty value.
166	// This may be used to include null fields in Patch requests.
167	NullFields []string `json:"-"`
168}
169
170func (s *Activity) MarshalJSON() ([]byte, error) {
171	type NoMethod Activity
172	raw := NoMethod(*s)
173	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
174}
175
176// Event: Represents the changes associated with an action taken by a
177// user.
178type Event struct {
179	// AdditionalEventTypes: Additional event types. Some events may have
180	// multiple types when multiple actions are part of a single event. For
181	// example, creating a document, renaming it, and sharing it may be part
182	// of a single file-creation event.
183	//
184	// Possible values:
185	//   "comment"
186	//   "create"
187	//   "edit"
188	//   "emptyTrash"
189	//   "move"
190	//   "permissionChange"
191	//   "rename"
192	//   "trash"
193	//   "unknown"
194	//   "untrash"
195	//   "upload"
196	AdditionalEventTypes []string `json:"additionalEventTypes,omitempty"`
197
198	// EventTimeMillis: The time at which the event occurred formatted as
199	// Unix time in milliseconds.
200	EventTimeMillis uint64 `json:"eventTimeMillis,omitempty,string"`
201
202	// FromUserDeletion: Whether this event is caused by a user being
203	// deleted.
204	FromUserDeletion bool `json:"fromUserDeletion,omitempty"`
205
206	// Move: Extra information for move type events, such as changes in an
207	// object's parents.
208	Move *Move `json:"move,omitempty"`
209
210	// PermissionChanges: Extra information for permissionChange type
211	// events, such as the user or group the new permission applies to.
212	PermissionChanges []*PermissionChange `json:"permissionChanges,omitempty"`
213
214	// PrimaryEventType: The main type of event that occurred.
215	//
216	// Possible values:
217	//   "comment"
218	//   "create"
219	//   "edit"
220	//   "emptyTrash"
221	//   "move"
222	//   "permissionChange"
223	//   "rename"
224	//   "trash"
225	//   "unknown"
226	//   "untrash"
227	//   "upload"
228	PrimaryEventType string `json:"primaryEventType,omitempty"`
229
230	// Rename: Extra information for rename type events, such as the old and
231	// new names.
232	Rename *Rename `json:"rename,omitempty"`
233
234	// Target: Information specific to the Target object modified by the
235	// event.
236	Target *Target `json:"target,omitempty"`
237
238	// User: Represents the user responsible for the event.
239	User *User `json:"user,omitempty"`
240
241	// ForceSendFields is a list of field names (e.g.
242	// "AdditionalEventTypes") to unconditionally include in API requests.
243	// By default, fields with empty values are omitted from API requests.
244	// However, any non-pointer, non-interface field appearing in
245	// ForceSendFields will be sent to the server regardless of whether the
246	// field is empty or not. This may be used to include empty fields in
247	// Patch requests.
248	ForceSendFields []string `json:"-"`
249
250	// NullFields is a list of field names (e.g. "AdditionalEventTypes") to
251	// include in API requests with the JSON null value. By default, fields
252	// with empty values are omitted from API requests. However, any field
253	// with an empty value appearing in NullFields will be sent to the
254	// server as null. It is an error if a field in this list has a
255	// non-empty value. This may be used to include null fields in Patch
256	// requests.
257	NullFields []string `json:"-"`
258}
259
260func (s *Event) MarshalJSON() ([]byte, error) {
261	type NoMethod Event
262	raw := NoMethod(*s)
263	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
264}
265
266// ListActivitiesResponse: The response from the list request. Contains
267// a list of activities and a token to retrieve the next page of
268// results.
269type ListActivitiesResponse struct {
270	// Activities: List of activities.
271	Activities []*Activity `json:"activities,omitempty"`
272
273	// NextPageToken: Token for the next page of results.
274	NextPageToken string `json:"nextPageToken,omitempty"`
275
276	// ServerResponse contains the HTTP response code and headers from the
277	// server.
278	googleapi.ServerResponse `json:"-"`
279
280	// ForceSendFields is a list of field names (e.g. "Activities") to
281	// unconditionally include in API requests. By default, fields with
282	// empty values are omitted from API requests. However, any non-pointer,
283	// non-interface field appearing in ForceSendFields will be sent to the
284	// server regardless of whether the field is empty or not. This may be
285	// used to include empty fields in Patch requests.
286	ForceSendFields []string `json:"-"`
287
288	// NullFields is a list of field names (e.g. "Activities") to include in
289	// API requests with the JSON null value. By default, fields with empty
290	// values are omitted from API requests. However, any field with an
291	// empty value appearing in NullFields will be sent to the server as
292	// null. It is an error if a field in this list has a non-empty value.
293	// This may be used to include null fields in Patch requests.
294	NullFields []string `json:"-"`
295}
296
297func (s *ListActivitiesResponse) MarshalJSON() ([]byte, error) {
298	type NoMethod ListActivitiesResponse
299	raw := NoMethod(*s)
300	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
301}
302
303// Move: Contains information about changes in an object's parents as a
304// result of a move type event.
305type Move struct {
306	// AddedParents: The added parent(s).
307	AddedParents []*Parent `json:"addedParents,omitempty"`
308
309	// RemovedParents: The removed parent(s).
310	RemovedParents []*Parent `json:"removedParents,omitempty"`
311
312	// ForceSendFields is a list of field names (e.g. "AddedParents") to
313	// unconditionally include in API requests. By default, fields with
314	// empty values are omitted from API requests. However, any non-pointer,
315	// non-interface field appearing in ForceSendFields will be sent to the
316	// server regardless of whether the field is empty or not. This may be
317	// used to include empty fields in Patch requests.
318	ForceSendFields []string `json:"-"`
319
320	// NullFields is a list of field names (e.g. "AddedParents") to include
321	// in API requests with the JSON null value. By default, fields with
322	// empty values are omitted from API requests. However, any field with
323	// an empty value appearing in NullFields will be sent to the server as
324	// null. It is an error if a field in this list has a non-empty value.
325	// This may be used to include null fields in Patch requests.
326	NullFields []string `json:"-"`
327}
328
329func (s *Move) MarshalJSON() ([]byte, error) {
330	type NoMethod Move
331	raw := NoMethod(*s)
332	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
333}
334
335// Parent: Contains information about a parent object. For example, a
336// folder in Drive is a parent for all files within it.
337type Parent struct {
338	// Id: The parent's ID.
339	Id string `json:"id,omitempty"`
340
341	// IsRoot: Whether this is the root folder.
342	IsRoot bool `json:"isRoot,omitempty"`
343
344	// Title: The parent's title.
345	Title string `json:"title,omitempty"`
346
347	// ForceSendFields is a list of field names (e.g. "Id") to
348	// unconditionally include in API requests. By default, fields with
349	// empty values are omitted from API requests. However, any non-pointer,
350	// non-interface field appearing in ForceSendFields will be sent to the
351	// server regardless of whether the field is empty or not. This may be
352	// used to include empty fields in Patch requests.
353	ForceSendFields []string `json:"-"`
354
355	// NullFields is a list of field names (e.g. "Id") to include in API
356	// requests with the JSON null value. By default, fields with empty
357	// values are omitted from API requests. However, any field with an
358	// empty value appearing in NullFields will be sent to the server as
359	// null. It is an error if a field in this list has a non-empty value.
360	// This may be used to include null fields in Patch requests.
361	NullFields []string `json:"-"`
362}
363
364func (s *Parent) MarshalJSON() ([]byte, error) {
365	type NoMethod Parent
366	raw := NoMethod(*s)
367	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
368}
369
370// Permission: Contains information about the permissions and type of
371// access allowed with regards to a Google Drive object. This is a
372// subset of the fields contained in a corresponding Drive Permissions
373// object.
374type Permission struct {
375	// Name: The name of the user or group the permission applies to.
376	Name string `json:"name,omitempty"`
377
378	// PermissionId: The ID for this permission. Corresponds to the Drive
379	// API's permission ID returned as part of the Drive Permissions
380	// resource.
381	PermissionId string `json:"permissionId,omitempty"`
382
383	// Role: Indicates the Google Drive permissions role. The role
384	// determines a user's ability to read, write, or comment on the file.
385	//
386	// Possible values:
387	//   "commenter"
388	//   "owner"
389	//   "publishedReader"
390	//   "reader"
391	//   "writer"
392	Role string `json:"role,omitempty"`
393
394	// Type: Indicates how widely permissions are granted.
395	//
396	// Possible values:
397	//   "anyone"
398	//   "domain"
399	//   "group"
400	//   "user"
401	Type string `json:"type,omitempty"`
402
403	// User: The user's information if the type is USER.
404	User *User `json:"user,omitempty"`
405
406	// WithLink: Whether the permission requires a link to the file.
407	WithLink bool `json:"withLink,omitempty"`
408
409	// ForceSendFields is a list of field names (e.g. "Name") to
410	// unconditionally include in API requests. By default, fields with
411	// empty values are omitted from API requests. However, any non-pointer,
412	// non-interface field appearing in ForceSendFields will be sent to the
413	// server regardless of whether the field is empty or not. This may be
414	// used to include empty fields in Patch requests.
415	ForceSendFields []string `json:"-"`
416
417	// NullFields is a list of field names (e.g. "Name") to include in API
418	// requests with the JSON null value. By default, fields with empty
419	// values are omitted from API requests. However, any field with an
420	// empty value appearing in NullFields will be sent to the server as
421	// null. It is an error if a field in this list has a non-empty value.
422	// This may be used to include null fields in Patch requests.
423	NullFields []string `json:"-"`
424}
425
426func (s *Permission) MarshalJSON() ([]byte, error) {
427	type NoMethod Permission
428	raw := NoMethod(*s)
429	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
430}
431
432// PermissionChange: Contains information about a Drive object's
433// permissions that changed as a result of a permissionChange type
434// event.
435type PermissionChange struct {
436	// AddedPermissions: Lists all Permission objects added.
437	AddedPermissions []*Permission `json:"addedPermissions,omitempty"`
438
439	// RemovedPermissions: Lists all Permission objects removed.
440	RemovedPermissions []*Permission `json:"removedPermissions,omitempty"`
441
442	// ForceSendFields is a list of field names (e.g. "AddedPermissions") to
443	// unconditionally include in API requests. By default, fields with
444	// empty values are omitted from API requests. However, any non-pointer,
445	// non-interface field appearing in ForceSendFields will be sent to the
446	// server regardless of whether the field is empty or not. This may be
447	// used to include empty fields in Patch requests.
448	ForceSendFields []string `json:"-"`
449
450	// NullFields is a list of field names (e.g. "AddedPermissions") to
451	// include in API requests with the JSON null value. By default, fields
452	// with empty values are omitted from API requests. However, any field
453	// with an empty value appearing in NullFields will be sent to the
454	// server as null. It is an error if a field in this list has a
455	// non-empty value. This may be used to include null fields in Patch
456	// requests.
457	NullFields []string `json:"-"`
458}
459
460func (s *PermissionChange) MarshalJSON() ([]byte, error) {
461	type NoMethod PermissionChange
462	raw := NoMethod(*s)
463	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
464}
465
466// Photo: Photo information for a user.
467type Photo struct {
468	// Url: The URL of the photo.
469	Url string `json:"url,omitempty"`
470
471	// ForceSendFields is a list of field names (e.g. "Url") to
472	// unconditionally include in API requests. By default, fields with
473	// empty values are omitted from API requests. However, any non-pointer,
474	// non-interface field appearing in ForceSendFields will be sent to the
475	// server regardless of whether the field is empty or not. This may be
476	// used to include empty fields in Patch requests.
477	ForceSendFields []string `json:"-"`
478
479	// NullFields is a list of field names (e.g. "Url") to include in API
480	// requests with the JSON null value. By default, fields with empty
481	// values are omitted from API requests. However, any field with an
482	// empty value appearing in NullFields will be sent to the server as
483	// null. It is an error if a field in this list has a non-empty value.
484	// This may be used to include null fields in Patch requests.
485	NullFields []string `json:"-"`
486}
487
488func (s *Photo) MarshalJSON() ([]byte, error) {
489	type NoMethod Photo
490	raw := NoMethod(*s)
491	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
492}
493
494// Rename: Contains information about a renametype event.
495type Rename struct {
496	// NewTitle: The new title.
497	NewTitle string `json:"newTitle,omitempty"`
498
499	// OldTitle: The old title.
500	OldTitle string `json:"oldTitle,omitempty"`
501
502	// ForceSendFields is a list of field names (e.g. "NewTitle") to
503	// unconditionally include in API requests. By default, fields with
504	// empty values are omitted from API requests. However, any non-pointer,
505	// non-interface field appearing in ForceSendFields will be sent to the
506	// server regardless of whether the field is empty or not. This may be
507	// used to include empty fields in Patch requests.
508	ForceSendFields []string `json:"-"`
509
510	// NullFields is a list of field names (e.g. "NewTitle") to include in
511	// API requests with the JSON null value. By default, fields with empty
512	// values are omitted from API requests. However, any field with an
513	// empty value appearing in NullFields will be sent to the server as
514	// null. It is an error if a field in this list has a non-empty value.
515	// This may be used to include null fields in Patch requests.
516	NullFields []string `json:"-"`
517}
518
519func (s *Rename) MarshalJSON() ([]byte, error) {
520	type NoMethod Rename
521	raw := NoMethod(*s)
522	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
523}
524
525// Target: Information about the object modified by the event.
526type Target struct {
527	// Id: The ID of the target. For example, in Google Drive, this is the
528	// file or folder ID.
529	Id string `json:"id,omitempty"`
530
531	// MimeType: The MIME type of the target.
532	MimeType string `json:"mimeType,omitempty"`
533
534	// Name: The name of the target. For example, in Google Drive, this is
535	// the title of the file.
536	Name string `json:"name,omitempty"`
537
538	// ForceSendFields is a list of field names (e.g. "Id") to
539	// unconditionally include in API requests. By default, fields with
540	// empty values are omitted from API requests. However, any non-pointer,
541	// non-interface field appearing in ForceSendFields will be sent to the
542	// server regardless of whether the field is empty or not. This may be
543	// used to include empty fields in Patch requests.
544	ForceSendFields []string `json:"-"`
545
546	// NullFields is a list of field names (e.g. "Id") to include in API
547	// requests with the JSON null value. By default, fields with empty
548	// values are omitted from API requests. However, any field with an
549	// empty value appearing in NullFields will be sent to the server as
550	// null. It is an error if a field in this list has a non-empty value.
551	// This may be used to include null fields in Patch requests.
552	NullFields []string `json:"-"`
553}
554
555func (s *Target) MarshalJSON() ([]byte, error) {
556	type NoMethod Target
557	raw := NoMethod(*s)
558	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
559}
560
561// User: A representation of a user.
562type User struct {
563	// IsDeleted: A boolean which indicates whether the specified User was
564	// deleted. If true, name, photo and permission_id will be omitted.
565	IsDeleted bool `json:"isDeleted,omitempty"`
566
567	// IsMe: Whether the user is the authenticated user.
568	IsMe bool `json:"isMe,omitempty"`
569
570	// Name: The displayable name of the user.
571	Name string `json:"name,omitempty"`
572
573	// PermissionId: The permission ID associated with this user. Equivalent
574	// to the Drive API's permission ID for this user, returned as part of
575	// the Drive Permissions resource.
576	PermissionId string `json:"permissionId,omitempty"`
577
578	// Photo: The profile photo of the user. Not present if the user has no
579	// profile photo.
580	Photo *Photo `json:"photo,omitempty"`
581
582	// ForceSendFields is a list of field names (e.g. "IsDeleted") to
583	// unconditionally include in API requests. By default, fields with
584	// empty values are omitted from API requests. However, any non-pointer,
585	// non-interface field appearing in ForceSendFields will be sent to the
586	// server regardless of whether the field is empty or not. This may be
587	// used to include empty fields in Patch requests.
588	ForceSendFields []string `json:"-"`
589
590	// NullFields is a list of field names (e.g. "IsDeleted") to include in
591	// API requests with the JSON null value. By default, fields with empty
592	// values are omitted from API requests. However, any field with an
593	// empty value appearing in NullFields will be sent to the server as
594	// null. It is an error if a field in this list has a non-empty value.
595	// This may be used to include null fields in Patch requests.
596	NullFields []string `json:"-"`
597}
598
599func (s *User) MarshalJSON() ([]byte, error) {
600	type NoMethod User
601	raw := NoMethod(*s)
602	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
603}
604
605// method id "appsactivity.activities.list":
606
607type ActivitiesListCall struct {
608	s            *Service
609	urlParams_   gensupport.URLParams
610	ifNoneMatch_ string
611	ctx_         context.Context
612	header_      http.Header
613}
614
615// List: Returns a list of activities visible to the current logged in
616// user. Visible activities are determined by the visibility settings of
617// the object that was acted on, e.g. Drive files a user can see. An
618// activity is a record of past events. Multiple events may be merged if
619// they are similar. A request is scoped to activities from a given
620// Google service using the source parameter.
621func (r *ActivitiesService) List() *ActivitiesListCall {
622	c := &ActivitiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
623	return c
624}
625
626// DriveAncestorId sets the optional parameter "drive.ancestorId":
627// Identifies the Drive folder containing the items for which to return
628// activities.
629func (c *ActivitiesListCall) DriveAncestorId(driveAncestorId string) *ActivitiesListCall {
630	c.urlParams_.Set("drive.ancestorId", driveAncestorId)
631	return c
632}
633
634// DriveFileId sets the optional parameter "drive.fileId": Identifies
635// the Drive item to return activities for.
636func (c *ActivitiesListCall) DriveFileId(driveFileId string) *ActivitiesListCall {
637	c.urlParams_.Set("drive.fileId", driveFileId)
638	return c
639}
640
641// GroupingStrategy sets the optional parameter "groupingStrategy":
642// Indicates the strategy to use when grouping singleEvents items in the
643// associated combinedEvent object.
644//
645// Possible values:
646//   "driveUi" (default)
647//   "none"
648func (c *ActivitiesListCall) GroupingStrategy(groupingStrategy string) *ActivitiesListCall {
649	c.urlParams_.Set("groupingStrategy", groupingStrategy)
650	return c
651}
652
653// PageSize sets the optional parameter "pageSize": The maximum number
654// of events to return on a page. The response includes a continuation
655// token if there are more events.
656func (c *ActivitiesListCall) PageSize(pageSize int64) *ActivitiesListCall {
657	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
658	return c
659}
660
661// PageToken sets the optional parameter "pageToken": A token to
662// retrieve a specific page of results.
663func (c *ActivitiesListCall) PageToken(pageToken string) *ActivitiesListCall {
664	c.urlParams_.Set("pageToken", pageToken)
665	return c
666}
667
668// Source sets the optional parameter "source": The Google service from
669// which to return activities. Possible values of source are:
670// - drive.google.com
671func (c *ActivitiesListCall) Source(source string) *ActivitiesListCall {
672	c.urlParams_.Set("source", source)
673	return c
674}
675
676// UserId sets the optional parameter "userId": The ID used for ACL
677// checks (does not filter the resulting event list by the assigned
678// value). Use the special value me to indicate the currently
679// authenticated user.
680func (c *ActivitiesListCall) UserId(userId string) *ActivitiesListCall {
681	c.urlParams_.Set("userId", userId)
682	return c
683}
684
685// Fields allows partial responses to be retrieved. See
686// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
687// for more information.
688func (c *ActivitiesListCall) Fields(s ...googleapi.Field) *ActivitiesListCall {
689	c.urlParams_.Set("fields", googleapi.CombineFields(s))
690	return c
691}
692
693// IfNoneMatch sets the optional parameter which makes the operation
694// fail if the object's ETag matches the given value. This is useful for
695// getting updates only after the object has changed since the last
696// request. Use googleapi.IsNotModified to check whether the response
697// error from Do is the result of In-None-Match.
698func (c *ActivitiesListCall) IfNoneMatch(entityTag string) *ActivitiesListCall {
699	c.ifNoneMatch_ = entityTag
700	return c
701}
702
703// Context sets the context to be used in this call's Do method. Any
704// pending HTTP request will be aborted if the provided context is
705// canceled.
706func (c *ActivitiesListCall) Context(ctx context.Context) *ActivitiesListCall {
707	c.ctx_ = ctx
708	return c
709}
710
711// Header returns an http.Header that can be modified by the caller to
712// add HTTP headers to the request.
713func (c *ActivitiesListCall) Header() http.Header {
714	if c.header_ == nil {
715		c.header_ = make(http.Header)
716	}
717	return c.header_
718}
719
720func (c *ActivitiesListCall) doRequest(alt string) (*http.Response, error) {
721	reqHeaders := make(http.Header)
722	for k, v := range c.header_ {
723		reqHeaders[k] = v
724	}
725	reqHeaders.Set("User-Agent", c.s.userAgent())
726	if c.ifNoneMatch_ != "" {
727		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
728	}
729	var body io.Reader = nil
730	c.urlParams_.Set("alt", alt)
731	c.urlParams_.Set("prettyPrint", "false")
732	urls := googleapi.ResolveRelative(c.s.BasePath, "activities")
733	urls += "?" + c.urlParams_.Encode()
734	req, err := http.NewRequest("GET", urls, body)
735	if err != nil {
736		return nil, err
737	}
738	req.Header = reqHeaders
739	return gensupport.SendRequest(c.ctx_, c.s.client, req)
740}
741
742// Do executes the "appsactivity.activities.list" call.
743// Exactly one of *ListActivitiesResponse or error will be non-nil. Any
744// non-2xx status code is an error. Response headers are in either
745// *ListActivitiesResponse.ServerResponse.Header or (if a response was
746// returned at all) in error.(*googleapi.Error).Header. Use
747// googleapi.IsNotModified to check whether the returned error was
748// because http.StatusNotModified was returned.
749func (c *ActivitiesListCall) Do(opts ...googleapi.CallOption) (*ListActivitiesResponse, error) {
750	gensupport.SetOptions(c.urlParams_, opts...)
751	res, err := c.doRequest("json")
752	if res != nil && res.StatusCode == http.StatusNotModified {
753		if res.Body != nil {
754			res.Body.Close()
755		}
756		return nil, &googleapi.Error{
757			Code:   res.StatusCode,
758			Header: res.Header,
759		}
760	}
761	if err != nil {
762		return nil, err
763	}
764	defer googleapi.CloseBody(res)
765	if err := googleapi.CheckResponse(res); err != nil {
766		return nil, err
767	}
768	ret := &ListActivitiesResponse{
769		ServerResponse: googleapi.ServerResponse{
770			Header:         res.Header,
771			HTTPStatusCode: res.StatusCode,
772		},
773	}
774	target := &ret
775	if err := gensupport.DecodeResponse(target, res); err != nil {
776		return nil, err
777	}
778	return ret, nil
779	// {
780	//   "description": "Returns a list of activities visible to the current logged in user. Visible activities are determined by the visibility settings of the object that was acted on, e.g. Drive files a user can see. An activity is a record of past events. Multiple events may be merged if they are similar. A request is scoped to activities from a given Google service using the source parameter.",
781	//   "httpMethod": "GET",
782	//   "id": "appsactivity.activities.list",
783	//   "parameters": {
784	//     "drive.ancestorId": {
785	//       "description": "Identifies the Drive folder containing the items for which to return activities.",
786	//       "location": "query",
787	//       "type": "string"
788	//     },
789	//     "drive.fileId": {
790	//       "description": "Identifies the Drive item to return activities for.",
791	//       "location": "query",
792	//       "type": "string"
793	//     },
794	//     "groupingStrategy": {
795	//       "default": "driveUi",
796	//       "description": "Indicates the strategy to use when grouping singleEvents items in the associated combinedEvent object.",
797	//       "enum": [
798	//         "driveUi",
799	//         "none"
800	//       ],
801	//       "enumDescriptions": [
802	//         "",
803	//         ""
804	//       ],
805	//       "location": "query",
806	//       "type": "string"
807	//     },
808	//     "pageSize": {
809	//       "default": "50",
810	//       "description": "The maximum number of events to return on a page. The response includes a continuation token if there are more events.",
811	//       "format": "int32",
812	//       "location": "query",
813	//       "type": "integer"
814	//     },
815	//     "pageToken": {
816	//       "description": "A token to retrieve a specific page of results.",
817	//       "location": "query",
818	//       "type": "string"
819	//     },
820	//     "source": {
821	//       "description": "The Google service from which to return activities. Possible values of source are: \n- drive.google.com",
822	//       "location": "query",
823	//       "type": "string"
824	//     },
825	//     "userId": {
826	//       "default": "me",
827	//       "description": "The ID used for ACL checks (does not filter the resulting event list by the assigned value). Use the special value me to indicate the currently authenticated user.",
828	//       "location": "query",
829	//       "type": "string"
830	//     }
831	//   },
832	//   "path": "activities",
833	//   "response": {
834	//     "$ref": "ListActivitiesResponse"
835	//   },
836	//   "scopes": [
837	//     "https://www.googleapis.com/auth/activity"
838	//   ]
839	// }
840
841}
842
843// Pages invokes f for each page of results.
844// A non-nil error returned from f will halt the iteration.
845// The provided context supersedes any context provided to the Context method.
846func (c *ActivitiesListCall) Pages(ctx context.Context, f func(*ListActivitiesResponse) error) error {
847	c.ctx_ = ctx
848	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
849	for {
850		x, err := c.Do()
851		if err != nil {
852			return err
853		}
854		if err := f(x); err != nil {
855			return err
856		}
857		if x.NextPageToken == "" {
858			return nil
859		}
860		c.PageToken(x.NextPageToken)
861	}
862}
863