summary refs log tree commit diff
path: root/extra/admin-api/Models/Spacebar.Models.Api/CreateAttachmentRequest.cs
blob: be04cd4e81a9d190ab5a6d17db839543295b2181 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System.Text.Json.Serialization;
using Spacebar.Models.Generic;

namespace Spacebar.Models.Api;

public class CreateAttachmentRequest {
    [JsonPropertyName("files")]
    public required List<Entry> Files { get; set; }

    public class Entry {
        [JsonPropertyName("id"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
        public long? Id { get; set; }

        [JsonPropertyName("filename")]
        public string? FileName { get; set; }

        [JsonPropertyName("file_size")]
        public int FileSize { get; set; }

        [JsonPropertyName("is_clip")]
        public bool? IsClip { get; set; }
    }
}

public class CreateAttachmentResponse {
    [JsonPropertyName("attachments")]
    public required List<Entry> Attachments { get; set; }

    public class Entry {
        [JsonPropertyName("id"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
        public long? Id { get; set; }

        [JsonPropertyName("upload_filename")]
        public string? UploadFileName { get; set; }

        [JsonPropertyName("upload_url")]
        public string UploadUrl { get; set; }

        [JsonPropertyName("original_content_type")]
        public string? OriginalContentType { get; set; }
    }
}

public class AttachmentListResponse {
    [JsonPropertyName("total")]
    public int Total { get; set; }

    [JsonPropertyName("items")]
    public List<Entry> Items { get; set; }

    public class Entry {
        [JsonPropertyName("attachment")]
        public MessageAttachment Attachment { get; set; }

        [JsonPropertyName("message_reference")]
        public MessageReference MessageReference { get; set; }
    }
}