~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/google.golang.org/api/appsactivity/v1/appsactivity-gen.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Package appsactivity provides access to the Google Apps 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
 
11
 
 
12
import (
 
13
        "bytes"
 
14
        "encoding/json"
 
15
        "errors"
 
16
        "fmt"
 
17
        "google.golang.org/api/googleapi"
 
18
        "io"
 
19
        "net/http"
 
20
        "net/url"
 
21
        "strconv"
 
22
        "strings"
 
23
)
 
24
 
 
25
// Always reference these packages, just in case the auto-generated code
 
26
// below doesn't.
 
27
var _ = bytes.NewBuffer
 
28
var _ = strconv.Itoa
 
29
var _ = fmt.Sprintf
 
30
var _ = json.NewDecoder
 
31
var _ = io.Copy
 
32
var _ = url.Parse
 
33
var _ = googleapi.Version
 
34
var _ = errors.New
 
35
var _ = strings.Replace
 
36
 
 
37
const apiId = "appsactivity:v1"
 
38
const apiName = "appsactivity"
 
39
const apiVersion = "v1"
 
40
const basePath = "https://www.googleapis.com/appsactivity/v1/"
 
41
 
 
42
// OAuth2 scopes used by this API.
 
43
const (
 
44
        // View the activity history of your Google Apps
 
45
        ActivityScope = "https://www.googleapis.com/auth/activity"
 
46
 
 
47
        // View and manage the files and documents in your Google Drive
 
48
        DriveScope = "https://www.googleapis.com/auth/drive"
 
49
 
 
50
        // View metadata for files and documents in your Google Drive
 
51
        DriveMetadataReadonlyScope = "https://www.googleapis.com/auth/drive.metadata.readonly"
 
52
 
 
53
        // View the files and documents in your Google Drive
 
54
        DriveReadonlyScope = "https://www.googleapis.com/auth/drive.readonly"
 
55
)
 
56
 
 
57
func New(client *http.Client) (*Service, error) {
 
58
        if client == nil {
 
59
                return nil, errors.New("client is nil")
 
60
        }
 
61
        s := &Service{client: client, BasePath: basePath}
 
62
        s.Activities = NewActivitiesService(s)
 
63
        return s, nil
 
64
}
 
65
 
 
66
type Service struct {
 
67
        client   *http.Client
 
68
        BasePath string // API endpoint base URL
 
69
 
 
70
        Activities *ActivitiesService
 
71
}
 
72
 
 
73
func NewActivitiesService(s *Service) *ActivitiesService {
 
74
        rs := &ActivitiesService{s: s}
 
75
        return rs
 
76
}
 
77
 
 
78
type ActivitiesService struct {
 
79
        s *Service
 
80
}
 
81
 
 
82
type Activity struct {
 
83
        // CombinedEvent: The fields common to all of the singleEvents that make
 
84
        // up the Activity.
 
85
        CombinedEvent *Event `json:"combinedEvent,omitempty"`
 
86
 
 
87
        // SingleEvents: A list of all the Events that make up the Activity.
 
88
        SingleEvents []*Event `json:"singleEvents,omitempty"`
 
89
}
 
90
 
 
91
type Event struct {
 
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"`
 
97
 
 
98
        // EventTimeMillis: The time at which the event occurred formatted as
 
99
        // Unix time in milliseconds.
 
100
        EventTimeMillis uint64 `json:"eventTimeMillis,omitempty,string"`
 
101
 
 
102
        // FromUserDeletion: Whether this event is caused by a user being
 
103
        // deleted.
 
104
        FromUserDeletion bool `json:"fromUserDeletion,omitempty"`
 
105
 
 
106
        // Move: Extra information for move type events, such as changes in an
 
107
        // object's parents.
 
108
        Move *Move `json:"move,omitempty"`
 
109
 
 
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"`
 
113
 
 
114
        // PrimaryEventType: The main type of event that occurred.
 
115
        PrimaryEventType string `json:"primaryEventType,omitempty"`
 
116
 
 
117
        // Rename: Extra information for rename type events, such as the old and
 
118
        // new names.
 
119
        Rename *Rename `json:"rename,omitempty"`
 
120
 
 
121
        // Target: Information specific to the Target object modified by the
 
122
        // event.
 
123
        Target *Target `json:"target,omitempty"`
 
124
 
 
125
        // User: Represents the user responsible for the event.
 
126
        User *User `json:"user,omitempty"`
 
127
}
 
