コード例 #1
0
        /// <inheritdoc />
        /// <summary>
        /// Create a trigger Customer added triggers will not be fired automatically or have rules associated with them by default. Custom rules must be added to get use from the trigger and it must then be fired from the outside. See the Bre Event services. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; BRE_RULE_ENGINE_TRIGGERS_ADMIN
        /// </summary>
        /// <param name="breTriggerResource">The BRE trigger resource object</param>
        public void CreateBRETrigger(BreTriggerResource breTriggerResource)
        {
            mWebCallEvent.WebPath = "/bre/triggers";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            mWebCallEvent.PostBody = KnetikClient.Serialize(breTriggerResource); // http body (model) parameter

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mCreateBRETriggerStartTime = DateTime.Now;
            mWebCallEvent.Context      = mCreateBRETriggerResponseContext;
            mWebCallEvent.RequestType  = KnetikRequestType.POST;

            KnetikLogger.LogRequest(mCreateBRETriggerStartTime, "CreateBRETrigger", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
コード例 #2
0
        private void OnUpdateBRETriggerResponse(KnetikRestResponse response)
        {
            if (!string.IsNullOrEmpty(response.Error))
            {
                throw new KnetikException("Error calling UpdateBRETrigger: " + response.Error);
            }

            UpdateBRETriggerData = (BreTriggerResource)KnetikClient.Deserialize(response.Content, typeof(BreTriggerResource), response.Headers);
            KnetikLogger.LogResponse(mUpdateBRETriggerStartTime, "UpdateBRETrigger", string.Format("Response received successfully:\n{0}", UpdateBRETriggerData));

            if (UpdateBRETriggerComplete != null)
            {
                UpdateBRETriggerComplete(response.ResponseCode, UpdateBRETriggerData);
            }
        }
コード例 #3
0
        /// <inheritdoc />
        /// <summary>
        /// Update a trigger May fail if new parameters mismatch requirements of existing rules. Cannot update core triggers. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; BRE_RULE_ENGINE_TRIGGERS_ADMIN
        /// </summary>
        /// <param name="eventName">The trigger event name</param>
        /// <param name="breTriggerResource">The BRE trigger resource object</param>
        public void UpdateBRETrigger(string eventName, BreTriggerResource breTriggerResource)
        {
            // verify the required parameter 'eventName' is set
            if (eventName == null)
            {
                throw new KnetikException(400, "Missing required parameter 'eventName' when calling UpdateBRETrigger");
            }

            mWebCallEvent.WebPath = "/bre/triggers/{event_name}";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "event_name" + "}", KnetikClient.ParameterToString(eventName));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            mWebCallEvent.PostBody = KnetikClient.Serialize(breTriggerResource); // http body (model) parameter

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mUpdateBRETriggerStartTime = DateTime.Now;
            mWebCallEvent.Context      = mUpdateBRETriggerResponseContext;
            mWebCallEvent.RequestType  = KnetikRequestType.PUT;

            KnetikLogger.LogRequest(mUpdateBRETriggerStartTime, "UpdateBRETrigger", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
コード例 #4
0
        /// <summary>
        /// Update a trigger May fail if new parameters mismatch requirements of existing rules. Cannot update core triggers. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; BRE_RULE_ENGINE_TRIGGERS_ADMIN
        /// </summary>
        /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="eventName">The trigger event name</param>
        /// <param name="breTriggerResource">The BRE trigger resource object (optional)</param>
        /// <returns>ApiResponse of BreTriggerResource</returns>
        public ApiResponse <BreTriggerResource> UpdateBRETriggerWithHttpInfo(string eventName, BreTriggerResource breTriggerResource = null)
        {
            // verify the required parameter 'eventName' is set
            if (eventName == null)
            {
                throw new ApiException(400, "Missing required parameter 'eventName' when calling Rule_Engine_TriggersApi->UpdateBRETrigger");
            }

            var    localVarPath         = "/bre/triggers/{event_name}";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (eventName != null)
            {
                localVarPathParams.Add("event_name", Configuration.ApiClient.ParameterToString(eventName));                    // path parameter
            }
            if (breTriggerResource != null && breTriggerResource.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(breTriggerResource); // http body (model) parameter
            }
            else
            {
                localVarPostBody = breTriggerResource; // byte array
            }

            // authentication (oauth2_client_credentials_grant) required
            // oauth required
            if (!String.IsNullOrEmpty(Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken;
            }
            // authentication (oauth2_password_grant) required
            // oauth required
            if (!String.IsNullOrEmpty(Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken;
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath,
                                                                                            Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("UpdateBRETrigger", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <BreTriggerResource>(localVarStatusCode,
                                                        localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                        (BreTriggerResource)Configuration.ApiClient.Deserialize(localVarResponse, typeof(BreTriggerResource))));
        }
コード例 #5
0
        /// <summary>
        /// Update a trigger May fail if new parameters mismatch requirements of existing rules. Cannot update core triggers. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; BRE_RULE_ENGINE_TRIGGERS_ADMIN
        /// </summary>
        /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="eventName">The trigger event name</param>
        /// <param name="breTriggerResource">The BRE trigger resource object (optional)</param>
        /// <returns>BreTriggerResource</returns>
        public BreTriggerResource UpdateBRETrigger(string eventName, BreTriggerResource breTriggerResource = null)
        {
            ApiResponse <BreTriggerResource> localVarResponse = UpdateBRETriggerWithHttpInfo(eventName, breTriggerResource);

            return(localVarResponse.Data);
        }
コード例 #6
0
        /// <summary>
        /// Create a trigger Customer added triggers will not be fired automatically or have rules associated with them by default. Custom rules must be added to get use from the trigger and it must then be fired from the outside. See the Bre Event services. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; BRE_RULE_ENGINE_TRIGGERS_ADMIN
        /// </summary>
        /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="breTriggerResource">The BRE trigger resource object (optional)</param>
        /// <returns>BreTriggerResource</returns>
        public BreTriggerResource CreateBRETrigger(BreTriggerResource breTriggerResource = null)
        {
            ApiResponse <BreTriggerResource> localVarResponse = CreateBRETriggerWithHttpInfo(breTriggerResource);

            return(localVarResponse.Data);
        }