188 lines
5.0 KiB
C#
188 lines
5.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.IO;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace ChatController.LoginKlassen
|
|
{
|
|
/// <summary>
|
|
/// Konvertiertes Objekt vom Server mit den Gruppen, Meldungen, Fehlern und ob die Abfragen an den Server erfolgreich war
|
|
/// </summary>
|
|
public class ChatGruppenDaten
|
|
{
|
|
[JsonProperty("response")]
|
|
public ChatGruppenDatenResponse Response { get; set; }
|
|
}
|
|
|
|
public class GroupInput
|
|
{
|
|
[JsonProperty("oid")]
|
|
public int Oid { get; set; }
|
|
|
|
[JsonProperty("name")]
|
|
public string Name { get; set; }
|
|
|
|
[JsonProperty("avatar")]
|
|
public string Avatar { get; set; }
|
|
|
|
[JsonProperty("accent_color")]
|
|
public string AccentColor { get; set; }
|
|
|
|
[JsonProperty("mobile")]
|
|
public string Mobile { get; set; }
|
|
|
|
[JsonProperty("lastmessage")]
|
|
public GroupLatestMessage LastMessage { get; set; }
|
|
|
|
[JsonProperty("users")]
|
|
public GroupUsers[] Users { get; set; }
|
|
|
|
[JsonProperty("onlyemployees")]
|
|
public bool OnlyEmployees { get; set; }
|
|
|
|
[JsonProperty("notificationtype")]
|
|
public string NotificationType { get; set; }
|
|
|
|
[JsonProperty("is_read_only")]
|
|
public bool IsReadOnly { get; set; }
|
|
|
|
[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; }
|
|
}
|
|
|
|
public class GroupLatestMessage
|
|
{
|
|
[JsonProperty("id")]
|
|
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")]
|
|
public string File { get; set; }
|
|
|
|
[JsonProperty("file_protected")]
|
|
public string FileProtected { get; set; }
|
|
|
|
[JsonProperty("original_filename")]
|
|
public string OriginalFileName { get; set; }
|
|
|
|
[JsonProperty("smaller_image")]
|
|
public string SmallerImage { get; set; }
|
|
|
|
[JsonProperty("file_size")]
|
|
public long FileSize { get; set; }
|
|
|
|
[JsonConverter(typeof(TimeStampConverter))]
|
|
[JsonProperty("timestamp")]
|
|
public LastMessageTimeStamp Timestamp { get; set; }
|
|
|
|
[JsonProperty("created_at")]
|
|
public long CreatedAt { get; set; }
|
|
|
|
[JsonProperty("deleted_at")]
|
|
public long? DeletedAt { get; set; }
|
|
|
|
[JsonProperty("userid")]
|
|
public long UserId { get; set; }
|
|
|
|
[JsonProperty("userid_manage")]
|
|
public string UserIdManage { get; set; }
|
|
|
|
[JsonProperty("user_name")]
|
|
public string UserName { get; set; }
|
|
|
|
[JsonProperty("user_picture")]
|
|
public string UserPicture { get; set; }
|
|
|
|
[JsonProperty("groupid")]
|
|
public string GroupId { get; set; }
|
|
}
|
|
|
|
public class GroupUsers
|
|
{
|
|
[JsonProperty("oid")]
|
|
public long Oid { get; set; }
|
|
|
|
[JsonProperty("userid_manage")]
|
|
public string Userid_Manage { get; set; }
|
|
|
|
[JsonProperty("firstname")]
|
|
public string Firstname { get; set; }
|
|
|
|
[JsonProperty("lastname")]
|
|
public string Lastname { get; set; }
|
|
|
|
[JsonProperty("mobile")]
|
|
public string Mobile { get; set; }
|
|
|
|
[JsonProperty("picture")]
|
|
public string Picture { get; set; }
|
|
|
|
[JsonProperty("is_employee")]
|
|
public bool Is_Employee { get; set; }
|
|
|
|
[JsonProperty("accent_color")]
|
|
public string AccentColor { get; set; }
|
|
}
|
|
|
|
public class LastMessageTimeStamp
|
|
{
|
|
public string Date { get; set; }
|
|
public int TimeZoneType { get; set; }
|
|
public string TimeZone { get; set; }
|
|
|
|
public LastMessageTimeStamp(string date, int timeZoneType, string timeZone)
|
|
{
|
|
Date = date;
|
|
TimeZoneType = timeZoneType;
|
|
TimeZone = timeZone;
|
|
}
|
|
}
|
|
|
|
public class ChatGruppenDatenResponse
|
|
{
|
|
[JsonProperty("groups")]
|
|
public List<GroupInput> Groups { get; set; }
|
|
}
|
|
}
|