2022-01-26 11:32:16 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Data.Models;
|
2021-03-22 12:09:25 -04:00
|
|
|
|
using SharedLibraryCore.Database.Models;
|
2020-08-17 22:21:11 -04:00
|
|
|
|
using SharedLibraryCore.Dtos;
|
|
|
|
|
using SharedLibraryCore.QueryHelper;
|
|
|
|
|
|
|
|
|
|
namespace SharedLibraryCore.Interfaces
|
|
|
|
|
{
|
2022-03-23 12:31:53 -04:00
|
|
|
|
[Obsolete("Use IMetaServiceV2")]
|
2020-08-17 22:21:11 -04:00
|
|
|
|
public interface IMetaService
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2022-01-26 11:32:16 -05:00
|
|
|
|
/// adds or updates meta key and value to the database
|
2020-08-17 22:21:11 -04:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="metaKey">key of meta data</param>
|
|
|
|
|
/// <param name="metaValue">value of the meta data</param>
|
|
|
|
|
/// <param name="client">client to save the meta for</param>
|
2022-03-24 12:34:32 -04:00
|
|
|
|
/// <param name="linkedMeta"></param>
|
2020-08-17 22:21:11 -04:00
|
|
|
|
/// <returns></returns>
|
2021-01-24 12:47:19 -05:00
|
|
|
|
Task AddPersistentMeta(string metaKey, string metaValue, EFClient client, EFMeta linkedMeta = null);
|
|
|
|
|
|
2022-02-10 17:50:45 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// adds or updates meta key and value to the database
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="metaKey">key of meta data</param>
|
|
|
|
|
/// <param name="metaValue">value of the meta data</param>
|
|
|
|
|
/// <param name="clientId">id of the client to save the meta for</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task SetPersistentMeta(string metaKey, string metaValue, int clientId);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// increments meta value and persists to the database
|
|
|
|
|
/// <remarks>if the meta value does not already exist it will be set to the increment amount</remarks>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="metaKey">key of meta data</param>
|
|
|
|
|
/// <param name="incrementAmount">value to increment by</param>
|
|
|
|
|
/// <param name="clientId">id of the client to save the meta for</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task IncrementPersistentMeta(string metaKey, int incrementAmount, int clientId);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// decrements meta value and persists to the database
|
|
|
|
|
/// <remarks>if the meta value does not already exist it will be set to the decrement amount</remarks>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="metaKey">key of meta data</param>
|
|
|
|
|
/// <param name="decrementAmount">value to increment by</param>
|
|
|
|
|
/// <param name="clientId">id of the client to save the meta for</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task DecrementPersistentMeta(string metaKey, int decrementAmount, int clientId);
|
|
|
|
|
|
2021-01-24 12:47:19 -05:00
|
|
|
|
/// <summary>
|
2022-01-26 11:32:16 -05:00
|
|
|
|
/// adds or updates meta key and value to the database
|
2021-01-24 12:47:19 -05:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="metaKey">key of meta data</param>
|
|
|
|
|
/// <param name="metaValue">value of the meta data</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task AddPersistentMeta(string metaKey, string metaValue);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2022-01-26 11:32:16 -05:00
|
|
|
|
/// removes meta key with given value
|
2021-01-24 12:47:19 -05:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="metaKey">key of meta data</param>
|
|
|
|
|
/// <param name="client">client to delete the meta for</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task RemovePersistentMeta(string metaKey, EFClient client);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2022-01-26 11:32:16 -05:00
|
|
|
|
/// removes meta key with given value
|
2021-01-24 12:47:19 -05:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="metaKey">key of the meta data</param>
|
|
|
|
|
/// <param name="metaValue">value of the meta data</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task RemovePersistentMeta(string metaKey, string metaValue = null);
|
2020-08-17 22:21:11 -04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2022-01-26 11:32:16 -05:00
|
|
|
|
/// retrieves meta data for given client and key
|
2020-08-17 22:21:11 -04:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="metaKey">key to retrieve value for</param>
|
|
|
|
|
/// <param name="client">client to retrieve meta for</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task<EFMeta> GetPersistentMeta(string metaKey, EFClient client);
|
|
|
|
|
|
2021-01-24 12:47:19 -05:00
|
|
|
|
/// <summary>
|
2022-01-26 11:32:16 -05:00
|
|
|
|
/// retrieves collection of meta for given key
|
2021-01-24 12:47:19 -05:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="metaKey">key to retrieve values for</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task<IEnumerable<EFMeta>> GetPersistentMeta(string metaKey);
|
|
|
|
|
|
2020-08-17 22:21:11 -04:00
|
|
|
|
/// <summary>
|
2022-01-26 11:32:16 -05:00
|
|
|
|
/// adds a meta task to the runtime meta list
|
2020-08-17 22:21:11 -04:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="metaKey">type of meta</param>
|
|
|
|
|
/// <param name="metaAction">action to perform</param>
|
2022-01-26 11:32:16 -05:00
|
|
|
|
void AddRuntimeMeta<T, V>(MetaType metaKey, Func<T, Task<IEnumerable<V>>> metaAction)
|
|
|
|
|
where V : IClientMeta where T : PaginationRequest;
|
2020-08-17 22:21:11 -04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2022-01-26 11:32:16 -05:00
|
|
|
|
/// retrieves all the runtime meta information for given client idea
|
2020-08-17 22:21:11 -04:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request">request information</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task<IEnumerable<IClientMeta>> GetRuntimeMeta(ClientPaginationRequest request);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2022-01-26 11:32:16 -05:00
|
|
|
|
/// retreives all the runtime of provided type
|
2020-08-17 22:21:11 -04:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request">>request information</param>
|
|
|
|
|
/// <param name="metaType">type of meta to retreive</param>
|
|
|
|
|
/// <returns></returns>
|
2022-01-26 11:32:16 -05:00
|
|
|
|
Task<IEnumerable<T>> GetRuntimeMeta<T>(ClientPaginationRequest request, MetaType metaType)
|
|
|
|
|
where T : IClientMeta;
|
2020-08-17 22:21:11 -04:00
|
|
|
|
}
|
2022-02-10 17:50:45 -05:00
|
|
|
|
}
|