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