-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from surgeforward/MeazureChanges
Add Meazure Remote Repository Support
- Loading branch information
Showing
57 changed files
with
1,098 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 13 additions & 13 deletions
26
src/Nagger.Data/JIRA/API/JiraBaseApi.cs → src/Nagger.Data/API/BaseApi.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
namespace Nagger.Data | ||
{ | ||
using Interfaces; | ||
using Models; | ||
|
||
public class BaseRepository | ||
{ | ||
readonly ISettingsService _settingsService; | ||
readonly IInputService _inputService; | ||
|
||
public BaseRepository(ISettingsService settingsService, IInputService inputService) | ||
{ | ||
_settingsService = settingsService; | ||
_inputService = inputService; | ||
} | ||
public User GetUser(string apiName, string usernameKey, string passwordKey) | ||
{ | ||
var username = _settingsService.GetSetting<string>(usernameKey); | ||
if (string.IsNullOrEmpty(username)) | ||
{ | ||
username = _inputService.AskForInput($"Please provide your username for {apiName}"); | ||
_settingsService.SaveSetting(usernameKey, username); | ||
} | ||
|
||
var password = _settingsService.GetSetting<string>(passwordKey); | ||
if (string.IsNullOrEmpty(password)) | ||
{ | ||
password = _inputService.AskForPassword($"Please provide your password for {apiName}"); | ||
_settingsService.SaveSetting(passwordKey, password); | ||
} | ||
|
||
return new User | ||
{ | ||
Username = username, | ||
Password = password | ||
}; | ||
} | ||
|
||
public string GetApiBaseUrl(string apiName, string apiBaseUrlKey) | ||
{ | ||
var baseUrl = _settingsService.GetSetting<string>(apiBaseUrlKey); | ||
if (string.IsNullOrEmpty(baseUrl)) | ||
{ | ||
baseUrl = _inputService.AskForInput($"Please provide your {apiName} base url"); | ||
_settingsService.SaveSetting(apiBaseUrlKey, baseUrl); | ||
} | ||
return baseUrl; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.