コード例 #1
0
 public MyGetPackageListFinder(CliHttpClientFactory cliHttpClientFactory,
                               ICancellationTokenProvider cancellationTokenProvider)
 {
     _cliHttpClientFactory     = cliHttpClientFactory;
     CancellationTokenProvider = cancellationTokenProvider;
     Logger = NullLogger <MyGetPackageListFinder> .Instance;
 }
コード例 #2
0
    private async Task LogoutAsync(string accessToken)
    {
        try
        {
            var client  = CliHttpClientFactory.CreateClient();
            var content = new StringContent(
                JsonSerializer.Serialize(new { token = accessToken }),
                Encoding.UTF8, "application/json"
                );

            using (var response = await client.PostAsync(CliConsts.LogoutUrl, content, CancellationTokenProvider.Token))
            {
                if (!response.IsSuccessStatusCode)
                {
                    Logger.LogWarning(
                        $"Cannot logout from remote service! Response: {response.StatusCode}-{response.ReasonPhrase}"
                        );
                }
            }
        }
        catch (Exception e)
        {
            Logger.LogWarning($"Error occured while logging out from remote service. {e.Message}");
        }
    }
コード例 #3
0
 public SolutionModuleAdder(
     IJsonSerializer jsonSerializer,
     ProjectNugetPackageAdder projectNugetPackageAdder,
     DbContextFileBuilderConfigureAdder dbContextFileBuilderConfigureAdder,
     EfCoreMigrationManager efCoreMigrationManager,
     DerivedClassFinder derivedClassFinder,
     ProjectNpmPackageAdder projectNpmPackageAdder,
     NpmGlobalPackagesChecker npmGlobalPackagesChecker,
     IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
     SourceCodeDownloadService sourceCodeDownloadService,
     SolutionFileModifier solutionFileModifier,
     NugetPackageToLocalReferenceConverter nugetPackageToLocalReferenceConverter,
     AngularSourceCodeAdder angularSourceCodeAdder,
     NewCommand newCommand,
     BundleCommand bundleCommand,
     CliHttpClientFactory cliHttpClientFactory)
 {
     JsonSerializer                        = jsonSerializer;
     ProjectNugetPackageAdder              = projectNugetPackageAdder;
     DbContextFileBuilderConfigureAdder    = dbContextFileBuilderConfigureAdder;
     EfCoreMigrationManager                = efCoreMigrationManager;
     DerivedClassFinder                    = derivedClassFinder;
     ProjectNpmPackageAdder                = projectNpmPackageAdder;
     NpmGlobalPackagesChecker              = npmGlobalPackagesChecker;
     RemoteServiceExceptionHandler         = remoteServiceExceptionHandler;
     SourceCodeDownloadService             = sourceCodeDownloadService;
     SolutionFileModifier                  = solutionFileModifier;
     NugetPackageToLocalReferenceConverter = nugetPackageToLocalReferenceConverter;
     AngularSourceCodeAdder                = angularSourceCodeAdder;
     NewCommand            = newCommand;
     BundleCommand         = bundleCommand;
     _cliHttpClientFactory = cliHttpClientFactory;
     Logger = NullLogger <SolutionModuleAdder> .Instance;
 }
コード例 #4
0
    public async Task <LoginInfo> GetLoginInfoAsync()
    {
        if (!IsLoggedIn())
        {
            return(null);
        }

        var url = $"{CliUrls.WwwAbpIo}api/license/login-info";

        var client = CliHttpClientFactory.CreateClient();

        using (var response = await client.GetHttpResponseMessageWithRetryAsync(url, CancellationTokenProvider.Token, Logger))
        {
            if (!response.IsSuccessStatusCode)
            {
                Logger.LogError("Remote server returns '{response.StatusCode}'");
                return(null);
            }

            await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response);

            var responseContent = await response.Content.ReadAsStringAsync();

            return(JsonSerializer.Deserialize <LoginInfo>(responseContent));
        }
    }
コード例 #5
0
 public JavaScriptServiceProxyGenerator(
     CliHttpClientFactory cliHttpClientFactory,
     IJsonSerializer jsonSerializer,
     JQueryProxyScriptGenerator jQueryProxyScriptGenerator) :
     base(cliHttpClientFactory, jsonSerializer)
 {
     _jQueryProxyScriptGenerator = jQueryProxyScriptGenerator;
 }
コード例 #6
0
 public AngularServiceProxyGenerator(
     CliHttpClientFactory cliHttpClientFactory,
     IJsonSerializer jsonSerializer,
     ICmdHelper cmdhelper,
     CliService cliService) :
     base(cliHttpClientFactory, jsonSerializer)
 {
     _cmdhelper  = cmdhelper;
     _cliService = cliService;
 }
コード例 #7
0
 public ModuleInfoProvider(
     IJsonSerializer jsonSerializer,
     ICancellationTokenProvider cancellationTokenProvider,
     IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
     CliHttpClientFactory cliHttpClientFactory)
 {
     JsonSerializer                = jsonSerializer;
     CancellationTokenProvider     = cancellationTokenProvider;
     RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
     _cliHttpClientFactory         = cliHttpClientFactory;
 }
