Skip to content

SeppPenner/GoogleDriveExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoogleDriveExample

GoogleDriveExample is an assembly/ library on how to work with the Google.Apis.Drive.v3.dll.

Build status GitHub issues GitHub forks GitHub stars License: MIT Known Vulnerabilities Blogger Patreon PayPal

Basic usage

public void Test()
{
    ICustomGDriveService _service = new CustomGDriveService();
    _service.xy //See the interface section for more information
}

Interface ICustomGDriveService

using System;
using Google.Apis.Drive.v3;
using GoogleDriveExample.Implementation;

namespace GoogleDriveExample.Interfaces
{
    /// <summary>
    ///     The Google <see cref="CustomGDriveService" /> class
    /// </summary>
    public interface ICustomGDriveService
    {
        /// <summary>
        ///     Gets the used quota of the account
        /// </summary>
        /// <param name="service">The <see cref="DriveService" /> that is needed</param>
        /// <returns>The used quota of the account</returns>
        long GetQuotaUsed(DriveService service);

        /// <summary>
        ///     Gets the total quota (is 15 GB) of the account
        /// </summary>
        /// <param name="service">The <see cref="DriveService" /> that is needed</param>
        /// <returns>The total quota of the account</returns>
        long GetQuotaTotal(DriveService service);

        /// <summary>
        ///     Uploads a file to GDrive with "everone that has the link can read the file" rights
        /// </summary>
        /// <param name="service">The <see cref="DriveService" /> that is needed</param>
        /// <param name="uploadFile">The File that should be uploaded</param>
        /// <param name="parent">The parent folder</param>
        /// <returns>The download link to the file</returns>
        string UploadToGDrive(DriveService service, string uploadFile, string parent);

        /// <summary>
        ///     Gets the root folder id of the account
        /// </summary>
        /// <param name="service">The <see cref="DriveService" /> that is needed</param>
        /// <returns>The root folder id for the account</returns>
        string GetRootFolderId(DriveService service);

        /// <summary>
        ///     Gets the <see cref="DriveService" /> needed in the methods above
        /// </summary>
        /// <param name="clientId">The client id that needs to be set inside the Google account (API-Key)</param>
        /// <param name="clientSecret">The client secret/ password</param>
        /// <param name="userName">The client username</param>
        /// <returns>The <see cref="DriveService" /> needed to authenticate the above methods</returns>
        DriveService GetDriveService(string clientId, string clientSecret, string userName);

        /// <summary>
        ///     Called when the upload process is changed
        /// </summary>
        event EventHandler OnUploadProgessChanged;

        /// <summary>
        ///     Called when the upload process is finished
        /// </summary>
        event EventHandler OnUploadSuccessfull;
    }
}

Change history

See the Changelog.

About

GoogleDriveExample is an assembly/ library on how to work with the Google.Apis.Drive.v3.dll.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages