/**
* Copyright 2018 The Nakama Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Nakama
{
using System.Runtime.Serialization;
///
/// An acknowledgement from the server when a chat message is delivered to a channel.
///
public interface IChannelMessageAck
{
///
/// The server-assigned channel ID.
///
string ChannelId { get; }
///
/// A user-defined code for the chat message.
///
int Code { get; }
///
/// The UNIX time when the message was created.
///
string CreateTime { get; }
///
/// A unique ID for the chat message.
///
string MessageId { get; }
///
/// True if the chat message has been stored in history.
///
bool Persistent { get; }
///
/// The UNIX time when the message was updated.
///
string UpdateTime { get; }
///
/// The username of the sender of the message.
///
string Username { get; }
}
///
internal class ChannelMessageAck : IChannelMessageAck
{
[DataMember(Name="channel_id")]
public string ChannelId { get; set; }
[DataMember(Name="code")]
public int Code { get; set; }
[DataMember(Name="create_time")]
public string CreateTime { get; set; }
[DataMember(Name="message_id")]
public string MessageId { get; set; }
[DataMember(Name="persistent")]
public bool Persistent { get; set; }
[DataMember(Name="update_time")]
public string UpdateTime { get; set; }
[DataMember(Name="username")]
public string Username { get; set; }
public override string ToString()
{
return $"ChannelMessageAck[ChannelId={ChannelId}, Code={Code}, CreateTime={CreateTime}, MessageId={MessageId}, Persistent={Persistent}, UpdateTime={UpdateTime}, Username={Username}]";
}
}
}