IClient.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using InABox.Core;
  4. namespace InABox.Clients
  5. {
  6. public interface IClient : IQueryProvider
  7. {
  8. IValidationData Validate(string userid, string password, Guid session = default);
  9. IValidationData Validate(string pin, Guid session = default);
  10. IValidationData Validate(Guid session);
  11. CoreTable Query(object? filter = null, object? columns = null, object? sort = null, CoreRange? range = null);
  12. Entity[] Load(object? filter = null, object? sort = null, CoreRange? range = null);
  13. void Save(object entity, string auditnote);
  14. void Save(IEnumerable<object> entities, string auditnote);
  15. void Delete(object entity, string auditnote);
  16. void Delete(IEnumerable<object> entities, string auditnote);
  17. Dictionary<string, CoreTable> QueryMultiple(Dictionary<string, IQueryDef> queries);
  18. void QueryMultiple(Action<Dictionary<string, CoreTable>?, Exception?> callback, Dictionary<string, IQueryDef> queries);
  19. bool Check2FA(string code, Guid? session = null);
  20. /// <summary>
  21. /// Check if the server is running
  22. /// </summary>
  23. /// <returns><c>true</c> if the server is running</returns>
  24. bool Ping();
  25. /// <summary>
  26. /// Get general information about this server
  27. /// </summary>
  28. /// <returns>DatabaseInfo</returns>
  29. DatabaseInfo? Info();
  30. string Version();
  31. string ReleaseNotes();
  32. byte[]? Installer();
  33. IEnumerable<string> SupportedTypes();
  34. event LogEvent OnLog;
  35. bool IsConnected();
  36. }
  37. public interface IClient<TEntity> : IClient, IQueryProvider<TEntity> where TEntity : Entity, new()
  38. {
  39. TEntity[] Load(Filter<TEntity>? filter = null, SortOrder<TEntity>? sort = null, CoreRange? range = null);
  40. void Load(Filter<TEntity>? filter, SortOrder<TEntity>? sort, CoreRange? range, Action<TEntity[]?, Exception?> callback);
  41. }
  42. }