aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Models/ByteData.cs
blob: a1a0c2384f658bfd90265d313910031179af5f66 (plain)
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
using System;
using NSwag.Annotations;

namespace Timeline.Models
{
    /// <summary>
    /// Model for reading http body as bytes.
    /// </summary>
    [OpenApiFile]
    public class ByteData
    {
        /// <summary>
        /// </summary>
        /// <param name="data">The data.</param>
        /// <param name="contentType">The content type.</param>
        public ByteData(byte[] data, string contentType)
        {
            if (data is null)
                throw new ArgumentNullException(nameof(data));
            if (contentType is null)
                throw new ArgumentNullException(nameof(contentType));

            Data = data;
            ContentType = contentType;
        }

        /// <summary>
        /// Data.
        /// </summary>
#pragma warning disable CA1819 // Properties should not return arrays
        public byte[] Data { get; }
#pragma warning restore CA1819 // Properties should not return arrays

        /// <summary>
        /// Content type.
        /// </summary>
        public string ContentType { get; }
    }
}