internal static RequestMetaData RestoreHelperRequestMetaData()
    {
        var metaData = new RequestMetaData();

        metaData.AddRestoreHelper();
        return(metaData);
    }
    internal static RequestMetaData SnapshotHelperRequestMetaData()
    {
        var metaData = new RequestMetaData();

        metaData.AddSnapshotHelper();
        return(metaData);
    }
    internal static RequestMetaData BulkHelperRequestMetaData()
    {
        var metaData = new RequestMetaData();

        metaData.AddBulkHelper();
        return(metaData);
    }
    internal static RequestMetaData ScrollHelperRequestMetaData()
    {
        var metaData = new RequestMetaData();

        metaData.AddScrollHelper();
        return(metaData);
    }
示例#5
0
 internal static void AddHelper(this RequestMetaData metaData, string helperValue)
 {
     if (!metaData.TryAddMetaData(RequestMetaData.HelperKey, helperValue))
     {
         throw new InvalidOperationException("A helper value has already been added.");
     }
 }
示例#6
0
        protected void AddApiResult(RequestMetaData metadata)
        {
            if (!General.AppSettings.ApiHealthLogging)
            {
                return;
            }

            General.Db.ExecuteSql(Data.Sql.Api.SqlCommands.InsertApiHealthRecordSql,
                                  metadata.Domain, metadata.Status, metadata.Message, metadata.Token, metadata.Time, metadata.Code, metadata.Server, metadata.RequestId);
        }
    internal static void SetRequestMetaData(this IRequestParameters parameters, RequestMetaData requestMetaData)
    {
        if (parameters is null)
        {
            throw new ArgumentNullException(nameof(parameters));
        }

        if (requestMetaData is null)
        {
            throw new ArgumentNullException(nameof(requestMetaData));
        }

        parameters.RequestConfiguration ??= new RequestConfiguration();

        parameters.RequestConfiguration.RequestMetaData = requestMetaData;
    }
示例#8
0
        public ApiErrorResult(string error, string domain = "", string token = "", int code = 0, long nonce = 0)
        {
            Data = new List <IDataResult>();

            MetaData = new RequestMetaData
            {
                Domain  = domain,
                Status  = false,
                Token   = token,
                Nonce   = nonce,
                Message = error,
                Time    = 0L,
                Code    = code
            };

            AddApiResult(MetaData);
        }
示例#9
0
        public ApiResult(IList <IDataResult> data, string domain = "", string token = "", long nonce = 0)
        {
            Data = data;

            MetaData = new RequestMetaData
            {
                Domain  = domain,
                Status  = (data != null && data.Count != 0),
                Message = ((data != null && data.Count != 0) ? "ok" : "no data"),
                Token   = token,
                Time    = -1L,
                Nonce   = nonce,
                Code    = (data != null && data.Count != 0) ? 200 : 204
            };

            AddApiResult(MetaData);
            ApiServices.TouchSession(token, nonce);
        }
示例#10
0
        public ApiResult(IList <IDataResult> data, Stopwatch sw = null, string domain = "", string token = "", long nonce = 0, string cookie = "")
        {
            Data = data;

            MetaData = new RequestMetaData
            {
                Domain  = domain,
                Status  = (((data != null && data.Count != 0) && data[0].Success)),
                Message = ((data != null && data.Count != 0) ? data[0].Message : "no data"),
                Token   = token,
                Time    = sw?.Elapsed.TotalMilliseconds ?? -1L,
                Code    = (data != null && data.Count != 0) ? 200 : 204,
                Nonce   = nonce,
                Cookie  = (((data != null && data.Count != 0) && data[0].Success)) ? cookie : ""
            };

            AddApiResult(MetaData);
            ApiServices.TouchSession(token, nonce);
        }
示例#11
0
 internal static void AddRestoreHelper(this RequestMetaData metaData) => metaData.AddHelper(HelperIdentifiers.RestoreHelper);
示例#12
0
 internal static void AddScrollHelper(this RequestMetaData metaData) => metaData.AddHelper(HelperIdentifiers.ScrollHelper);