/// <inheritdoc /> /// <summary> /// Create a notification type /// </summary> /// <param name="notificationType">notificationType</param> public void CreateNotificationType(NotificationTypeResource notificationType) { mWebCallEvent.WebPath = "/notifications/types"; 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(notificationType); // 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 mCreateNotificationTypeStartTime = DateTime.Now; mWebCallEvent.Context = mCreateNotificationTypeResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mCreateNotificationTypeStartTime, "CreateNotificationType", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
private void OnUpdateNotificationTypeResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling UpdateNotificationType: " + response.Error); } UpdateNotificationTypeData = (NotificationTypeResource)KnetikClient.Deserialize(response.Content, typeof(NotificationTypeResource), response.Headers); KnetikLogger.LogResponse(mUpdateNotificationTypeStartTime, "UpdateNotificationType", string.Format("Response received successfully:\n{0}", UpdateNotificationTypeData)); if (UpdateNotificationTypeComplete != null) { UpdateNotificationTypeComplete(response.ResponseCode, UpdateNotificationTypeData); } }
/// <inheritdoc /> /// <summary> /// Update a notificationType /// </summary> /// <param name="id">id</param> /// <param name="notificationType">notificationType</param> public void UpdateNotificationType(string id, NotificationTypeResource notificationType) { // verify the required parameter 'id' is set if (id == null) { throw new KnetikException(400, "Missing required parameter 'id' when calling UpdateNotificationType"); } mWebCallEvent.WebPath = "/notifications/types/{id}"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id)); mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(notificationType); // 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 mUpdateNotificationTypeStartTime = DateTime.Now; mWebCallEvent.Context = mUpdateNotificationTypeResponseContext; mWebCallEvent.RequestType = KnetikRequestType.PUT; KnetikLogger.LogRequest(mUpdateNotificationTypeStartTime, "UpdateNotificationType", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }