/// <inheritdoc /> /// <summary> /// Enable or disable messages for a user Useful for opt-out options on a single topic. Consider multiple topics for multiple opt-out options. /// </summary> /// <param name="id">The id of the topic</param> /// <param name="userId">The id of the subscriber or 'me'</param> /// <param name="disabled">disabled</param> public void DisableTopicSubscriber(string id, string userId, ValueWrapperboolean disabled) { // verify the required parameter 'id' is set if (id == null) { throw new KnetikException(400, "Missing required parameter 'id' when calling DisableTopicSubscriber"); } // verify the required parameter 'userId' is set if (userId == null) { throw new KnetikException(400, "Missing required parameter 'userId' when calling DisableTopicSubscriber"); } // verify the required parameter 'disabled' is set if (disabled == null) { throw new KnetikException(400, "Missing required parameter 'disabled' when calling DisableTopicSubscriber"); } mWebCallEvent.WebPath = "/messaging/topics/{id}/subscribers/{user_id}/disabled"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id)); mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "user_id" + "}", KnetikClient.ParameterToString(userId)); mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(disabled); // 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 mDisableTopicSubscriberStartTime = DateTime.Now; mWebCallEvent.Context = mDisableTopicSubscriberResponseContext; mWebCallEvent.RequestType = KnetikRequestType.PUT; KnetikLogger.LogRequest(mDisableTopicSubscriberStartTime, "DisableTopicSubscriber", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <inheritdoc /> /// <summary> /// Enable or disable direct notifications for a user Allows enabling or disabling messages for a given notification type when sent direct to the user. Notifications can still be retrieved by endpoint. For notifications broadcased to a topic, see the topic service to disable messages for the user there. /// </summary> /// <param name="typeId">The id of the topic</param> /// <param name="userId">The id of the subscriber or 'me'</param> /// <param name="silenced">silenced</param> public void SilenceDirectNotifications(string typeId, string userId, ValueWrapperboolean silenced) { // verify the required parameter 'typeId' is set if (typeId == null) { throw new KnetikException(400, "Missing required parameter 'typeId' when calling SilenceDirectNotifications"); } // verify the required parameter 'userId' is set if (userId == null) { throw new KnetikException(400, "Missing required parameter 'userId' when calling SilenceDirectNotifications"); } // verify the required parameter 'silenced' is set if (silenced == null) { throw new KnetikException(400, "Missing required parameter 'silenced' when calling SilenceDirectNotifications"); } mWebCallEvent.WebPath = "/users/{user_id}/notifications/types/{type_id}/silenced"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "type_id" + "}", KnetikClient.ParameterToString(typeId)); mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "user_id" + "}", KnetikClient.ParameterToString(userId)); mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(silenced); // 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 mSilenceDirectNotificationsStartTime = DateTime.Now; mWebCallEvent.Context = mSilenceDirectNotificationsResponseContext; mWebCallEvent.RequestType = KnetikRequestType.PUT; KnetikLogger.LogRequest(mSilenceDirectNotificationsStartTime, "SilenceDirectNotifications", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <summary> /// Enable or disable messages for a user Useful for opt-out options on a single topic. Consider multiple topics for multiple opt-out options. <br><br><b>Permissions Needed:</b> TOPICS_ADMIN or self /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The id of the topic</param> /// <param name="userId">The id of the subscriber or 'me'</param> /// <param name="disabled">disabled</param> /// <returns>ApiResponse of Object(void)</returns> public ApiResponse <Object> DisableTopicSubscriberWithHttpInfo(string id, string userId, ValueWrapperboolean disabled) { // verify the required parameter 'id' is set if (id == null) { throw new ApiException(400, "Missing required parameter 'id' when calling Messaging_TopicsApi->DisableTopicSubscriber"); } // verify the required parameter 'userId' is set if (userId == null) { throw new ApiException(400, "Missing required parameter 'userId' when calling Messaging_TopicsApi->DisableTopicSubscriber"); } // verify the required parameter 'disabled' is set if (disabled == null) { throw new ApiException(400, "Missing required parameter 'disabled' when calling Messaging_TopicsApi->DisableTopicSubscriber"); } var localVarPath = "/messaging/topics/{id}/subscribers/{user_id}/disabled"; 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 (id != null) { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } if (userId != null) { localVarPathParams.Add("user_id", Configuration.ApiClient.ParameterToString(userId)); // path parameter } if (disabled != null && disabled.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(disabled); // http body (model) parameter } else { localVarPostBody = disabled; // 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("DisableTopicSubscriber", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <Object>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), null)); }
/// <summary> /// Enable or disable messages for a user Useful for opt-out options on a single topic. Consider multiple topics for multiple opt-out options. <br><br><b>Permissions Needed:</b> TOPICS_ADMIN or self /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The id of the topic</param> /// <param name="userId">The id of the subscriber or 'me'</param> /// <param name="disabled">disabled</param> /// <returns></returns> public void DisableTopicSubscriber(string id, string userId, ValueWrapperboolean disabled) { DisableTopicSubscriberWithHttpInfo(id, userId, disabled); }