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.
 
 
 

803 lines
29 KiB

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