コード例 #8
0
 public LoginCommand(AuthService authService,
                     ICancellationTokenProvider cancellationTokenProvider,
                     IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
                     CliHttpClientFactory cliHttpClientFactory)
 {
     AuthService = authService;
     CancellationTokenProvider     = cancellationTokenProvider;
     RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
     _cliHttpClientFactory         = cliHttpClientFactory;
     Logger = NullLogger <LoginCommand> .Instance;
 }
コード例 #9
0
ファイル: SuiteCommand.cs プロジェクト: SecTex/abp
 public SuiteCommand(
     AbpNuGetIndexUrlService nuGetIndexUrlService,
     NuGetService nuGetService,
     ICmdHelper cmdHelper,
     CliHttpClientFactory cliHttpClientFactory)
 {
     CmdHelper             = cmdHelper;
     _nuGetIndexUrlService = nuGetIndexUrlService;
     _nuGetService         = nuGetService;
     _cliHttpClientFactory = cliHttpClientFactory;
     Logger = NullLogger <SuiteCommand> .Instance;
 }
コード例 #10
0
 public AuthService(
     IIdentityModelAuthenticationService authenticationService,
     ILogger <NewCommand> logger,
     ICancellationTokenProvider cancellationTokenProvider,
     CliHttpClientFactory cliHttpClientFactory
     )
 {
     AuthenticationService = authenticationService;
     Logger = logger;
     CancellationTokenProvider = cancellationTokenProvider;
     CliHttpClientFactory      = cliHttpClientFactory;
 }
コード例 #11
0
 public CliAnalyticsCollect(
     ICancellationTokenProvider cancellationTokenProvider,
     IJsonSerializer jsonSerializer,
     IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
     CliHttpClientFactory cliHttpClientFactory)
 {
     _cancellationTokenProvider     = cancellationTokenProvider;
     _jsonSerializer                = jsonSerializer;
     _remoteServiceExceptionHandler = remoteServiceExceptionHandler;
     _cliHttpClientFactory          = cliHttpClientFactory;
     _logger = NullLogger <CliAnalyticsCollect> .Instance;
 }
コード例 #12
0
 public NpmPackagesUpdater(
     PackageJsonFileFinder packageJsonFileFinder,
     NpmGlobalPackagesChecker npmGlobalPackagesChecker,
     ICancellationTokenProvider cancellationTokenProvider,
     CliHttpClientFactory cliHttpClientFactory)
 {
     _packageJsonFileFinder    = packageJsonFileFinder;
     _npmGlobalPackagesChecker = npmGlobalPackagesChecker;
     CancellationTokenProvider = cancellationTokenProvider;
     _cliHttpClientFactory     = cliHttpClientFactory;
     Logger = NullLogger <NpmPackagesUpdater> .Instance;
 }
コード例 #13
0
    public TemplateInfoProvider(ICancellationTokenProvider cancellationTokenProvider,
        IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
        AuthService authService,
        CliHttpClientFactory cliHttpClientFactory)
    {
        CancellationTokenProvider = cancellationTokenProvider;
        RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
        AuthService = authService;
        _cliHttpClientFactory = cliHttpClientFactory;

        Logger = NullLogger<TemplateInfoProvider>.Instance;
    }
コード例 #14
0
ファイル: ListTemplatesCommand.cs プロジェクト: SecTex/abp
    public ListTemplatesCommand(
        CliHttpClientFactory cliHttpClientFactory,
        IJsonSerializer jsonSerializer,
        ICancellationTokenProvider cancellationTokenProvider,
        IRemoteServiceExceptionHandler remoteServiceExceptionHandler)
    {
        _cliHttpClientFactory          = cliHttpClientFactory;
        _jsonSerializer                = jsonSerializer;
        _cancellationTokenProvider     = cancellationTokenProvider;
        _remoteServiceExceptionHandler = remoteServiceExceptionHandler;

        Logger = NullLogger <ListTemplatesCommand> .Instance;
    }
コード例 #15
0
 public ProjectNpmPackageAdder(CliHttpClientFactory cliHttpClientFactory,
                               IJsonSerializer jsonSerializer,
                               SourceCodeDownloadService sourceCodeDownloadService,
                               AngularSourceCodeAdder angularSourceCodeAdder,
                               IRemoteServiceExceptionHandler remoteServiceExceptionHandler)
 {
     JsonSerializer                = jsonSerializer;
     SourceCodeDownloadService     = sourceCodeDownloadService;
     AngularSourceCodeAdder        = angularSourceCodeAdder;
     RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
     _cliHttpClientFactory         = cliHttpClientFactory;
     Logger = NullLogger <ProjectNpmPackageAdder> .Instance;
 }
コード例 #16
0
 public AbpIoApiKeyService(
     IJsonSerializer jsonSerializer,
     ICancellationTokenProvider cancellationTokenProvider,
     IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
     ILogger <AbpIoApiKeyService> logger,
     CliHttpClientFactory cliHttpClientFactory)
 {
     JsonSerializer = jsonSerializer;
     RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
     _logger = logger;
     _cliHttpClientFactory     = cliHttpClientFactory;
     CancellationTokenProvider = cancellationTokenProvider;
 }
