Exemplo n.º 1
0
 public RestJiraApi(IJiraApiSettings jiraApiSettings, LocalDirs localDirs, CancellationToken cancellationToken)
 {
     _jiraApiSettings   = jiraApiSettings ?? throw new ArgumentNullException(nameof(jiraApiSettings));
     _localDirs         = localDirs ?? throw new ArgumentNullException(nameof(localDirs));
     _cancellationToken = cancellationToken;
     _apiUrl            = "/rest/api/2/";
     _jiraClient        = Atlassian.Jira.Jira.CreateRestClient(jiraApiSettings.JiraUrl, jiraApiSettings.JiraUsername, jiraApiSettings.JiraToken.Value);
     _restClient        = _jiraClient.RestClient;
 }
        public Task <int> Interceptor(
            InterceptorExecutionDelegate next,
            JiraApiSettings jiraApiSettings, WorkspaceSettings workspaceSettings)
        {
            _jiraContext              = new JiraContext(jiraApiSettings, workspaceSettings, _cancellationToken);
            _jiraApi                  = _jiraContext.Api;
            _jiraApiSettings          = _jiraContext.ApiSettings;
            _migrationMetaDataService = new MigrationMetaDataService(_jiraContext);

            return(next());
        }
Exemplo n.º 3
0
        public JiraContext(IJiraApiSettings apiSettings, IWorkspaceSettings workspaceSettings, CancellationToken cancellationToken)
        {
            ApiSettings  = apiSettings;
            LocalDirs    = new LocalDirs(workspaceSettings.WorkspaceDir);
            LocalJiraApi = new LocalDirJiraApi(LocalDirs);

            if (apiSettings.JiraOffline)
            {
                Logger.Debug("Using local cache only");
                Api = LocalJiraApi;
            }
            else
            {
                Logger.Debug("Using jira api at {url}", apiSettings.JiraUrl);
                var restJiraApi = new RestJiraApi(apiSettings, LocalDirs, cancellationToken);
                Api = new CacheJiraApi(apiSettings, restJiraApi, LocalJiraApi);
            }
        }
Exemplo n.º 4
0
 public CacheJiraApi(IJiraApiSettings jiraApiSettings, IJiraApi sourceApi, IWritableJiraApi cacheApi)
 {
     _jiraApiSettings = jiraApiSettings ?? throw new ArgumentNullException(nameof(jiraApiSettings));
     _sourceApi       = sourceApi ?? throw new ArgumentNullException(nameof(sourceApi));
     _cacheApi        = cacheApi ?? throw new ArgumentNullException(nameof(cacheApi));
 }