private async Task <string> GetNuGetUrlForCommercialPackage(string packageId) { if (_apiKeyResult == null) { _apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync(); } return(CliUrls.GetNuGetPackageInfoUrl(_apiKeyResult.ApiKey, packageId)); }
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)); }
protected virtual async Task <ApplicationApiDescriptionModel> GetApplicationApiDescriptionModelAsync(GenerateProxyArgs args) { Check.NotNull(args.Url, nameof(args.Url)); var client = CliHttpClientFactory.CreateClient(); var apiDefinitionResult = await client.GetStringAsync(CliUrls.GetApiDefinitionUrl(args.Url)); var apiDefinition = JsonSerializer.Deserialize <ApplicationApiDescriptionModel>(apiDefinitionResult); var moduleDefinition = apiDefinition.Modules.FirstOrDefault(x => string.Equals(x.Key, args.Module, StringComparison.CurrentCultureIgnoreCase)).Value; if (moduleDefinition == null) { throw new CliUsageException($"Module name: {args.Module} is invalid"); } var apiDescriptionModel = ApplicationApiDescriptionModel.Create(); apiDescriptionModel.AddModule(moduleDefinition); return(apiDescriptionModel); }
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)); }