You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

862 lines
31 KiB

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