Exemple #1
0
        /// <summary>
        /// Static method that creates a new object of PGDrive class and authenticates user using ApiKey authorization
        /// </summary>
        /// <param name="ConfigApiKeyDriveName">Name of element in ApiKeyDrives collection of PGDrive section in your config</param>
        public static PGDrive GetApiKeyDrive(string ConfigApiKeyDriveName)
        {
            PGDrive newDrive = new PGDrive();

            newDrive.Auth         = new Auth();
            newDrive.driveService = newDrive.Auth.GetApiKeyDrive(ConfigApiKeyDriveName);
            newDrive.InitializeModules();
            return(newDrive);
        }
Exemple #2
0
        /// <summary>
        /// Static method that creates a new object of PGDrive class and authenticates user using OAuth2.0 authorization
        /// </summary>
        /// <param name="ConfigOAuthDriveName">Name of element in ApiKeyDrives collection of PGDrive section in your config</param>
        /// <param name="scopes"> USE PGScopes static class,
        /// combine scopes using method And in scope objects.
        /// Scopes provides permissions to use your drive.
        /// </param>
        /// <param name="reCreateOAuthToken">Recreates an access token for current drive if you want to change the scopes</param>
        /// <exception cref="NullReferenceException">Throws if elemtent of OAuthDrives config collection with such name wasn't founded</exception>
        public static PGDrive GetOAuthDrive(string ConfigOAuthDriveName, PGScope scopes = null, bool reCreateOAuthToken = false)
        {
            PGDrive newDrive = new PGDrive();

            newDrive.Auth         = new Auth();
            newDrive.driveService = newDrive.Auth.GetOAuthDrive(ConfigOAuthDriveName, scopes, reCreateOAuthToken);
            newDrive.InitializeModules();
            return(newDrive);
        }