1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_
6 #define GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_
10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h"
14 #include "base/strings/string_piece.h"
15 #include "base/time/time.h"
20 template <class StructType
>
21 class JSONValueConverter
;
24 template <class NestedType
>
25 class RepeatedMessageConverter
;
26 } // namespace internal
29 namespace google_apis
{
31 // About resource represents the account information about the current user.
32 // https://developers.google.com/drive/v2/reference/about
38 // Registers the mapping between JSON field names and the members in this
40 static void RegisterJSONConverter(
41 base::JSONValueConverter
<AboutResource
>* converter
);
43 // Creates about resource from parsed JSON.
44 static scoped_ptr
<AboutResource
> CreateFrom(const base::Value
& value
);
46 // Returns the largest change ID number.
47 int64
largest_change_id() const { return largest_change_id_
; }
48 // Returns total number of quota bytes.
49 int64
quota_bytes_total() const { return quota_bytes_total_
; }
50 // Returns the number of quota bytes used.
51 int64
quota_bytes_used() const { return quota_bytes_used_
; }
52 // Returns root folder ID.
53 const std::string
& root_folder_id() const { return root_folder_id_
; }
55 void set_largest_change_id(int64 largest_change_id
) {
56 largest_change_id_
= largest_change_id
;
58 void set_quota_bytes_total(int64 quota_bytes_total
) {
59 quota_bytes_total_
= quota_bytes_total
;
61 void set_quota_bytes_used(int64 quota_bytes_used
) {
62 quota_bytes_used_
= quota_bytes_used
;
64 void set_root_folder_id(const std::string
& root_folder_id
) {
65 root_folder_id_
= root_folder_id
;
69 friend class DriveAPIParserTest
;
70 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest
, AboutResourceParser
);
72 // Parses and initializes data members from content of |value|.
73 // Return false if parsing fails.
74 bool Parse(const base::Value
& value
);
76 int64 largest_change_id_
;
77 int64 quota_bytes_total_
;
78 int64 quota_bytes_used_
;
79 std::string root_folder_id_
;
81 // This class is copyable on purpose.
84 // DriveAppIcon represents an icon for Drive Application.
85 // https://developers.google.com/drive/v2/reference/apps
89 UNKNOWN
, // Uninitialized state.
90 DOCUMENT
, // Icon for a file associated with the app.
91 APPLICATION
, // Icon for the application.
92 SHARED_DOCUMENT
, // Icon for a shared file associated with the app.
98 // Registers the mapping between JSON field names and the members in this
100 static void RegisterJSONConverter(
101 base::JSONValueConverter
<DriveAppIcon
>* converter
);
103 // Creates drive app icon instance from parsed JSON.
104 static scoped_ptr
<DriveAppIcon
> CreateFrom(const base::Value
& value
);
106 // Category of the icon.
107 IconCategory
category() const { return category_
; }
109 // Size in pixels of one side of the icon (icons are always square).
110 int icon_side_length() const { return icon_side_length_
; }
112 // Returns URL for this icon.
113 const GURL
& icon_url() const { return icon_url_
; }
115 void set_category(IconCategory category
) {
116 category_
= category
;
118 void set_icon_side_length(int icon_side_length
) {
119 icon_side_length_
= icon_side_length
;
121 void set_icon_url(const GURL
& icon_url
) {
122 icon_url_
= icon_url
;
126 // Parses and initializes data members from content of |value|.
127 // Return false if parsing fails.
128 bool Parse(const base::Value
& value
);
130 // Extracts the icon category from the given string. Returns false and does
131 // not change |result| when |scheme| has an unrecognizable value.
132 static bool GetIconCategory(const base::StringPiece
& category
,
133 IconCategory
* result
);
135 friend class base::internal::RepeatedMessageConverter
<DriveAppIcon
>;
136 friend class AppResource
;
138 IconCategory category_
;
139 int icon_side_length_
;
142 DISALLOW_COPY_AND_ASSIGN(DriveAppIcon
);
145 // AppResource represents a Drive Application.
146 // https://developers.google.com/drive/v2/reference/apps
152 // Registers the mapping between JSON field names and the members in this
154 static void RegisterJSONConverter(
155 base::JSONValueConverter
<AppResource
>* converter
);
157 // Creates app resource from parsed JSON.
158 static scoped_ptr
<AppResource
> CreateFrom(const base::Value
& value
);
160 // Returns application ID, which is 12-digit decimals (e.g. "123456780123").
161 const std::string
& application_id() const { return application_id_
; }
163 // Returns application name.
164 const std::string
& name() const { return name_
; }
166 // Returns the name of the type of object this application creates.
167 // This is used for displaying in "Create" menu item for this app.
168 // If empty, application name is used instead.
169 const std::string
& object_type() const { return object_type_
; }
171 // Returns whether this application supports creating new objects.
172 bool supports_create() const { return supports_create_
; }
174 // Returns whether this application supports importing Google Docs.
175 bool supports_import() const { return supports_import_
; }
177 // Returns whether this application is installed.
178 bool is_installed() const { return installed_
; }
180 // Returns whether this application is authorized to access data on the
182 bool is_authorized() const { return authorized_
; }
184 // Returns the product URL, e.g. at Chrome Web Store.
185 const GURL
& product_url() const { return product_url_
; }
187 // Returns the create URL, i.e., the URL for opening a new file by the app.
188 const GURL
& create_url() const { return create_url_
; }
190 // List of primary mime types supported by this WebApp. Primary status should
191 // trigger this WebApp becoming the default handler of file instances that
192 // have these mime types.
193 const ScopedVector
<std::string
>& primary_mimetypes() const {
194 return primary_mimetypes_
;
197 // List of secondary mime types supported by this WebApp. Secondary status
198 // should make this WebApp show up in "Open with..." pop-up menu of the
199 // default action menu for file with matching mime types.
200 const ScopedVector
<std::string
>& secondary_mimetypes() const {
201 return secondary_mimetypes_
;
204 // List of primary file extensions supported by this WebApp. Primary status
205 // should trigger this WebApp becoming the default handler of file instances
206 // that match these extensions.
207 const ScopedVector
<std::string
>& primary_file_extensions() const {
208 return primary_file_extensions_
;
211 // List of secondary file extensions supported by this WebApp. Secondary
212 // status should make this WebApp show up in "Open with..." pop-up menu of the
213 // default action menu for file with matching extensions.
214 const ScopedVector
<std::string
>& secondary_file_extensions() const {
215 return secondary_file_extensions_
;
218 // Returns Icons for this application. An application can have multiple
219 // icons for different purpose (application, document, shared document)
221 const ScopedVector
<DriveAppIcon
>& icons() const {
225 void set_application_id(const std::string
& application_id
) {
226 application_id_
= application_id
;
228 void set_name(const std::string
& name
) { name_
= name
; }
229 void set_object_type(const std::string
& object_type
) {
230 object_type_
= object_type
;
232 void set_supports_create(bool supports_create
) {
233 supports_create_
= supports_create
;
235 void set_supports_import(bool supports_import
) {
236 supports_import_
= supports_import
;
238 void set_installed(bool installed
) { installed_
= installed
; }
239 void set_authorized(bool authorized
) { authorized_
= authorized
; }
240 void set_product_url(const GURL
& product_url
) {
241 product_url_
= product_url
;
243 void set_primary_mimetypes(
244 ScopedVector
<std::string
> primary_mimetypes
) {
245 primary_mimetypes_
= primary_mimetypes
.Pass();
247 void set_secondary_mimetypes(
248 ScopedVector
<std::string
> secondary_mimetypes
) {
249 secondary_mimetypes_
= secondary_mimetypes
.Pass();
251 void set_primary_file_extensions(
252 ScopedVector
<std::string
> primary_file_extensions
) {
253 primary_file_extensions_
= primary_file_extensions
.Pass();
255 void set_secondary_file_extensions(
256 ScopedVector
<std::string
> secondary_file_extensions
) {
257 secondary_file_extensions_
= secondary_file_extensions
.Pass();
259 void set_icons(ScopedVector
<DriveAppIcon
> icons
) {
260 icons_
= icons
.Pass();
262 void set_create_url(const GURL
& url
) {
267 friend class base::internal::RepeatedMessageConverter
<AppResource
>;
268 friend class AppList
;
270 // Parses and initializes data members from content of |value|.
271 // Return false if parsing fails.
272 bool Parse(const base::Value
& value
);
274 std::string application_id_
;
276 std::string object_type_
;
277 bool supports_create_
;
278 bool supports_import_
;
283 ScopedVector
<std::string
> primary_mimetypes_
;
284 ScopedVector
<std::string
> secondary_mimetypes_
;
285 ScopedVector
<std::string
> primary_file_extensions_
;
286 ScopedVector
<std::string
> secondary_file_extensions_
;
287 ScopedVector
<DriveAppIcon
> icons_
;
289 DISALLOW_COPY_AND_ASSIGN(AppResource
);
292 // AppList represents a list of Drive Applications.
293 // https://developers.google.com/drive/v2/reference/apps/list
299 // Registers the mapping between JSON field names and the members in this
301 static void RegisterJSONConverter(
302 base::JSONValueConverter
<AppList
>* converter
);
304 // Creates app list from parsed JSON.
305 static scoped_ptr
<AppList
> CreateFrom(const base::Value
& value
);
307 // ETag for this resource.
308 const std::string
& etag() const { return etag_
; }
310 // Returns a vector of applications.
311 const ScopedVector
<AppResource
>& items() const { return items_
; }
313 void set_etag(const std::string
& etag
) {
316 void set_items(ScopedVector
<AppResource
> items
) {
317 items_
= items
.Pass();
321 friend class DriveAPIParserTest
;
322 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest
, AppListParser
);
324 // Parses and initializes data members from content of |value|.
325 // Return false if parsing fails.
326 bool Parse(const base::Value
& value
);
329 ScopedVector
<AppResource
> items_
;
331 DISALLOW_COPY_AND_ASSIGN(AppList
);
334 // ParentReference represents a directory.
335 // https://developers.google.com/drive/v2/reference/parents
336 class ParentReference
{
341 // Registers the mapping between JSON field names and the members in this
343 static void RegisterJSONConverter(
344 base::JSONValueConverter
<ParentReference
>* converter
);
346 // Creates parent reference from parsed JSON.
347 static scoped_ptr
<ParentReference
> CreateFrom(const base::Value
& value
);
349 // Returns the file id of the reference.
350 const std::string
& file_id() const { return file_id_
; }
352 // Returns the URL for the parent in Drive.
353 const GURL
& parent_link() const { return parent_link_
; }
355 // Returns true if the reference is root directory.
356 bool is_root() const { return is_root_
; }
358 void set_file_id(const std::string
& file_id
) { file_id_
= file_id
; }
359 void set_parent_link(const GURL
& parent_link
) {
360 parent_link_
= parent_link
;
362 void set_is_root(bool is_root
) { is_root_
= is_root
; }
365 friend class base::internal::RepeatedMessageConverter
<ParentReference
>;
367 // Parses and initializes data members from content of |value|.
368 // Return false if parsing fails.
369 bool Parse(const base::Value
& value
);
371 std::string file_id_
;
375 DISALLOW_COPY_AND_ASSIGN(ParentReference
);
378 // FileLabels represents labels for file or folder.
379 // https://developers.google.com/drive/v2/reference/files
385 // Registers the mapping between JSON field names and the members in this
387 static void RegisterJSONConverter(
388 base::JSONValueConverter
<FileLabels
>* converter
);
390 // Creates about resource from parsed JSON.
391 static scoped_ptr
<FileLabels
> CreateFrom(const base::Value
& value
);
393 // Whether this file is starred by the user.
394 bool is_starred() const { return starred_
; }
395 // Whether this file is hidden from the user.
396 bool is_hidden() const { return hidden_
; }
397 // Whether this file has been trashed.
398 bool is_trashed() const { return trashed_
; }
399 // Whether viewers are prevented from downloading this file.
400 bool is_restricted() const { return restricted_
; }
401 // Whether this file has been viewed by this user.
402 bool is_viewed() const { return viewed_
; }
404 void set_starred(bool starred
) { starred_
= starred
; }
405 void set_hidden(bool hidden
) { hidden_
= hidden
; }
406 void set_trashed(bool trashed
) { trashed_
= trashed
; }
407 void set_restricted(bool restricted
) { restricted_
= restricted
; }
408 void set_viewed(bool viewed
) { viewed_
= viewed
; }
411 friend class FileResource
;
413 // Parses and initializes data members from content of |value|.
414 // Return false if parsing fails.
415 bool Parse(const base::Value
& value
);
423 DISALLOW_COPY_AND_ASSIGN(FileLabels
);
426 // ImageMediaMetadata represents image metadata for a file.
427 // https://developers.google.com/drive/v2/reference/files
428 class ImageMediaMetadata
{
430 ImageMediaMetadata();
431 ~ImageMediaMetadata();
433 // Registers the mapping between JSON field names and the members in this
435 static void RegisterJSONConverter(
436 base::JSONValueConverter
<ImageMediaMetadata
>* converter
);
438 // Creates about resource from parsed JSON.
439 static scoped_ptr
<ImageMediaMetadata
> CreateFrom(const base::Value
& value
);
441 // Width of the image in pixels.
442 int width() const { return width_
; }
443 // Height of the image in pixels.
444 int height() const { return height_
; }
445 // Rotation of the image in clockwise degrees.
446 int rotation() const { return rotation_
; }
448 void set_width(int width
) { width_
= width
; }
449 void set_height(int height
) { height_
= height
; }
450 void set_rotation(int rotation
) { rotation_
= rotation
; }
453 friend class FileResource
;
455 // Parses and initializes data members from content of |value|.
456 // Return false if parsing fails.
457 bool Parse(const base::Value
& value
);
463 DISALLOW_COPY_AND_ASSIGN(ImageMediaMetadata
);
467 // FileResource represents a file or folder metadata in Drive.
468 // https://developers.google.com/drive/v2/reference/files
471 // Link to open a file resource on a web app with |app_id|.
472 struct OpenWithLink
{
480 // Registers the mapping between JSON field names and the members in this
482 static void RegisterJSONConverter(
483 base::JSONValueConverter
<FileResource
>* converter
);
485 // Creates file resource from parsed JSON.
486 static scoped_ptr
<FileResource
> CreateFrom(const base::Value
& value
);
488 // Returns true if this is a directory.
489 // Note: "folder" is used elsewhere in this file to match Drive API reference,
490 // but outside this file we use "directory" to match HTML5 filesystem API.
491 bool IsDirectory() const;
493 // Returns file ID. This is unique in all files in Google Drive.
494 const std::string
& file_id() const { return file_id_
; }
496 // Returns ETag for this file.
497 const std::string
& etag() const { return etag_
; }
499 // Returns the link to JSON of this file itself.
500 const GURL
& self_link() const { return self_link_
; }
502 // Returns the title of this file.
503 const std::string
& title() const { return title_
; }
505 // Returns MIME type of this file.
506 const std::string
& mime_type() const { return mime_type_
; }
508 // Returns labels for this file.
509 const FileLabels
& labels() const { return labels_
; }
511 // Returns image media metadata for this file.
512 const ImageMediaMetadata
& image_media_metadata() const {
513 return image_media_metadata_
;
516 // Returns created time of this file.
517 const base::Time
& created_date() const { return created_date_
; }
519 // Returns modified time of this file.
520 const base::Time
& modified_date() const { return modified_date_
; }
522 // Returns modification time by the user.
523 const base::Time
& modified_by_me_date() const { return modified_by_me_date_
; }
525 // Returns last access time by the user.
526 const base::Time
& last_viewed_by_me_date() const {
527 return last_viewed_by_me_date_
;
530 // Returns time when the file was shared with the user.
531 const base::Time
& shared_with_me_date() const {
532 return shared_with_me_date_
;
535 // Returns the 'shared' attribute of the file.
536 bool shared() const { return shared_
; }
538 // Returns the short-lived download URL for the file. This field exists
539 // only when the file content is stored in Drive.
540 const GURL
& download_url() const { return download_url_
; }
542 // Returns the extension part of the filename.
543 const std::string
& file_extension() const { return file_extension_
; }
545 // Returns MD5 checksum of this file.
546 const std::string
& md5_checksum() const { return md5_checksum_
; }
548 // Returns the size of this file in bytes.
549 int64
file_size() const { return file_size_
; }
551 // Return the link to open the file in Google editor or viewer.
552 // E.g. Google Document, Google Spreadsheet.
553 const GURL
& alternate_link() const { return alternate_link_
; }
555 // Returns the link for embedding the file.
556 const GURL
& embed_link() const { return embed_link_
; }
558 // Returns parent references (directories) of this file.
559 const ScopedVector
<ParentReference
>& parents() const { return parents_
; }
560 ScopedVector
<ParentReference
>* mutable_parents() { return &parents_
; }
562 // Returns the link to the file's thumbnail.
563 const GURL
& thumbnail_link() const { return thumbnail_link_
; }
565 // Returns the link to open its downloadable content, using cookie based
567 const GURL
& web_content_link() const { return web_content_link_
; }
569 // Returns the list of links to open the resource with a web app.
570 const std::vector
<OpenWithLink
>& open_with_links() const {
571 return open_with_links_
;
574 void set_file_id(const std::string
& file_id
) {
577 void set_etag(const std::string
& etag
) {
580 void set_self_link(const GURL
& self_link
) {
581 self_link_
= self_link
;
583 void set_title(const std::string
& title
) {
586 void set_mime_type(const std::string
& mime_type
) {
587 mime_type_
= mime_type
;
589 FileLabels
* mutable_labels() {
592 ImageMediaMetadata
* mutable_image_media_metadata() {
593 return &image_media_metadata_
;
595 void set_created_date(const base::Time
& created_date
) {
596 created_date_
= created_date
;
598 void set_modified_date(const base::Time
& modified_date
) {
599 modified_date_
= modified_date
;
601 void set_modified_by_me_date(const base::Time
& modified_by_me_date
) {
602 modified_by_me_date_
= modified_by_me_date
;
604 void set_last_viewed_by_me_date(const base::Time
& last_viewed_by_me_date
) {
605 last_viewed_by_me_date_
= last_viewed_by_me_date
;
607 void set_shared_with_me_date(const base::Time
& shared_with_me_date
) {
608 shared_with_me_date_
= shared_with_me_date
;
610 void set_shared(bool shared
) {
613 void set_download_url(const GURL
& download_url
) {
614 download_url_
= download_url
;
616 void set_file_extension(const std::string
& file_extension
) {
617 file_extension_
= file_extension
;
619 void set_md5_checksum(const std::string
& md5_checksum
) {
620 md5_checksum_
= md5_checksum
;
622 void set_file_size(int64 file_size
) {
623 file_size_
= file_size
;
625 void set_alternate_link(const GURL
& alternate_link
) {
626 alternate_link_
= alternate_link
;
628 void set_embed_link(const GURL
& embed_link
) {
629 embed_link_
= embed_link
;
631 void set_parents(ScopedVector
<ParentReference
> parents
) {
632 parents_
= parents
.Pass();
634 void set_thumbnail_link(const GURL
& thumbnail_link
) {
635 thumbnail_link_
= thumbnail_link
;
637 void set_web_content_link(const GURL
& web_content_link
) {
638 web_content_link_
= web_content_link
;
642 friend class base::internal::RepeatedMessageConverter
<FileResource
>;
643 friend class ChangeResource
;
644 friend class FileList
;
646 // Parses and initializes data members from content of |value|.
647 // Return false if parsing fails.
648 bool Parse(const base::Value
& value
);
650 std::string file_id_
;
654 std::string mime_type_
;
656 ImageMediaMetadata image_media_metadata_
;
657 base::Time created_date_
;
658 base::Time modified_date_
;
659 base::Time modified_by_me_date_
;
660 base::Time last_viewed_by_me_date_
;
661 base::Time shared_with_me_date_
;
664 std::string file_extension_
;
665 std::string md5_checksum_
;
667 GURL alternate_link_
;
669 ScopedVector
<ParentReference
> parents_
;
670 GURL thumbnail_link_
;
671 GURL web_content_link_
;
672 std::vector
<OpenWithLink
> open_with_links_
;
674 DISALLOW_COPY_AND_ASSIGN(FileResource
);
677 // FileList represents a collection of files and folders.
678 // https://developers.google.com/drive/v2/reference/files/list
684 // Registers the mapping between JSON field names and the members in this
686 static void RegisterJSONConverter(
687 base::JSONValueConverter
<FileList
>* converter
);
689 // Returns true if the |value| has kind field for FileList.
690 static bool HasFileListKind(const base::Value
& value
);
692 // Creates file list from parsed JSON.
693 static scoped_ptr
<FileList
> CreateFrom(const base::Value
& value
);
695 // Returns the ETag of the list.
696 const std::string
& etag() const { return etag_
; }
698 // Returns the page token for the next page of files, if the list is large
699 // to fit in one response. If this is empty, there is no more file lists.
700 const std::string
& next_page_token() const { return next_page_token_
; }
702 // Returns a link to the next page of files. The URL includes the next page
704 const GURL
& next_link() const { return next_link_
; }
706 // Returns a set of files in this list.
707 const ScopedVector
<FileResource
>& items() const { return items_
; }
709 void set_etag(const std::string
& etag
) {
712 void set_next_page_token(const std::string
& next_page_token
) {
713 next_page_token_
= next_page_token
;
715 void set_next_link(const GURL
& next_link
) {
716 next_link_
= next_link
;
718 void set_items(ScopedVector
<FileResource
> items
) {
719 items_
= items
.Pass();
723 friend class DriveAPIParserTest
;
724 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest
, FileListParser
);
726 // Parses and initializes data members from content of |value|.
727 // Return false if parsing fails.
728 bool Parse(const base::Value
& value
);
731 std::string next_page_token_
;
733 ScopedVector
<FileResource
> items_
;
735 DISALLOW_COPY_AND_ASSIGN(FileList
);
738 // ChangeResource represents a change in a file.
739 // https://developers.google.com/drive/v2/reference/changes
740 class ChangeResource
{
745 // Registers the mapping between JSON field names and the members in this
747 static void RegisterJSONConverter(
748 base::JSONValueConverter
<ChangeResource
>* converter
);
750 // Creates change resource from parsed JSON.
751 static scoped_ptr
<ChangeResource
> CreateFrom(const base::Value
& value
);
753 // Returns change ID for this change. This is a monotonically increasing
755 int64
change_id() const { return change_id_
; }
757 // Returns a string file ID for corresponding file of the change.
758 const std::string
& file_id() const { return file_id_
; }
760 // Returns true if this file is deleted in the change.
761 bool is_deleted() const { return deleted_
; }
763 // Returns FileResource of the file which the change refers to.
764 const FileResource
* file() const { return file_
.get(); }
765 FileResource
* mutable_file() { return file_
.get(); }
767 void set_change_id(int64 change_id
) {
768 change_id_
= change_id
;
770 void set_file_id(const std::string
& file_id
) {
773 void set_deleted(bool deleted
) {
776 void set_file(scoped_ptr
<FileResource
> file
) {
781 friend class base::internal::RepeatedMessageConverter
<ChangeResource
>;
782 friend class ChangeList
;
784 // Parses and initializes data members from content of |value|.
785 // Return false if parsing fails.
786 bool Parse(const base::Value
& value
);
789 std::string file_id_
;
791 scoped_ptr
<FileResource
> file_
;
793 DISALLOW_COPY_AND_ASSIGN(ChangeResource
);
796 // ChangeList represents a set of changes in the drive.
797 // https://developers.google.com/drive/v2/reference/changes/list
803 // Registers the mapping between JSON field names and the members in this
805 static void RegisterJSONConverter(
806 base::JSONValueConverter
<ChangeList
>* converter
);
808 // Returns true if the |value| has kind field for ChangeList.
809 static bool HasChangeListKind(const base::Value
& value
);
811 // Creates change list from parsed JSON.
812 static scoped_ptr
<ChangeList
> CreateFrom(const base::Value
& value
);
814 // Returns the ETag of the list.
815 const std::string
& etag() const { return etag_
; }
817 // Returns the page token for the next page of files, if the list is large
818 // to fit in one response. If this is empty, there is no more file lists.
819 const std::string
& next_page_token() const { return next_page_token_
; }
821 // Returns a link to the next page of files. The URL includes the next page
823 const GURL
& next_link() const { return next_link_
; }
825 // Returns the largest change ID number.
826 int64
largest_change_id() const { return largest_change_id_
; }
828 // Returns a set of changes in this list.
829 const ScopedVector
<ChangeResource
>& items() const { return items_
; }
831 void set_etag(const std::string
& etag
) {
834 void set_next_page_token(const std::string
& next_page_token
) {
835 next_page_token_
= next_page_token
;
837 void set_next_link(const GURL
& next_link
) {
838 next_link_
= next_link
;
840 void set_largest_change_id(int64 largest_change_id
) {
841 largest_change_id_
= largest_change_id
;
843 void set_items(ScopedVector
<ChangeResource
> items
) {
844 items_
= items
.Pass();
848 friend class DriveAPIParserTest
;
849 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest
, ChangeListParser
);
851 // Parses and initializes data members from content of |value|.
852 // Return false if parsing fails.
853 bool Parse(const base::Value
& value
);
856 std::string next_page_token_
;
858 int64 largest_change_id_
;
859 ScopedVector
<ChangeResource
> items_
;
861 DISALLOW_COPY_AND_ASSIGN(ChangeList
);
864 } // namespace google_apis
866 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_