using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Data.Models; using SharedLibraryCore.Dtos; using SharedLibraryCore.QueryHelper; namespace SharedLibraryCore.Interfaces; public interface IMetaServiceV2 { #region PER_CLIENT /// /// adds or updates meta key and value to the database as simple string /// /// key of meta data /// value of the meta data /// id of the client to save the meta for /// /// Task SetPersistentMeta(string metaKey, string metaValue, int clientId, CancellationToken token = default); /// /// add or update meta key and value to the database as serialized object type /// /// /// /// /// /// type of object being serialized /// Task SetPersistentMetaValue(string metaKey, T metaValue, int clientId, CancellationToken token = default) where T : class; /// /// Sets meta key to a linked lookup key and id /// /// Key for the client meta /// Key of the global lookup meta /// Id in the list of lookup values /// id of the client /// /// Task SetPersistentMetaForLookupKey(string metaKey, string lookupKey, int lookupId, int clientId, CancellationToken token = default); /// /// increments meta value and persists to the database /// if the meta value does not already exist it will be set to the increment amount /// the assumption is made that the existing value is /// /// key of meta data /// value to increment by /// id of the client to save the meta for /// /// Task IncrementPersistentMeta(string metaKey, int incrementAmount, int clientId, CancellationToken token = default); /// /// decrements meta value and persists to the database /// if the meta value does not already exist it will be set to the decrement amount /// the assumption is made that the existing value is /// /// key of meta data /// value to increment by /// id of the client to save the meta for /// /// Task DecrementPersistentMeta(string metaKey, int decrementAmount, int clientId, CancellationToken token = default); /// /// retrieves meta entry /// /// /// /// /// Task GetPersistentMeta(string metaKey, int clientId, CancellationToken token = default); /// /// retrieves meta value as deserialized object /// /// /// /// /// object type to deserialize into /// Task GetPersistentMetaValue(string metaKey, int clientId, CancellationToken token = default) where T : class; /// /// retrieves meta entry by with associated lookup value as string /// /// /// /// /// /// Task GetPersistentMetaByLookup(string metaKey, string lookupKey, int clientId, CancellationToken token = default); /// /// removes meta key with given value /// /// key of meta data /// client to delete the meta for /// /// Task RemovePersistentMeta(string metaKey, int clientId, CancellationToken token = default); #endregion #region GLOBAL /// /// adds or updates meta key and value to the database /// /// key of meta data /// value of the meta data /// /// Task SetPersistentMeta(string metaKey, string metaValue, CancellationToken token = default); /// /// serializes and sets (create or update) meta key and value /// /// /// /// /// /// Task SetPersistentMetaValue(string metaKey, T metaValue, CancellationToken token = default) where T : class; /// /// removes meta key with given value /// /// key of the meta data /// /// Task RemovePersistentMeta(string metaKey, CancellationToken token = default); /// /// retrieves collection of meta for given key /// /// key to retrieve values for /// /// Task GetPersistentMeta(string metaKey, CancellationToken token = default); /// /// returns value of meta key if it exists /// /// /// /// /// Task GetPersistentMetaValue(string metaKey, CancellationToken token = default) where T : class; #endregion /// /// adds a meta task to the runtime meta list /// /// type of meta /// action to perform void AddRuntimeMeta(MetaType metaKey, Func>> metaAction) where TReturn : IClientMeta where T : PaginationRequest; /// /// retrieves all the runtime meta information for given client idea /// /// request information /// /// Task> GetRuntimeMeta(ClientPaginationRequest request, CancellationToken token = default); /// /// retrieves all the runtime of provided type /// /// >request information /// type of meta to retreive /// /// Task> GetRuntimeMeta(ClientPaginationRequest request, MetaType metaType, CancellationToken token = default) where T : IClientMeta; }