Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SubscribeRule and SubscribeRulesUpdate #482

Merged
merged 2 commits into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions src/Twilio/Types/SubscribeRule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Twilio.Converters;

/// <summary>
/// Subscribe Rule - A single Subscribe Rule for a Participant
childish-sambino marked this conversation as resolved.
Show resolved Hide resolved
///
/// For more information see:
/// <a href="https://www.twilio.com/docs/video/api/track-subscriptions#specifying-sr">Specifying Subscribe Rules</a>
/// </summary>
namespace Twilio.Types
{
public class SubscribeRule
{
public sealed class TypeEnum : StringEnum
{
private TypeEnum(string value) : base(value) {}

public TypeEnum() {}
public static readonly TypeEnum Include = new TypeEnum("include");
public static readonly TypeEnum Exclude = new TypeEnum("exclude");
}

public sealed class KindEnum : StringEnum
{
private KindEnum(string value) : base(value) {}

public KindEnum() {}

public static readonly KindEnum Audio = new KindEnum("audio");
public static readonly KindEnum Data = new KindEnum("data");
public static readonly KindEnum Video = new KindEnum("video");
}

public sealed class PriorityEnum : StringEnum
{
private PriorityEnum(string value) : base(value) {}

public PriorityEnum() {}

public static readonly PriorityEnum Low = new PriorityEnum("low");
public static readonly PriorityEnum Medium = new PriorityEnum("medium");
public static readonly PriorityEnum High = new PriorityEnum("high");
}

[JsonProperty("type")]
[JsonConverter(typeof(StringEnumConverter))]
public TypeEnum Type { get; private set; }

[JsonProperty("all")]
public bool? All { get; private set; }

[JsonProperty("publisher")]
public string Publisher { get; private set; }

[JsonProperty("track")]
public string Track { get; private set; }

[JsonProperty("kind")]
[JsonConverter(typeof(StringEnumConverter))]
public KindEnum Kind { get; private set; }

[JsonProperty("priority")]
[JsonConverter(typeof(StringEnumConverter))]
public PriorityEnum Priority { get; private set; }

public SubscribeRule (
[JsonProperty("type")]
TypeEnum type,
[JsonProperty("all")]
bool? all,
[JsonProperty("publisher")]
string publisher,
[JsonProperty("track")]
string track,
[JsonProperty("kind")]
KindEnum kind,
[JsonProperty("priority")]
PriorityEnum priority
)
{
Type = type;
All = all;
Publisher = publisher;
Track = track;
Kind = kind;
Priority = priority;
}
}
}
26 changes: 26 additions & 0 deletions src/Twilio/Types/SubscribeRulesUpdate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Twilio.Converters;

/// <summary>
/// Subscribe Rule Update - Used to update the list of Subscribe Rules
///
/// For more information see:
/// <a href="https://www.twilio.com/docs/video/api/track-subscriptions#specifying-sr">Specifying Subscribe Rules</a>
/// </summary>
namespace Twilio.Types
{
public class SubscribeRulesUpdate
{
[JsonProperty("rules")]
public List<SubscribeRule> Rules { get; private set; }

public SubscribeRulesUpdate (
[JsonProperty("rules")]
List<SubscribeRule> rules
)
{
Rules = rules;
}
}
}