diff --git a/BotCity.Maestro.SDK.csproj b/BotCity.Maestro.SDK.csproj index 1721887..d8e6d2d 100644 --- a/BotCity.Maestro.SDK.csproj +++ b/BotCity.Maestro.SDK.csproj @@ -3,8 +3,8 @@ netstandard2.0 Library - 1.0.8 - 1.0.8 + 1.0.9 + 1.0.9 BotCity.Maestro.SDK botcity sdk automation automation desktop Apache-2.0 diff --git a/botcity/maestro/BotMaestroSDK.cs b/botcity/maestro/BotMaestroSDK.cs index b7d05e5..ef76523 100644 --- a/botcity/maestro/BotMaestroSDK.cs +++ b/botcity/maestro/BotMaestroSDK.cs @@ -160,7 +160,7 @@ private Dictionary ToDictionary(dynamic item) return dictionary; } - public async Task Login(string server = "", string login = "", string key = "") { + public async Task LoginAsync(string server = "", string login = "", string key = "") { using (HttpClient client = new HttpClient()) { try { var data = new { login = _login, key = _key }; @@ -262,7 +262,7 @@ public async Task FinishTaskAsync(string taskId, FinishStatusEnu } } - public async Task InterruptTask(string taskId) { + public async Task InterruptTaskAsync(string taskId) { string url = $"{_server}/api/v2/task/{taskId}"; var data = new Dictionary { @@ -284,7 +284,7 @@ public async Task InterruptTask(string taskId) { } } - public async Task RestartTask(string taskId) { + public async Task RestartTaskAsync(string taskId) { string url = $"{_server}/api/v2/task/{taskId}"; var data = new Dictionary { @@ -306,7 +306,7 @@ public async Task RestartTask(string taskId) { } } - public async Task CreateAlert(string taskId, string title, string message, AlertTypeEnum alertType) + public async Task CreateAlertAsync(string taskId, string title, string message, AlertTypeEnum alertType) { string url = $"{_server}/api/v2/alerts"; var data = new Dictionary @@ -332,7 +332,7 @@ public async Task CreateAlert(string taskId, string title, string message } } - public async Task SendMessage(List emails, List logins, string subject, string body, MessageTypeEnum messageType, List groups = null) + public async Task SendMessageAsync(List emails, List logins, string subject, string body, MessageTypeEnum messageType, List groups = null) { string url = $"{_server}/api/v2/message"; var data = new Dictionary @@ -357,7 +357,7 @@ public async Task SendMessage(List emails, List logins, string s } } - public async Task GetCredential(string label, string key) { + public async Task GetCredentialAsync(string label, string key) { string url = $"{_server}/api/v2/credential/{label}/key/{key}"; using (var client = new HttpClient()) @@ -415,7 +415,7 @@ private async Task GetCredentialByLabel(string label) { } } - public async Task CreateCredential(string label, string key, string value) { + public async Task CreateCredentialAsync(string label, string key, string value) { string url = $"{_server}/api/v2/credential/{label}/key"; bool existCredential = await this.GetCredentialByLabel(label); if (!existCredential) { @@ -451,7 +451,7 @@ private Dictionary MergeDictionaries(Dictionary return result; } - public async Task CreateError(Exception exception, string taskId, string screenshotPath = "", Dictionary tags = null, List attachments = null) { + public async Task CreateErrorAsync(Exception exception, string taskId, string screenshotPath = "", Dictionary tags = null, List attachments = null) { string url = $"{_server}/api/v2/error"; Dictionary defaultTags = this.GetDefaultErrorTags(); if (tags != null) { @@ -620,7 +620,7 @@ public async Task NewLogEntryAsync(string label, Dictionary valu } } - public async Task> GetLog(string label, string date = null) { + public async Task> GetLogAsync(string label, string date = null) { string url = $"{_server}/api/v2/log/{label}"; int days = 365; if (!string.IsNullOrEmpty(date)) { @@ -665,8 +665,8 @@ public async Task DeleteLogAsync(string label) { } } - public async Task PostArtifact(string taskId, string name, string filepath) { - string artifact_id = await this.CreateArtifact(taskId, name, filepath); + public async Task PostArtifactAsync(string taskId, string name, string filepath) { + string artifact_id = await this.CreateArtifactAsync(taskId, name, filepath); string url = $"{_server}/api/v2/artifact/log/{artifact_id}"; filepath = Environment.ExpandEnvironmentVariables(filepath); filepath = Path.GetFullPath(filepath); @@ -704,7 +704,7 @@ public async Task PostArtifact(string taskId, string name, string filepath) { } } - private async Task CreateArtifact(string taskId, string name, string filename) { + private async Task CreateArtifactAsync(string taskId, string name, string filename) { string url = $"{_server}/api/v2/artifact"; var data = new Dictionary { @@ -726,7 +726,7 @@ private async Task CreateArtifact(string taskId, string name, string fil return artifactId; } - public async Task<(string filename, byte[] fileContent)> GetArtifact(string artifactId) { + public async Task<(string filename, byte[] fileContent)> GetArtifactAsync(string artifactId) { string url = $"{_server}/api/v2/artifact/{artifactId}"; using (var client = new HttpClient()) @@ -747,7 +747,7 @@ private async Task CreateArtifact(string taskId, string name, string fil } } - public async Task> ListArtifact(int days = 7) { + public async Task> ListArtifactAsync(int days = 7) { string url = $"{_server}/api/v2/artifact?size=5&page=0&sort=dateCreation,desc&days={days}"; var artifacts = new List(); @@ -776,7 +776,7 @@ public async Task> ListArtifact(int days = 7) { } } - public async Task CreateDatapool(Datapool pool) + public async Task CreateDatapoolAsync(Datapool pool) { string url = $"{_server}/api/v2/datapool"; @@ -793,7 +793,7 @@ public async Task CreateDatapool(Datapool pool) } } - public async Task GetDatapool(string label) + public async Task GetDatapoolAsync(string label) { string url = $"{_server}/api/v2/datapool/{label}"; diff --git a/botcity/maestro/datapool/Datapool.cs b/botcity/maestro/datapool/Datapool.cs index 24de422..9951f02 100644 --- a/botcity/maestro/datapool/Datapool.cs +++ b/botcity/maestro/datapool/Datapool.cs @@ -160,7 +160,7 @@ public async Task DeactivateAsync() { return await this.ActiveAsync(false); } - public async Task IsActive() { + public async Task IsActiveAsync() { string url = $"{this.Maestro.GetServer()}/api/v2/datapool/{this.Label}"; using (var client = new HttpClient()) { @@ -175,7 +175,7 @@ public async Task IsActive() { } } - public async Task GetSummary() { + public async Task GetSummaryAsync() { string url = $"{this.Maestro.GetServer()}/api/v2/datapool/{this.Label}/summary"; using (var client = new HttpClient()) { @@ -189,16 +189,16 @@ public async Task GetSummary() { } } - public async Task IsEmpty() { - Summary summary = await this.GetSummary(); + public async Task IsEmptyAsync() { + Summary summary = await this.GetSummaryAsync(); if(summary.CountPending == 0) { return true; } return false; } - public async Task HasNext() { - return !(await this.IsEmpty()); + public async Task HasNextAsync() { + return !(await this.IsEmptyAsync()); } private async void verifyResponse(HttpResponseMessage data, string error) { @@ -253,7 +253,7 @@ public async Task NextAsync(string? taskId = null) { } } - public async Task GetEntry(string entryId) { + public async Task GetEntryAsync(string entryId) { string url = $"{this.Maestro.GetServer()}/api/v2/datapool/{this.Label}/entry/{entryId}"; using (var client = new HttpClient()) { @@ -271,7 +271,7 @@ public async Task GetEntry(string entryId) { return entry; } } - public async Task CreateEntry(DatapoolEntry entry) { + public async Task CreateEntryAsync(DatapoolEntry entry) { string url = $"{this.Maestro.GetServer()}/api/v2/datapool/{this.Label}/push"; var data = JsonConvert.SerializeObject(entry.ToJson()); using (var client = new HttpClient()) { diff --git a/botcity/maestro/datapool/Entry.cs b/botcity/maestro/datapool/Entry.cs index d800136..a993f2f 100644 --- a/botcity/maestro/datapool/Entry.cs +++ b/botcity/maestro/datapool/Entry.cs @@ -140,7 +140,7 @@ public Dictionary JsonToUpdate() { return data; } - public async Task Save(string? taskId = null) { + public async Task SaveAsync(string? taskId = null) { string url = $"{this.Maestro.GetServer()}/api/v2/datapool/{this.DatapoolLabel}/entry/{this.EntryId}"; var data = JsonConvert.SerializeObject(this.JsonToUpdate()); var dataDict = JsonConvert.DeserializeObject>(data); @@ -160,13 +160,13 @@ public async Task Save(string? taskId = null) { private async Task Report(StateEntryEnum state) { this.State = state; - await this.Save(); + await this.SaveAsync(); } - public async Task ReportDone() { + public async Task ReportDoneAsync() { await this.Report(StateEntryEnum.DONE); } - public async Task ReportError() { + public async Task ReportErrorAsync() { await this.Report(StateEntryEnum.ERROR); }