Update user pod message to use Smart Lock.
[chromium-blink-merge.git] / google_apis / drive / drive_api_url_generator.h
blobc17fd2186e8f4e88256d02bd92b0ee56b680e9ff
1 // Copyright (c) 2013 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_URL_GENERATOR_H_
6 #define GOOGLE_APIS_DRIVE_DRIVE_API_URL_GENERATOR_H_
8 #include <string>
10 #include "url/gurl.h"
12 namespace google_apis {
14 // This class is used to generate URLs for communicating with drive api
15 // servers for production, and a local server for testing.
16 class DriveApiUrlGenerator {
17 public:
18 // |base_url| is the path to the target drive api server.
19 // Note that this is an injecting point for a testing server.
20 DriveApiUrlGenerator(const GURL& base_url, const GURL& base_download_url);
21 ~DriveApiUrlGenerator();
23 // The base URL for communicating with the production drive api server.
24 static const char kBaseUrlForProduction[];
26 // The base URL for the file download server for production.
27 static const char kBaseDownloadUrlForProduction[];
29 // Returns a URL to invoke "About: get" method.
30 GURL GetAboutGetUrl() const;
32 // Returns a URL to invoke "Apps: list" method.
33 // Set |use_internal_endpoint| to true if official Chrome's API key is used
34 // and retrieving more information (related to App uninstall) is necessary.
35 GURL GetAppsListUrl(bool use_internal_endpoint) const;
37 // Returns a URL to uninstall an app with the give |app_id|.
38 GURL GetAppsDeleteUrl(const std::string& app_id) const;
40 // Returns a URL to fetch a file metadata.
41 GURL GetFilesGetUrl(const std::string& file_id) const;
43 // Returns a URL to authorize an app to access a file.
44 GURL GetFilesAuthorizeUrl(const std::string& file_id,
45 const std::string& app_id) const;
47 // Returns a URL to create a resource.
48 GURL GetFilesInsertUrl() const;
50 // Returns a URL to patch file metadata.
51 GURL GetFilesPatchUrl(const std::string& file_id,
52 bool set_modified_date,
53 bool update_viewed_date) const;
55 // Returns a URL to copy a resource specified by |file_id|.
56 GURL GetFilesCopyUrl(const std::string& file_id) const;
58 // Returns a URL to fetch file list.
59 GURL GetFilesListUrl(int max_results,
60 const std::string& page_token,
61 const std::string& q) const;
63 // Returns a URL to delete a resource with the given |file_id|.
64 GURL GetFilesDeleteUrl(const std::string& file_id) const;
66 // Returns a URL to trash a resource with the given |file_id|.
67 GURL GetFilesTrashUrl(const std::string& file_id) const;
69 // Returns a URL to fetch a list of changes.
70 GURL GetChangesListUrl(bool include_deleted,
71 int max_results,
72 const std::string& page_token,
73 int64 start_change_id) const;
75 // Returns a URL to add a resource to a directory with |folder_id|.
76 GURL GetChildrenInsertUrl(const std::string& folder_id) const;
78 // Returns a URL to remove a resource with |child_id| from a directory
79 // with |folder_id|.
80 GURL GetChildrenDeleteUrl(const std::string& child_id,
81 const std::string& folder_id) const;
83 // Returns a URL to initiate "resumable upload" of a new file that uploads
84 // chunked data by multiple HTTP posts.
85 GURL GetInitiateUploadNewFileUrl(bool set_modified_date) const;
87 // Returns a URL to initiate "resumable upload" of an existing file specified
88 // by |resource_id| that uploads chunked data by multiple HTTP posts.
89 GURL GetInitiateUploadExistingFileUrl(const std::string& resource_id,
90 bool set_modified_date) const;
92 // Returns a URL for "multipart upload" of a new file that sends both metadata
93 // and file content in a single HTTP post.
94 GURL GetMultipartUploadNewFileUrl(bool set_modified_date) const;
96 // Returns a URL for "multipart upload" of an existing file specified by
97 // |resource_id| that sends both metadata and file content in a single HTTP
98 // post.
99 GURL GetMultipartUploadExistingFileUrl(const std::string& resource_id,
100 bool set_modified_date) const;
102 // Generates a URL for downloading a file.
103 GURL GenerateDownloadFileUrl(const std::string& resource_id) const;
105 // Generates a URL for adding permissions.
106 GURL GetPermissionsInsertUrl(const std::string& resource_id) const;
108 private:
109 const GURL base_url_;
110 const GURL base_download_url_;
112 // This class is copyable hence no DISALLOW_COPY_AND_ASSIGN here.
115 } // namespace google_apis
117 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_URL_GENERATOR_H_