This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new e8d100f28 docs(services/gdrive): update service doc (#2973)
e8d100f28 is described below

commit e8d100f28a2a92f6ed92fe0909a02589e620a0e8
Author: Suyan <[email protected]>
AuthorDate: Tue Aug 29 21:35:57 2023 +0800

    docs(services/gdrive): update service doc (#2973)
---
 core/src/services/dropbox/builder.rs |  5 ++--
 core/src/services/gdrive/builder.rs  | 47 +++++++++++++++++++++++++-----------
 2 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/core/src/services/dropbox/builder.rs 
b/core/src/services/dropbox/builder.rs
index 0d4ecd1a8..42711b210 100644
--- a/core/src/services/dropbox/builder.rs
+++ b/core/src/services/dropbox/builder.rs
@@ -39,10 +39,11 @@ use crate::*;
 /// - [x] read
 /// - [x] write
 /// - [x] delete
-/// - [ ] copy
-/// - [ ] create
+/// - [x] create_dir
 /// - [ ] list
+/// - [ ] copy
 /// - [ ] rename
+/// - [x] batch
 ///
 /// # Notes
 ///
diff --git a/core/src/services/gdrive/builder.rs 
b/core/src/services/gdrive/builder.rs
index 41cc90cee..9c5aefd7d 100644
--- a/core/src/services/gdrive/builder.rs
+++ b/core/src/services/gdrive/builder.rs
@@ -39,47 +39,66 @@ use crate::*;
 ///
 /// This service can be used to:
 ///
+/// - [x] stat
 /// - [x] read
 /// - [x] write
 /// - [x] delete
-/// - [ ] copy
-/// - [ ] create
+/// - [x] create_dir
 /// - [ ] list
+/// - [ ] copy
 /// - [ ] rename
+/// - [ ] batch
 ///
 /// # Notes
 ///
 ///
 /// # Configuration
 ///
-/// - `access_token`: set the access_token for google drive api
 /// - `root`: Set the work directory for backend
 ///
+/// ## Credentials related
+///
+/// ### Just provide Access Token (Temporary)
+///
+/// - `access_token`: set the access_token for google drive api
+/// Please notice its expiration.
+///
+/// ### Or provide Client ID and Client Secret and refresh token (Long Term)
+///
+/// If you want to let OpenDAL to refresh the access token automatically,
+/// please provide the following fields:
+///
+/// - `refresh_token`: set the refresh_token for google drive api
+/// - `client_id`: set the client_id for google drive api
+/// - `client_secret`: set the client_secret for google drive api
+///
+/// OpenDAL is a library, it cannot do the first step of OAuth2 for you.
+/// You need to get authorization code from user by calling GoogleDrive's 
authorize url
+/// and exchange it for refresh token.
+///
+/// Make sure you have enabled Google Drive API in your Google Cloud Console.
+/// And your OAuth scope contains `https://www.googleapis.com/auth/drive`.
+///
+/// Please refer to [GoogleDrive OAuth2 
Flow](https://developers.google.com/identity/protocols/oauth2/)
+/// for more information.
+///
 /// You can refer to [`GdriveBuilder`]'s docs for more information
 ///
 /// # Example
 ///
 /// ## Via Builder
 ///
-/// ```no_run
+/// ```rust
 /// use anyhow::Result;
 /// use opendal::services::Gdrive;
 /// use opendal::Operator;
 ///
 /// #[tokio::main]
 /// async fn main() -> Result<()> {
-///     // create backend builder
 ///     let mut builder = Gdrive::default();
+///     builder.root("/test");
+///     builder.access_token("<token>");
 ///
-///     builder.access_token("xxx").root("/path/to/root");
-///
-///     let op: Operator = Operator::new(builder)?.finish();
-///
-///     let write = op.write("abc.txt", "who are you").await?;
-///     let read = op.read("abc.txt").await?;
-///     let s = String::from_utf8(read).unwrap();
-///     println!("{}", s);
-///     let delete = op.delete("abc.txt").await?;
 ///     Ok(())
 /// }
 /// ```

Reply via email to