public bool TryInit(ApiStatus apiStatus = null)
        {
            int result = NativeMethods.LiveModelInit(this.DangerousGetHandle(), apiStatus.ToNativeHandleOrNullptrDangerous());

            GC.KeepAlive(this);
            return(result == NativeMethods.SuccessStatus);
        }
        public bool TryRefreshModel(ApiStatus apiStatus = null)
        {
            int result = NativeMethods.LiveModelRefreshModel(this.DangerousGetHandle(), apiStatus.ToNativeHandleOrNullptrDangerous());

            return(result == NativeMethods.SuccessStatus);
        }
        public bool TryQueueOutcomeEvent(string eventId, string outcomeJson, ApiStatus apiStatus = null)
        {
            int result = LiveModelReportOutcomeJson(this.DangerousGetHandle(), eventId, outcomeJson, apiStatus.ToNativeHandleOrNullptrDangerous());

            GC.KeepAlive(this);
            return(result == NativeMethods.SuccessStatus);
        }
        public bool TryQueueActionTakenEvent(string eventId, ApiStatus apiStatus = null)
        {
            int result = LiveModelReportActionTaken(this.DangerousGetHandle(), eventId, apiStatus.ToNativeHandleOrNullptrDangerous());

            GC.KeepAlive(this);
            return(result == NativeMethods.SuccessStatus);
        }
        public bool TryRequestDecision(string contextJson, ActionFlags flags, DecisionResponse response, ApiStatus apiStatus)
        {
            int result = LiveModelRequestDecisionWithFlags(this.DangerousGetHandle(), contextJson, (uint)flags, response.DangerousGetHandle(), apiStatus.ToNativeHandleOrNullptrDangerous());

            return(result == NativeMethods.SuccessStatus);
        }
        public bool TryRequestDecision(string contextJson, DecisionResponse response, ApiStatus apiStatus = null)
        {
            int result = LiveModelRequestDecision(this.DangerousGetHandle(), contextJson, response.DangerousGetHandle(), apiStatus.ToNativeHandleOrNullptrDangerous());

            GC.KeepAlive(this);
            return(result == NativeMethods.SuccessStatus);
        }
        public bool TryChooseRank(string eventId, string contextJson, ActionFlags flags, RankingResponse response, ApiStatus apiStatus = null)
        {
            int result = LiveModelChooseRankWithFlags(this.DangerousGetHandle(), eventId, contextJson, (uint)flags, response.DangerousGetHandle(), apiStatus.ToNativeHandleOrNullptrDangerous());

            GC.KeepAlive(this);
            return(result == NativeMethods.SuccessStatus);
        }
Beispiel #8
0
        public static bool TryLoadConfigurationFromJson(string json, out Configuration config, ApiStatus apiStatus = null)
        {
            config = new Configuration();

            int result = LoadConfigurationFromJson(json, config.DangerousGetHandle(), apiStatus.ToNativeHandleOrNullptrDangerous());

            return(result == NativeMethods.SuccessStatus);
        }
Beispiel #9
0
        // TODO: Why does this method call, which seems like a "get" of a value, have an API status?
        public bool TryGetChosenAction(out long actionIndex, ApiStatus status = null)
        {
            actionIndex = -1;
            UIntPtr chosenAction;
            int     result = NativeMethods.GetSlotChosenAction(this.DangerousGetHandle(), out chosenAction, status.ToNativeHandleOrNullptrDangerous());

            bool success = (result == NativeMethods.SuccessStatus);

            if (success)
            {
                actionIndex = (long)(chosenAction.ToUInt64());
            }

            GC.KeepAlive(this);
            return(success);
        }