Beispiel #1
0
        private async Task <string> GetNuGetIndexUrlAsync()
        {
            var apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync().ConfigureAwait(false);

            if (apiKeyResult == null || string.IsNullOrEmpty(apiKeyResult.ApiKey))
            {
                Logger.LogError("Couldn't retrieve your NuGet API key!");
                Logger.LogWarning(File.Exists(CliPaths.AccessToken)
                    ? "Make sure you have an active session and license on commercial.abp.io. To re-sign in you can use the CLI command \"abp login <username>\"."
                    : "You are not signed in to commercial.abp.io. Use the CLI command \"abp login <username>\" to sign in.");

                return(null);
            }

            return(CliUrls.GetNuGetServiceIndexUrl(apiKeyResult.ApiKey));
        }
Beispiel #2
0
    public async Task <string> GetAsync()
    {
        var apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync();

        if (apiKeyResult == null)
        {
            Logger.LogWarning("You are not signed in! Use the CLI command \"abp login <username>\" to sign in, then try again.");
            return(null);
        }

        if (!string.IsNullOrWhiteSpace(apiKeyResult.ErrorMessage))
        {
            Logger.LogWarning(apiKeyResult.ErrorMessage);
            return(null);
        }

        if (string.IsNullOrEmpty(apiKeyResult.ApiKey))
        {
            Logger.LogError("Couldn't retrieve your NuGet API key! You can re-sign in with the CLI command \"abp login <username>\".");
            return(null);
        }

        return(CliUrls.GetNuGetServiceIndexUrl(apiKeyResult.ApiKey));
    }