using System.Diagnostics.CodeAnalysis; using OliverBooth.Common.Data.Web; namespace OliverBooth.Common.Services; /// /// Represents a service which can fetch multi-language code snippets. /// public interface ICodeSnippetService { /// /// Returns all the languages which apply to the specified snippet. /// /// The ID of the snippet whose languages should be returned. /// /// A read-only view of the languages that apply to the snippet. This list may be empty if the snippet ID is invalid. /// IReadOnlyList GetLanguagesForSnippet(int id); /// /// Attempts to find a code snippet by the specified ID, in the specified language. /// /// The ID of the snippet to search for. /// The language to search for. /// /// When this method returns, contains the code snippet matching the specified criteria, if such a snippet was found; /// otherwise, . /// /// if the snippet was found; otherwise, . /// is . bool TryGetCodeSnippetForLanguage(int id, string language, [NotNullWhen(true)] out ICodeSnippet? snippet); }