128
 
 
129
type ListActivitiesResponse struct {
 
130
        // Activities: List of activities.
 
131
        Activities []*Activity `json:"activities,omitempty"`
 
132
 
 
133
        // NextPageToken: Token for the next page of results.
 
134
        NextPageToken string `json:"nextPageToken,omitempty"`
 
135
}
 
136
 
 
137
type Move struct {
 
138
        // AddedParents: The added parent(s).
 
139
        AddedParents []*Parent `json:"addedParents,omitempty"`
 
140
 
 
141
        // RemovedParents: The removed parent(s).
 
142
        RemovedParents []*Parent `json:"removedParents,omitempty"`
 
143
}
 
144
 
 
145
type Parent struct {
 
146
        // Id: The parent's ID.
 
147
        Id string `json:"id,omitempty"`
 
148
 
 
149
        // IsRoot: Whether this is the root folder.
 
150
        IsRoot bool `json:"isRoot,omitempty"`
 
151
 
 
152
        // Title: The parent's title.
 
153
        Title string `json:"title,omitempty"`
 
154
}
 
155
 
 
156
type Permission struct {
 
157
        // Name: The name of the user or group the permission applies to.
 
158
        Name string `json:"name,omitempty"`
 
159
 
 
160
        // PermissionId: The ID for this permission. Corresponds to the Drive
 
161
        // API's permission ID returned as part of the Drive Permissions
 
162
        // resource.
 
163
        PermissionId string `json:"permissionId,omitempty"`
 
164
 
 
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"`
 
168
 
 
169
        // Type: Indicates how widely permissions are granted.
 
170
        Type string `json:"type,omitempty"`
 
171
 
 
172
        // User: The user's information if the type is USER.
 
173
        User *User `json:"user,omitempty"`
 
174
 
 
175
        // WithLink: Whether the permission requires a link to the file.
 
176
        WithLink bool `json:"withLink,omitempty"`
 
177
}
 
178
 
 
179
type PermissionChange struct {
 
180
        // AddedPermissions: Lists all Permission objects added.
 
181
        AddedPermissions []*Permission `json:"addedPermissions,omitempty"`
 
182
 
 
183
        // RemovedPermissions: Lists all Permission objects removed.
 
184
        RemovedPermissions []*Permission `json:"removedPermissions,omitempty"`
 
185
}
 
186
 
 
187
type Photo struct {
 
188
        // Url: The URL of the photo.
 
189
        Url string `json:"url,omitempty"`
 
190
}
 
191
 
 
192
type Rename struct {
 
193
        // NewTitle: The new title.
 
194
        NewTitle string `json:"newTitle,omitempty"`
 
195
 
 
196
        // OldTitle: The old title.
 
197
        OldTitle string `json:"oldTitle,omitempty"`
 
198
}
 
199
 
 
200
type Target struct {
 
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"`
 
204
 
 
205
        // MimeType: The MIME type of the target.
 
206
        MimeType string `json:"mimeType,omitempty"`
 
207
 
 
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"`
 
211
}
 
212
 
 
213
type User struct {
 
214
        // Name: The displayable name of the user.
 
215
        Name string `json:"name,omitempty"`
 
216
 
 
217
        // Photo: The profile photo of the user.
 
218
        Photo *Photo `json:"photo,omitempty"`
 
219
}
 
220
 
 
221
// method id "appsactivity.activities.list":
 
222
 
 
223
type ActivitiesListCall struct {
 
224
        s    *Service
 
225
        opt_ map[string]interface{}
 
226
}
 
227
 
 
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{})}
 
236
        return c
 
237
}
 
238
 
 
239
// DriveAncestorId sets the optional parameter "drive.ancestorId":
 
240
// Identifies the Drive folder containing the items for which to return
 
241
// activities.
 
242
func (c *ActivitiesListCall) DriveAncestorId(driveAncestorId string) *ActivitiesListCall {
 
243
        c.opt_["drive.ancestorId"] = driveAncestorId
 
244
        return c
 
245
}
 
246
 
 
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
 
251
        return c
 
252
}
 
253
 
 
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
 
259
        return c
 
260
}
 
261
 
 
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
 
267
        return c
 
