From 321ecad945d1e052a6d94128dbc5e6e705922c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Sat, 29 Jan 2022 23:23:23 +0100 Subject: [PATCH] feat(data): make info and language service asynchronous --- Data/NosSmooth.Data.Abstractions/IInfoService.cs | 12 ++++++++---- .../Language/ILanguageService.cs | 6 ++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Data/NosSmooth.Data.Abstractions/IInfoService.cs b/Data/NosSmooth.Data.Abstractions/IInfoService.cs index 82627f3..5a33f91 100644 --- a/Data/NosSmooth.Data.Abstractions/IInfoService.cs +++ b/Data/NosSmooth.Data.Abstractions/IInfoService.cs @@ -18,27 +18,31 @@ public interface IInfoService /// Gets the information about an item. /// /// The vnum identifier of the item. + /// The cancellation token for cancelling the operation. /// An item info or an error. - public Result GetItemInfo(int vnum); + public Task> GetItemInfoAsync(int vnum, CancellationToken ct = default); /// /// Gets the information about a map. /// /// The identifier of the map. + /// The cancellation token for cancelling the operation. /// A map info or an error. - public Result GetMapInfo(int id); + public Task> GetMapInfoAsync(int id, CancellationToken ct = default); /// /// Gets the information about a monster. /// /// The vnum identifier of the monster. + /// The cancellation token for cancelling the operation. /// A monster or an error. - public Result GetMonsterInfo(int vnum); + public Task> GetMonsterInfoAsync(int vnum, CancellationToken ct = default); /// /// Gets the information about a skill. /// /// The vnum identifier of the skill. + /// The cancellation token for cancelling the operation. /// A map or an error. - public Result GetSkillInfo(int vnum); + public Task> GetSkillInfoAsync(int vnum, CancellationToken ct = default); } \ No newline at end of file diff --git a/Data/NosSmooth.Data.Abstractions/Language/ILanguageService.cs b/Data/NosSmooth.Data.Abstractions/Language/ILanguageService.cs index f97e27c..e387980 100644 --- a/Data/NosSmooth.Data.Abstractions/Language/ILanguageService.cs +++ b/Data/NosSmooth.Data.Abstractions/Language/ILanguageService.cs @@ -24,14 +24,16 @@ public interface ILanguageService /// The root type of the key. /// The key to translate. /// The language, will be used if null. + /// The cancellation token for cancelling the operation. /// The translated string or an error. - public Result GetTranslation(TranslationRoot root, string key, Language? language = default); + public Task> GetTranslationAsync(TranslationRoot root, string key, Language? language = default, CancellationToken ct = default); /// /// Gets the translation of the given key. /// /// The translatable string containing . /// The language, will be used if null. + /// The cancellation token for cancelling the operation. /// The translated string or an error. - public Result GetTranslation(TranslatableString translatableString, Language? language = default); + public Task> GetTranslationAsync(TranslatableString translatableString, Language? language = default, CancellationToken ct = default); } \ No newline at end of file -- 2.48.1