-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSamplesPayload.cs
More file actions
41 lines (35 loc) · 1.11 KB
/
Copy pathSamplesPayload.cs
File metadata and controls
41 lines (35 loc) · 1.11 KB
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
using System.Text.Json.Serialization;
namespace InvvardDev.Ifttt.Toolkit;
/// <summary>
/// Class to hold samples payload for IFTTT test setup.
/// </summary>
/// <param name="processorPayload">The processors list with data fields.</param>
public class SamplesPayload(ProcessorPayload processorPayload)
{
public SamplesPayload() : this(new ProcessorPayload())
{
}
public ProcessorPayload Samples { get; } = processorPayload;
/// <summary>
/// Removes empty processors from the payload.
/// </summary>
internal void SkimEmptyProcessors()
{
Samples.Triggers?.RemoveEmptyProcessors();
if (Samples.Triggers?.Count == 0)
{
Samples.Triggers = default;
}
}
}
/// <summary>
/// Record to hold the processors and related data fields for the IFTTT test setup.
/// </summary>
public record ProcessorPayload
{
/// <summary>
/// Gets or sets the triggers and related trigger fields for the IFTTT test setup.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public Processors? Triggers { get; set; }
}