示例#1
0
        /// <summary>
        /// Notifies the user that a Delete Message request was successful.
        /// </summary>
        ///
        /// <param name="serverResponse">A container for information on the response from the server. Only
        /// successful responses can be passed into this method.</param>
        /// <param name="request"> The request that was sent to the server.</param>
        /// <param name="callback">The success callback.</param>
        private void NotifyDeleteMessageSuccess(ServerResponse serverResponse, DeleteMessageRequest request, Action <DeleteMessageRequest> successCallback)
        {
            ReleaseAssert.IsTrue(serverResponse.Result == HttpResult.Success && serverResponse.HttpResponseCode == SuccessHttpResponseCode, "Input server request must describe a success.");

            m_logging.LogVerboseMessage("DeleteMessage request succeeded.");

            m_taskScheduler.ScheduleMainThreadTask(() =>
            {
                successCallback(request);
            });
        }
示例#2
0
        /// <summary>
        /// Deletes a message. Direct access to this method from the SDKs is disabled by
        /// default and must be enabled from the ChilliConnect dashboard.
        /// </summary>
        ///
        /// <param name="messageId">An identifier for the message.</param>
        /// <param name="successCallback">The delegate which is called if the request was successful.</param>
        /// <param name="errorCallback">The delegate which is called if the request was unsuccessful. Provides
        /// a container with information on what went wrong.</param>
        public void DeleteMessage(string messageId, Action <DeleteMessageRequest> successCallback, Action <DeleteMessageRequest, DeleteMessageError> errorCallback)
        {
            m_logging.LogVerboseMessage("Sending Delete Message request.");

            var connectAccessToken = m_dataStore.GetString("UserAccessToken");
            var request            = new DeleteMessageRequest(messageId, connectAccessToken);

            m_serverRequestSystem.SendImmediateRequest(request, (IImmediateServerRequest sentRequest, ServerResponse serverResponse) =>
            {
                ReleaseAssert.IsTrue(request == sentRequest, "Received request is not the same as the one sent!");

                if (serverResponse.Result == HttpResult.Success && serverResponse.HttpResponseCode == SuccessHttpResponseCode)
                {
                    NotifyDeleteMessageSuccess(serverResponse, request, successCallback);
                }
                else
                {
                    NotifyDeleteMessageError(serverResponse, request, errorCallback);
                }
            });
        }