Skip to content

Commit ea9fb21

Browse files
cgray4263mozts2005
authored andcommitted
Adding support for automations and ticketform conditions (#440)
* Add model for Automations. Bring TicketForms model up to date with online API docs (adds branding items, conditional fields, and raw names). * Remove 'raw' properties from TicketForm, Add Automation unit tests. * Adding SharedPhoneNumber to User model add fix for #441
1 parent 0da0e24 commit ea9fb21

File tree

13 files changed

+363
-0
lines changed

13 files changed

+363
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
5+
namespace ZendeskApi_v2.Models.Automations
6+
{
7+
public class Action
8+
{
9+
[JsonProperty("field")]
10+
public string Field { get; set; }
11+
12+
[JsonProperty("value")]
13+
public object Value { get; set; }
14+
}
15+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
5+
namespace ZendeskApi_v2.Models.Automations
6+
{
7+
public class All
8+
{
9+
[JsonProperty("field")]
10+
public string Field { get; set; }
11+
12+
[JsonProperty("operator")]
13+
public string Operator { get; set; }
14+
15+
[JsonProperty("value")]
16+
public string Value { get; set; }
17+
}
18+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
using Newtonsoft.Json.Converters;
5+
6+
namespace ZendeskApi_v2.Models.Automations
7+
{
8+
public class Automation
9+
{
10+
[JsonProperty("url")]
11+
public string Url { get; set; }
12+
13+
[JsonProperty("id")]
14+
public long? Id { get; set; }
15+
16+
[JsonProperty("title")]
17+
public string Title { get; set; }
18+
19+
[JsonProperty("active")]
20+
public bool Active { get; set; }
21+
22+
[JsonProperty("position")]
23+
public long? Position { get; set; }
24+
25+
[JsonProperty("updated_at")]
26+
[JsonConverter(typeof(IsoDateTimeConverter))]
27+
public DateTimeOffset? UpdatedAt { get; set; }
28+
29+
[JsonProperty("created_at")]
30+
[JsonConverter(typeof(IsoDateTimeConverter))]
31+
public DateTimeOffset? CreatedAt { get; set; }
32+
33+
[JsonProperty("actions")]
34+
public IList<Action> Actions { get; set; }
35+
36+
[JsonProperty("conditions")]
37+
public Conditions Conditions { get; set; }
38+
39+
[JsonProperty("raw_title")]
40+
public string RawTitle { get; set; }
41+
}
42+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
5+
namespace ZendeskApi_v2.Models.Automations
6+
{
7+
public class Conditions
8+
{
9+
[JsonProperty("all")]
10+
public IList<All> All { get; set; }
11+
12+
[JsonProperty("any")]
13+
public IList<All> Any { get; set; }
14+
}
15+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
5+
namespace ZendeskApi_v2.Models.Automations
6+
{
7+
public class GroupAutomationResponse : GroupResponseBase
8+
{
9+
[JsonProperty("automations")]
10+
public IList<Automation> Automations { get; set; }
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
5+
namespace ZendeskApi_v2.Models.Automations
6+
{
7+
public class IndividualAutomationResponse
8+
{
9+
[JsonProperty("automation")]
10+
public Automation Automation { get; set; }
11+
}
12+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
using Newtonsoft.Json.Converters;
5+
6+
namespace ZendeskApi_v2.Models.Tickets
7+
{
8+
public class ChildField
9+
{
10+
[JsonProperty("id")]
11+
public long? Id { get; set; }
12+
13+
[JsonProperty("is_required")]
14+
public bool IsRequired { get; set; }
15+
}
16+
}

src/ZendeskApi_v2/Models/Tickets/TicketForm.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ public class TicketForm
3535
[JsonProperty("default")]
3636
public bool Default { get; set; }
3737

38+
[JsonProperty("in_all_brands")]
39+
public bool InAllBrands { get; set; }
40+
41+
[JsonProperty("restricted_brand_ids")]
42+
public IList<long> RestrictedBrandIds { get; set; }
43+
44+
[JsonProperty("agent_conditions")]
45+
public IList<TicketFormCondition> AgentConditions { get; set; }
46+
47+
[JsonProperty("end_user_conditions")]
48+
public IList<TicketFormCondition> EndUserConditions { get; set; }
49+
3850
[JsonProperty("created_at")]
3951
[JsonConverter(typeof(IsoDateTimeConverter))]
4052
public DateTimeOffset? CreatedAt { get; set; }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
using Newtonsoft.Json.Converters;
5+
6+
namespace ZendeskApi_v2.Models.Tickets
7+
{
8+
public class TicketFormCondition
9+
{
10+
[JsonProperty("parent_field_id")]
11+
public long? ParentFieldId { get; set; }
12+
13+
[JsonProperty("value")]
14+
public string Value { get; set; }
15+
16+
[JsonProperty("child_fields")]
17+
public IList<ChildField> ChildFields { get; set; }
18+
}
19+
}

src/ZendeskApi_v2/Models/Users/User.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ public class User : IndividualSearchableResponseBase
4141
[JsonProperty("phone")]
4242
public string Phone { get; set; }
4343

44+
[JsonProperty("shared_phone_number")]
45+
public bool? SharedPhoneNumber { get; set; }
46+
4447
[JsonProperty("signature")]
4548
public string Signature { get; set; }
4649

0 commit comments

Comments
 (0)