Ejemplo n.º 1
0
        public void UpdateTest()
        {
            string     path     = Constants.AF_TIMERULE_PATH;
            PITimeRule timeRule = instance.GetByPath(path, null);

            timeRule.Name               = null;
            timeRule.Description        = null;
            timeRule.ConfigStringStored = null;
            timeRule.EditorType         = null;
            timeRule.IsConfigured       = null;
            timeRule.IsInitializing     = null;
            timeRule.PlugInName         = null;
            timeRule.DisplayString      = null;
            timeRule.WebId              = null;
            timeRule.Id           = null;
            timeRule.Path         = null;
            timeRule.Links        = null;
            timeRule.ConfigString = "Frequency=400";
            instance.Update(webId, timeRule);
            StandardPISystem.Refresh();
            var newTimeRule = AFObject.FindObject(path) as AFTimeRule;

            if (newTimeRule != null)
            {
                Assert.IsTrue(timeRule.ConfigString == newTimeRule.ConfigString);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Update a Time Rule by replacing items in its definition.
        /// </summary>
        /// <remarks>
        ///
        /// </remarks>
        /// <exception cref="OSIsoft.PIDevClub.PIWebApiClient.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="webId">The ID of the Time Rule.</param>
        /// <param name="timeRule">A partial Time Rule containing the desired changes.</param>
        /// <returns>ApiResponse<Object></returns>
        public ApiResponse <Object> UpdateWithHttpInfo(string webId, PITimeRule timeRule)
        {
            // verify the required parameter 'webId' is set
            if (webId == null)
            {
                throw new ApiException(400, "Missing required parameter 'webId'");
            }
            // verify the required parameter 'timeRule' is set
            if (timeRule == null)
            {
                throw new ApiException(400, "Missing required parameter 'timeRule'");
            }

            var    localVarPath         = "/timerules/{webId}";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new CustomDictionaryForQueryString();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            string localVarPostBody     = null;

            if (webId != null)
            {
                localVarPathParams.Add("webId", Configuration.ApiClient.ParameterToString(webId));
            }
            localVarPostBody = Configuration.ApiClient.Serialize(timeRule);
            IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath,
                                                                                            new HttpMethod("PATCH"), localVarQueryParams, localVarPostBody, localVarHeaderParams,
                                                                                            localVarPathParams);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

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

            return(new ApiResponse <Object>(localVarStatusCode,
                                            localVarResponse.Headers,
                                            (Object)Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Update a Time Rule by replacing items in its definition.
        /// </summary>
        /// <remarks>
        ///
        /// </remarks>
        /// <exception cref="OSIsoft.PIDevClub.PIWebApiClient.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="webId">The ID of the Time Rule.</param>
        /// <param name="timeRule">A partial Time Rule containing the desired changes.</param>
        /// <param name="cancellationTokenSource">Signals to a CancellationToken that might be cancelled</param>
        /// <returns>async System.Threading.Tasks.Task<Object></returns>
        public async System.Threading.Tasks.Task <Object> UpdateAsync(string webId, PITimeRule timeRule, CancellationToken cancellationToken = default(CancellationToken))
        {
            ApiResponse <Object> localVarResponse = await UpdateAsyncWithHttpInfo(webId, timeRule, cancellationToken);

            return(localVarResponse.Data);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Update a Time Rule by replacing items in its definition.
        /// </summary>
        /// <remarks>
        ///
        /// </remarks>
        /// <exception cref="OSIsoft.PIDevClub.PIWebApiClient.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="webId">The ID of the Time Rule.</param>
        /// <param name="timeRule">A partial Time Rule containing the desired changes.</param>
        /// <returns>Object</returns>
        public Object Update(string webId, PITimeRule timeRule)
        {
            ApiResponse <Object> localVarResponse = UpdateWithHttpInfo(webId, timeRule);

            return(localVarResponse.Data);
        }
Ejemplo n.º 5
0
 public ApiResponsePITimeRule(int statusCode, IDictionary <string, string> headers, PITimeRule data)
     : base(statusCode, headers)
 {
     this.Data = data;
 }
Ejemplo n.º 6
0
        /// <summary>Update a Time Rule by replacing items in its definition.</summary>
        public ApiResponseObject UpdateWithHttpInfo(string webId, PITimeRule timeRule)
        {
            if (string.IsNullOrEmpty(webId) == true)
            {
                webId = null;
            }
            if (webId == null)
            {
                throw new ApiException(400, "Missing required parameter 'webId'");
            }
            if (timeRule == null)
            {
                throw new ApiException(400, "Missing required parameter 'timeRule'");
            }

            var    localVarPath         = "/timerules/{webId}";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new CustomDictionaryForQueryString();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            String[] localVarHttpContentTypes = new String[] { };
            String   localVarHttpContentType  = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            String[] localVarHttpHeaderAccepts = new String[] { "application/json", "text/json", "text/xml" };
            String   localVarHttpHeaderAccept  = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

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

            localVarPathParams.Add("format", "json");

            if (webId != null)
            {
                localVarPathParams.Add("webId", Configuration.ApiClient.ParameterToString(webId));
            }
            if (timeRule != null && timeRule.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(timeRule);
            }
            else
            {
                localVarPostBody = timeRule;
            }

            IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath,
                                                                                            Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

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

            return(new ApiResponseObject(localVarStatusCode,
                                         localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                         (Object)Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))));
        }