Files
Chat/ChatController/LoginKlassen/ChatGruppenDaten.cs

188 lines
5.0 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
2020-11-11 14:22:10 +01:00
using System.ComponentModel;
using System.IO;
using Newtonsoft.Json;
2017-09-12 14:32:34 +02:00
2019-04-04 13:00:10 +02:00
namespace ChatController.LoginKlassen
2017-09-12 14:32:34 +02:00
{
/// <summary>
/// Konvertiertes Objekt vom Server mit den Gruppen, Meldungen, Fehlern und ob die Abfragen an den Server erfolgreich war
/// </summary>
2017-09-12 14:32:34 +02:00
public class ChatGruppenDaten
{
[JsonProperty("response")]
public ChatGruppenDatenResponse Response { get; set; }
2017-09-12 14:32:34 +02:00
}
public class GroupInput
{
[JsonProperty("oid")]
public int Oid { get; set; }
[JsonProperty("name")]
2017-09-12 14:32:34 +02:00
public string Name { get; set; }
[JsonProperty("avatar")]
2017-09-12 14:32:34 +02:00
public string Avatar { get; set; }
[JsonProperty("accent_color")]
public string AccentColor { get; set; }
[JsonProperty("mobile")]
2017-09-12 14:32:34 +02:00
public string Mobile { get; set; }
[JsonProperty("lastmessage")]
2019-04-04 13:00:10 +02:00
public GroupLatestMessage LastMessage { get; set; }
[JsonProperty("users")]
2017-09-12 14:32:34 +02:00
public GroupUsers[] Users { get; set; }
[JsonProperty("onlyemployees")]
2019-04-04 13:00:10 +02:00
public bool OnlyEmployees { get; set; }
[JsonProperty("notificationtype")]
public string NotificationType { get; set; }
[JsonProperty("is_read_only")]
public bool IsReadOnly { get; set; }
2020-11-11 14:22:10 +01:00
[DefaultValue(true)]
[JsonProperty("i_can_write", DefaultValueHandling = DefaultValueHandling.Populate)]
public bool CanWrite { get; set; }
[JsonProperty("i_can_see_participants")]
public bool CanSeeParticipants { get; set; }
[JsonProperty("i_can_mute")]
public bool CanMute { get; set; }
[JsonProperty("i_can_delete")]
public bool CanDelete { get; set; }
[JsonProperty("i_can_delete_others")]
public bool CanDeleteOthers { get; set; }
[DefaultValue(0)]
[JsonProperty("unreadmessagecount")]
public int UnreadMessagesCount { get; set; }
2017-09-12 14:32:34 +02:00
}
2019-04-04 13:00:10 +02:00
public class GroupLatestMessage
2017-09-12 14:32:34 +02:00
{
[JsonProperty("id")]
2017-09-12 14:32:34 +02:00
public long Id { get; set; }
private string _Text;
[JsonProperty("text")]
public string Text
{
get
{
var result = _Text;
if (string.IsNullOrEmpty(_Text) && !string.IsNullOrEmpty(File))
{
result = Path.GetFileName(File);
}
if (!string.IsNullOrEmpty(_Text) && _Text.Length > 25)
{
result = _Text.Substring(0, 25) + "...";
}
return result;
}
set => _Text = value;
}
[JsonProperty("file")]
2017-09-12 14:32:34 +02:00
public string File { get; set; }
[JsonProperty("file_protected")]
public string FileProtected { get; set; }
[JsonProperty("original_filename")]
2017-09-12 14:32:34 +02:00
public string OriginalFileName { get; set; }
[JsonProperty("smaller_image")]
2017-09-12 14:32:34 +02:00
public string SmallerImage { get; set; }
[JsonProperty("file_size")]
public long FileSize { get; set; }
[JsonConverter(typeof(TimeStampConverter))]
[JsonProperty("timestamp")]
2017-09-12 14:32:34 +02:00
public LastMessageTimeStamp Timestamp { get; set; }
[JsonProperty("created_at")]
2017-09-12 14:32:34 +02:00
public long CreatedAt { get; set; }
[JsonProperty("deleted_at")]
public long? DeletedAt { get; set; }
[JsonProperty("userid")]
2017-09-12 14:32:34 +02:00
public long UserId { get; set; }
[JsonProperty("userid_manage")]
2017-12-18 18:22:13 +01:00
public string UserIdManage { get; set; }
[JsonProperty("user_name")]
2017-09-12 14:32:34 +02:00
public string UserName { get; set; }
[JsonProperty("user_picture")]
2017-09-12 14:32:34 +02:00
public string UserPicture { get; set; }
[JsonProperty("groupid")]
2017-09-12 14:32:34 +02:00
public string GroupId { get; set; }
}
public class GroupUsers
{
[JsonProperty("oid")]
2017-09-12 14:32:34 +02:00
public long Oid { get; set; }
[JsonProperty("userid_manage")]
2017-12-18 18:22:13 +01:00
public string Userid_Manage { get; set; }
[JsonProperty("firstname")]
2017-09-12 14:32:34 +02:00
public string Firstname { get; set; }
[JsonProperty("lastname")]
2017-09-12 14:32:34 +02:00
public string Lastname { get; set; }
[JsonProperty("mobile")]
2017-09-12 14:32:34 +02:00
public string Mobile { get; set; }
[JsonProperty("picture")]
2017-09-12 14:32:34 +02:00
public string Picture { get; set; }
[JsonProperty("is_employee")]
2017-11-16 15:38:30 +01:00
public bool Is_Employee { get; set; }
[JsonProperty("accent_color")]
public string AccentColor { get; set; }
2017-09-12 14:32:34 +02:00
}
public class LastMessageTimeStamp
{
public string Date { get; set; }
2019-04-04 13:00:10 +02:00
public int TimeZoneType { get; set; }
public string TimeZone { get; set; }
public LastMessageTimeStamp(string date, int timeZoneType, string timeZone)
{
Date = date;
TimeZoneType = timeZoneType;
TimeZone = timeZone;
}
2017-09-12 14:32:34 +02:00
}
public class ChatGruppenDatenResponse
{
[JsonProperty("groups")]
public List<GroupInput> Groups { get; set; }
}
2017-09-12 14:32:34 +02:00
}