示例#1
0
        private async Task <GitHubAuthContext> GetAuthContext(Guid id)
        {
            IConnectedService?service = await _connectedServiceManager.GetAsync(
                id,
                default);

            if (service is GitHubConnectedService gh)
            {
                return(new GitHubAuthContext
                {
                    Id = id,
                    OAuth = gh.OAuth !
                });
示例#2
0
        private async Task <IGitRemoteClient> CreateClient(
            Guid serviceId,
            CancellationToken cancellationToken)
        {
            IConnectedService?service = await _serviceManager
                                        .GetAsync(serviceId, cancellationToken);

            if (service is null)
            {
                throw new ApplicationException($"No service found for Id: {_serviceManager}");
            }

            return(_clientFactory.Create(service.Type));
        }
        private async Task <GitHubConnectedService> GetConnectedServiceAsync(
            Guid id,
            CancellationToken cancellationToken)
        {
            IConnectedService?service = await _connectedServiceManager
                                        .GetAsync(id, cancellationToken);

            if (service is GitHubConnectedService gh)
            {
                return(gh);
            }

            throw new ApplicationException(
                      $"No GitHub ConnectedService " +
                      "found with name {name}");
        }
        private async Task <AzureDevOpsConnectedService> GetConnectedServiceAsync(
            Guid id,
            CancellationToken cancellationToken)
        {
            IConnectedService?service = await _connectedServiceManager
                                        .GetAsync(id, cancellationToken);

            if (service is AzureDevOpsConnectedService ado)
            {
                return(ado);
            }

            throw new ApplicationException(
                      $"No AzureDevOps ConnectedService " +
                      "found with name {name}");
        }