コード例 #17
0
ファイル: NuGetService.cs プロジェクト: zjc-china/abp
 public NuGetService(
     IJsonSerializer jsonSerializer,
     IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
     ICancellationTokenProvider cancellationTokenProvider,
     IApiKeyService apiKeyService,
     CliHttpClientFactory cliHttpClientFactory)
 {
     JsonSerializer = jsonSerializer;
     RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
     CancellationTokenProvider     = cancellationTokenProvider;
     _apiKeyService        = apiKeyService;
     _cliHttpClientFactory = cliHttpClientFactory;
     Logger = NullLogger <VoloNugetPackagesVersionUpdater> .Instance;
 }
コード例 #18
0
        public AbpIoSourceCodeStore(
            IOptions <AbpCliOptions> options,
            IJsonSerializer jsonSerializer,
            IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
            ICancellationTokenProvider cancellationTokenProvider,
            CliHttpClientFactory cliHttpClientFactory)
        {
            JsonSerializer = jsonSerializer;
            RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
            CancellationTokenProvider     = cancellationTokenProvider;
            _cliHttpClientFactory         = cliHttpClientFactory;
            Options = options.Value;

            Logger = NullLogger <AbpIoSourceCodeStore> .Instance;
        }
コード例 #19
0
 public AuthService(
     IIdentityModelAuthenticationService authenticationService,
     ILogger <AuthService> logger,
     ICancellationTokenProvider cancellationTokenProvider,
     CliHttpClientFactory cliHttpClientFactory,
     RemoteServiceExceptionHandler remoteServiceExceptionHandler,
     IJsonSerializer jsonSerializer
     )
 {
     AuthenticationService = authenticationService;
     Logger = logger;
     CancellationTokenProvider     = cancellationTokenProvider;
     CliHttpClientFactory          = cliHttpClientFactory;
     RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
     JsonSerializer = jsonSerializer;
 }
コード例 #20
0
 public NpmPackagesUpdater(
     PackageJsonFileFinder packageJsonFileFinder,
     NpmGlobalPackagesChecker npmGlobalPackagesChecker,
     ICancellationTokenProvider cancellationTokenProvider,
     CliHttpClientFactory cliHttpClientFactory,
     IInstallLibsService installLibsService,
     ICmdHelper cmdHelper)
 {
     _packageJsonFileFinder    = packageJsonFileFinder;
     _npmGlobalPackagesChecker = npmGlobalPackagesChecker;
     CancellationTokenProvider = cancellationTokenProvider;
     InstallLibsService        = installLibsService;
     CmdHelper             = cmdHelper;
     _cliHttpClientFactory = cliHttpClientFactory;
     Logger = NullLogger <NpmPackagesUpdater> .Instance;
 }
コード例 #21
0
 public ProjectNugetPackageAdder(
     IJsonSerializer jsonSerializer,
     ProjectNpmPackageAdder npmPackageAdder,
     DerivedClassFinder moduleClassFinder,
     ModuleClassDependcyAdder moduleClassDependcyAdder,
     IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
     BundleCommand bundleCommand,
     CliHttpClientFactory cliHttpClientFactory)
 {
     JsonSerializer                = jsonSerializer;
     NpmPackageAdder               = npmPackageAdder;
     ModuleClassFinder             = moduleClassFinder;
     ModuleClassDependcyAdder      = moduleClassDependcyAdder;
     RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
     BundleCommand         = bundleCommand;
     _cliHttpClientFactory = cliHttpClientFactory;
     Logger = NullLogger <ProjectNugetPackageAdder> .Instance;
 }
コード例 #22
0
 public ProjectNugetPackageAdder(
     IJsonSerializer jsonSerializer,
     ProjectNpmPackageAdder npmPackageAdder,
     DerivedClassFinder moduleClassFinder,
     ModuleClassDependcyAdder moduleClassDependcyAdder,
     IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
     BundleCommand bundleCommand,
     CliHttpClientFactory cliHttpClientFactory,
     SourceCodeDownloadService sourceCodeDownloadService,
     SolutionFileModifier solutionFileModifier)
 {
     JsonSerializer                = jsonSerializer;
     NpmPackageAdder               = npmPackageAdder;
     ModuleClassFinder             = moduleClassFinder;
     ModuleClassDependcyAdder      = moduleClassDependcyAdder;
     RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
     BundleCommand             = bundleCommand;
     SourceCodeDownloadService = sourceCodeDownloadService;
     SolutionFileModifier      = solutionFileModifier;
     _cliHttpClientFactory     = cliHttpClientFactory;
     Logger = NullLogger <ProjectNugetPackageAdder> .Instance;
 }
コード例 #23
0
    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);
    }
コード例 #24
0
 protected ServiceProxyGeneratorBase(CliHttpClientFactory cliHttpClientFactory, IJsonSerializer jsonSerializer)
 {
     CliHttpClientFactory = cliHttpClientFactory;
     JsonSerializer       = jsonSerializer;
     Logger = NullLogger <T> .Instance;
 }