1
// Package appsactivity provides access to the Google Apps Activity API.
3
// See https://developers.google.com/google-apps/activity/
7
// import "google.golang.org/api/appsactivity/v1"
9
// appsactivityService, err := appsactivity.New(oauthHttpClient)
17
"google.golang.org/api/googleapi"
25
// Always reference these packages, just in case the auto-generated code
27
var _ = bytes.NewBuffer
30
var _ = json.NewDecoder
33
var _ = googleapi.Version
35
var _ = strings.Replace
37
const apiId = "appsactivity:v1"
38
const apiName = "appsactivity"
39
const apiVersion = "v1"
40
const basePath = "https://www.googleapis.com/appsactivity/v1/"
42
// OAuth2 scopes used by this API.
44
// View the activity history of your Google Apps
45
ActivityScope = "https://www.googleapis.com/auth/activity"
47
// View and manage the files and documents in your Google Drive
48
DriveScope = "https://www.googleapis.com/auth/drive"
50
// View metadata for files and documents in your Google Drive
51
DriveMetadataReadonlyScope = "https://www.googleapis.com/auth/drive.metadata.readonly"
53
// View the files and documents in your Google Drive
54
DriveReadonlyScope = "https://www.googleapis.com/auth/drive.readonly"
57
func New(client *http.Client) (*Service, error) {
59
return nil, errors.New("client is nil")
61
s := &Service{client: client, BasePath: basePath}
62
s.Activities = NewActivitiesService(s)
68
BasePath string // API endpoint base URL
70
Activities *ActivitiesService
73
func NewActivitiesService(s *Service) *ActivitiesService {
74
rs := &ActivitiesService{s: s}
78
type ActivitiesService struct {
82
type Activity struct {
83
// CombinedEvent: The fields common to all of the singleEvents that make
85
CombinedEvent *Event `json:"combinedEvent,omitempty"`
87
// SingleEvents: A list of all the Events that make up the Activity.
88
SingleEvents []*Event `json:"singleEvents,omitempty"`
92
// AdditionalEventTypes: Additional event types. Some events may have
93
// multiple types when multiple actions are part of a single event. For
94
// example, creating a document, renaming it, and sharing it may be part
95
// of a single file-creation event.
96
AdditionalEventTypes []string `json:"additionalEventTypes,omitempty"`
98
// EventTimeMillis: The time at which the event occurred formatted as
99
// Unix time in milliseconds.
100
EventTimeMillis uint64 `json:"eventTimeMillis,omitempty,string"`
102
// FromUserDeletion: Whether this event is caused by a user being
104
FromUserDeletion bool `json:"fromUserDeletion,omitempty"`
106
// Move: Extra information for move type events, such as changes in an
108
Move *Move `json:"move,omitempty"`
110
// PermissionChanges: Extra information for permissionChange type
111
// events, such as the user or group the new permission applies to.
112
PermissionChanges []*PermissionChange `json:"permissionChanges,omitempty"`
114
// PrimaryEventType: The main type of event that occurred.
115
PrimaryEventType string `json:"primaryEventType,omitempty"`
117
// Rename: Extra information for rename type events, such as the old and
119
Rename *Rename `json:"rename,omitempty"`
121
// Target: Information specific to the Target object modified by the
123
Target *Target `json:"target,omitempty"`
125
// User: Represents the user responsible for the event.
126
User *User `json:"user,omitempty"`
129
type ListActivitiesResponse struct {
130
// Activities: List of activities.
131
Activities []*Activity `json:"activities,omitempty"`
133
// NextPageToken: Token for the next page of results.
134
NextPageToken string `json:"nextPageToken,omitempty"`
138
// AddedParents: The added parent(s).
139
AddedParents []*Parent `json:"addedParents,omitempty"`
141
// RemovedParents: The removed parent(s).
142
RemovedParents []*Parent `json:"removedParents,omitempty"`
146
// Id: The parent's ID.
147
Id string `json:"id,omitempty"`
149
// IsRoot: Whether this is the root folder.
150
IsRoot bool `json:"isRoot,omitempty"`
152
// Title: The parent's title.
153
Title string `json:"title,omitempty"`
156
type Permission struct {
157
// Name: The name of the user or group the permission applies to.
158
Name string `json:"name,omitempty"`
160
// PermissionId: The ID for this permission. Corresponds to the Drive
161
// API's permission ID returned as part of the Drive Permissions
163
PermissionId string `json:"permissionId,omitempty"`
165
// Role: Indicates the Google Drive permissions role. The role
166
// determines a user's ability to read, write, or comment on the file.
167
Role string `json:"role,omitempty"`
169
// Type: Indicates how widely permissions are granted.
170
Type string `json:"type,omitempty"`
172
// User: The user's information if the type is USER.
173
User *User `json:"user,omitempty"`
175
// WithLink: Whether the permission requires a link to the file.
176
WithLink bool `json:"withLink,omitempty"`
179
type PermissionChange struct {
180
// AddedPermissions: Lists all Permission objects added.
181
AddedPermissions []*Permission `json:"addedPermissions,omitempty"`
183
// RemovedPermissions: Lists all Permission objects removed.
184
RemovedPermissions []*Permission `json:"removedPermissions,omitempty"`
188
// Url: The URL of the photo.
189
Url string `json:"url,omitempty"`
193
// NewTitle: The new title.
194
NewTitle string `json:"newTitle,omitempty"`
196
// OldTitle: The old title.
197
OldTitle string `json:"oldTitle,omitempty"`
201
// Id: The ID of the target. For example, in Google Drive, this is the
202
// file or folder ID.
203
Id string `json:"id,omitempty"`
205
// MimeType: The MIME type of the target.
206
MimeType string `json:"mimeType,omitempty"`
208
// Name: The name of the target. For example, in Google Drive, this is
209
// the title of the file.
210
Name string `json:"name,omitempty"`
214
// Name: The displayable name of the user.
215
Name string `json:"name,omitempty"`
217
// Photo: The profile photo of the user.
218
Photo *Photo `json:"photo,omitempty"`
221
// method id "appsactivity.activities.list":
223
type ActivitiesListCall struct {
225
opt_ map[string]interface{}
228
// List: Returns a list of activities visible to the current logged in
229
// user. Visible activities are determined by the visiblity settings of
230
// the object that was acted on, e.g. Drive files a user can see. An
231
// activity is a record of past events. Multiple events may be merged if
232
// they are similar. A request is scoped to activities from a given
233
// Google service using the source parameter.
234
func (r *ActivitiesService) List() *ActivitiesListCall {
235
c := &ActivitiesListCall{s: r.s, opt_: make(map[string]interface{})}
239
// DriveAncestorId sets the optional parameter "drive.ancestorId":
240
// Identifies the Drive folder containing the items for which to return
242
func (c *ActivitiesListCall) DriveAncestorId(driveAncestorId string) *ActivitiesListCall {
243
c.opt_["drive.ancestorId"] = driveAncestorId
247
// DriveFileId sets the optional parameter "drive.fileId": Identifies
248
// the Drive item to return activities for.
249
func (c *ActivitiesListCall) DriveFileId(driveFileId string) *ActivitiesListCall {
250
c.opt_["drive.fileId"] = driveFileId
254
// GroupingStrategy sets the optional parameter "groupingStrategy":
255
// Indicates the strategy to use when grouping singleEvents items in the
256
// associated combinedEvent object.
257
func (c *ActivitiesListCall) GroupingStrategy(groupingStrategy string) *ActivitiesListCall {
258
c.opt_["groupingStrategy"] = groupingStrategy
262
// PageSize sets the optional parameter "pageSize": The maximum number
263
// of events to return on a page. The response includes a continuation
264
// token if there are more events.
265
func (c *ActivitiesListCall) PageSize(pageSize int64) *ActivitiesListCall {
266
c.opt_["pageSize"] = pageSize
270
// PageToken sets the optional parameter "pageToken": A token to
271
// retrieve a specific page of results.
272
func (c *ActivitiesListCall) PageToken(pageToken string) *ActivitiesListCall {
273
c.opt_["pageToken"] = pageToken
277
// Source sets the optional parameter "source": The Google service from
278
// which to return activities. Possible values of source are:
281
func (c *ActivitiesListCall) Source(source string) *ActivitiesListCall {
282
c.opt_["source"] = source
286
// UserId sets the optional parameter "userId": Indicates the user to
287
// return activity for. Use the special value me to indicate the
288
// currently authenticated user.
289
func (c *ActivitiesListCall) UserId(userId string) *ActivitiesListCall {
290
c.opt_["userId"] = userId
294
// Fields allows partial responses to be retrieved.
295
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
296
// for more information.
297
func (c *ActivitiesListCall) Fields(s ...googleapi.Field) *ActivitiesListCall {
298
c.opt_["fields"] = googleapi.CombineFields(s)
302
func (c *ActivitiesListCall) Do() (*ListActivitiesResponse, error) {
303
var body io.Reader = nil
304
params := make(url.Values)
305
params.Set("alt", "json")
306
if v, ok := c.opt_["drive.ancestorId"]; ok {
307
params.Set("drive.ancestorId", fmt.Sprintf("%v", v))
309
if v, ok := c.opt_["drive.fileId"]; ok {
310
params.Set("drive.fileId", fmt.Sprintf("%v", v))
312
if v, ok := c.opt_["groupingStrategy"]; ok {
313
params.Set("groupingStrategy", fmt.Sprintf("%v", v))
315
if v, ok := c.opt_["pageSize"]; ok {
316
params.Set("pageSize", fmt.Sprintf("%v", v))
318
if v, ok := c.opt_["pageToken"]; ok {
319
params.Set("pageToken", fmt.Sprintf("%v", v))
321
if v, ok := c.opt_["source"]; ok {
322
params.Set("source", fmt.Sprintf("%v", v))
324
if v, ok := c.opt_["userId"]; ok {
325
params.Set("userId", fmt.Sprintf("%v", v))
327
if v, ok := c.opt_["fields"]; ok {
328
params.Set("fields", fmt.Sprintf("%v", v))
330
urls := googleapi.ResolveRelative(c.s.BasePath, "activities")
331
urls += "?" + params.Encode()
332
req, _ := http.NewRequest("GET", urls, body)
333
googleapi.SetOpaque(req.URL)
334
req.Header.Set("User-Agent", "google-api-go-client/0.5")
335
res, err := c.s.client.Do(req)
339
defer googleapi.CloseBody(res)
340
if err := googleapi.CheckResponse(res); err != nil {
343
var ret *ListActivitiesResponse
344
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
349
// "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.",
350
// "httpMethod": "GET",
351
// "id": "appsactivity.activities.list",
353
// "drive.ancestorId": {
354
// "description": "Identifies the Drive folder containing the items for which to return activities.",
355
// "location": "query",
359
// "description": "Identifies the Drive item to return activities for.",
360
// "location": "query",
363
// "groupingStrategy": {
364
// "default": "driveUi",
365
// "description": "Indicates the strategy to use when grouping singleEvents items in the associated combinedEvent object.",
370
// "enumDescriptions": [
374
// "location": "query",
379
// "description": "The maximum number of events to return on a page. The response includes a continuation token if there are more events.",
380
// "format": "int32",
381
// "location": "query",
385
// "description": "A token to retrieve a specific page of results.",
386
// "location": "query",
390
// "description": "The Google service from which to return activities. Possible values of source are: \n- drive.google.com",
391
// "location": "query",
396
// "description": "Indicates the user to return activity for. Use the special value me to indicate the currently authenticated user.",
397
// "location": "query",
401
// "path": "activities",
403
// "$ref": "ListActivitiesResponse"
406
// "https://www.googleapis.com/auth/activity",
407
// "https://www.googleapis.com/auth/drive",
408
// "https://www.googleapis.com/auth/drive.metadata.readonly",
409
// "https://www.googleapis.com/auth/drive.readonly"