268
}
 
269
 
 
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
 
274
        return c
 
275
}
 
276
 
 
277
// Source sets the optional parameter "source": The Google service from
 
278
// which to return activities. Possible values of source are:
 
279
// -
 
280
// drive.google.com
 
281
func (c *ActivitiesListCall) Source(source string) *ActivitiesListCall {
 
282
        c.opt_["source"] = source
 
283
        return c
 
284
}
 
285
 
 
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
 
291
        return c
 
292
}
 
293
 
 
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)
 
299
        return c
 
300
}
 
301
 
 
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))
 
308
        }
 
309
        if v, ok := c.opt_["drive.fileId"]; ok {
 
310
                params.Set("drive.fileId", fmt.Sprintf("%v", v))
 
311
        }
 
312
        if v, ok := c.opt_["groupingStrategy"]; ok {
 
313
                params.Set("groupingStrategy", fmt.Sprintf("%v", v))
 
314
        }
 
315
        if v, ok := c.opt_["pageSize"]; ok {
 
316
                params.Set("pageSize", fmt.Sprintf("%v", v))
 
317
        }
 
318
        if v, ok := c.opt_["pageToken"]; ok {
 
319
                params.Set("pageToken", fmt.Sprintf("%v", v))
 
320
        }
 
321
        if v, ok := c.opt_["source"]; ok {
 
322
                params.Set("source", fmt.Sprintf("%v", v))
 
323
        }
 
324
        if v, ok := c.opt_["userId"]; ok {
 
325
                params.Set("userId", fmt.Sprintf("%v", v))
 
326
        }
 
327
        if v, ok := c.opt_["fields"]; ok {
 
328
                params.Set("fields", fmt.Sprintf("%v", v))
 
329
        }
 
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)
 
336
        if err != nil {
 
337
                return nil, err
 
338
        }
 
339
        defer googleapi.CloseBody(res)
 
340
        if err := googleapi.CheckResponse(res); err != nil {
 
341
                return nil, err
 
342
        }
 
343
        var ret *ListActivitiesResponse
 
344
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
345
                return nil, err
 
346
        }
 
347
        return ret, nil
 
348
        // {
 
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",
 
352
        //   "parameters": {
 
353
        //     "drive.ancestorId": {
 
354
        //       "description": "Identifies the Drive folder containing the items for which to return activities.",
 
355
        //       "location": "query",
 
356
        //       "type": "string"
 
357
        //     },
 
358
        //     "drive.fileId": {
 
359
        //       "description": "Identifies the Drive item to return activities for.",
 
360
        //       "location": "query",
 
361
        //       "type": "string"
 
362
        //     },
 
363
        //     "groupingStrategy": {
 
364
        //       "default": "driveUi",
 
365
        //       "description": "Indicates the strategy to use when grouping singleEvents items in the associated combinedEvent object.",
 
366
        //       "enum": [
 
367
        //         "driveUi",
 
368
        //         "none"
 
369
        //       ],
 
370
        //       "enumDescriptions": [
 
371
        //         "",
 
372
        //         ""
 
373
        //       ],
 
374
        //       "location": "query",
 
375
        //       "type": "string"
 
376
        //     },
 
377
        //     "pageSize": {
 
378
        //       "default": "50",
 
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",
 
382
        //       "type": "integer"
 
383
        //     },
 
384
        //     "pageToken": {
 
385
        //       "description": "A token to retrieve a specific page of results.",
 
386
        //       "location": "query",
 
387
        //       "type": "string"
 
388
        //     },
 
389
        //     "source": {
 
390
        //       "description": "The Google service from which to return activities. Possible values of source are: \n- drive.google.com",
 
391
        //       "location": "query",
 
392
        //       "type": "string"
 
393
        //     },
 
394
        //     "userId": {
 
395
        //       "default": "me",
 
396
        //       "description": "Indicates the user to return activity for. Use the special value me to indicate the currently authenticated user.",
 
397
        //       "location": "query",
 
398
        //       "type": "string"
 
399
        //     }
 
400
        //   },
 
401
        //   "path": "activities",
 
402
        //   "response": {
 
403
        //     "$ref": "ListActivitiesResponse"
 
404
        //   },
 
405
        //   "scopes": [
 
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"
 
410
        //   ]
 
411
        // }
 
412
 
 
413
}