Skip to content

Commit 682ad6a

Browse files
authored
closed issue #421 (#425)
* closed issue #421 added UserSegmentId to Article added PermissionGroupId to Article * fixed test speed * fix task Delay * set lang version
1 parent 9d2deba commit 682ad6a

File tree

20 files changed

+87
-80
lines changed

20 files changed

+87
-80
lines changed

src/ZendeskApi_v2.Example/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async static Task Main(string[] args)
1212
{
1313
var userEmailToSearchFor = "eneif123@yahoo.com";
1414

15-
var userName = "csharpzendeskapi1234@gmail.com"; // the user that will be logging in the API aka the call center staff
15+
var userName = "csharpzendeskapi1234@gmail.com"; // the user that will be logging in the API aka the call center staff
1616
var userPassword = "&H3n!0q^3OjDLdm";
1717
var companySubDomain = "csharpapi"; // sub-domain for the account with Zendesk
1818
var api = new ZendeskApi(companySubDomain, userName, userPassword);

src/ZendeskApi_v2/Core.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ public async Task<T> GetByPageUrlAsync<T>(string pageUrl, int perPage = 100)
361361
{
362362
return JsonConvert.DeserializeObject<T>("");
363363
}
364-
var test = Regex.Split(pageUrl, "api/v2/");
364+
365+
_ = Regex.Split(pageUrl, "api/v2/");
365366

366367
var resource = Regex.Split(pageUrl, "api/v2/").Last() + (perPage != 0 ? $"&per_page={perPage}" : "");
367368
return await RunRequestAsync<T>(resource, RequestMethod.Get);

src/ZendeskApi_v2/Models/Articles/Article.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,11 @@ public class Article
7070

7171
[JsonProperty("translations")]
7272
public IList<Translation> Translations { get; set; }
73+
74+
[JsonProperty("user_segment_id")]
75+
public long? UserSegmentId { get; set; }
76+
77+
[JsonProperty("permission_group_id")]
78+
public long PermissionGroupId { get; set; }
7379
}
7480
}

src/ZendeskApi_v2/Models/HelpCenter/Subscriptions/ArticleSubscription.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ public class ArticleSubscription : Subscription
1111
[JsonConstructor]
1212
private ArticleSubscription() { }
1313

14-
public ArticleSubscription(string local)
14+
public ArticleSubscription(string locale)
1515
{
16-
SourceLocal = local ?? throw new ArgumentNullException(nameof(local));
16+
SourceLocale = locale ?? throw new ArgumentNullException(nameof(locale));
1717
}
1818

1919
/// <summary>
2020
/// only used when create a new article subscription
2121
/// </summary>
2222
[JsonProperty("source_locale")]
23-
public string SourceLocal { get; }
23+
public string SourceLocale { get; }
2424
}
2525
}

src/ZendeskApi_v2/Models/Sections/Section.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class Section
5151
[JsonProperty("translations")]
5252
public IList<Translation> Translations { get; set; }
5353

54+
[Obsolete("Deprecated please use options on articles \r\n See: https://develop.zendesk.com/hc/en-us/articles/360001954227 ", true)]
5455
[JsonProperty("user_segment_id")]
5556
public long? UserSegmentId { get; set; }
5657
}

src/ZendeskApi_v2/Models/UserSegments/GroupUserSegmentResponse.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
1+
using System.Collections.Generic;
52
using Newtonsoft.Json;
63
using ZendeskApi_v2.Models.HelpCenter.Topics;
74

@@ -10,8 +7,8 @@ namespace ZendeskApi_v2.Models.UserSegments
107
public class GroupUserSegmentResponse : GroupResponseBase
118
{
129
[JsonProperty("user_segments")]
13-
public IList<UserSegment> UserSegments{ get; set; }
14-
10+
public IList<UserSegment> UserSegments { get; set; }
11+
1512
[JsonProperty("sections")]
1613
public IList<Sections.Section> Sections { get; set; }
1714

src/ZendeskApi_v2/Models/UserSegments/UserSegment.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Collections.Generic;
2-
using System.Runtime.Serialization;
32
using Newtonsoft.Json;
43
using Newtonsoft.Json.Converters;
54

@@ -19,7 +18,7 @@ public class UserSegment
1918
[JsonProperty("name")]
2019
public string Name { get; set; }
2120

22-
[JsonConverter(typeof(StringEnumConverter))]
21+
[JsonConverter(typeof(StringEnumConverter))]
2322
[JsonProperty("user_type", DefaultValueHandling = DefaultValueHandling.Include)]
2423
public UserType UserType { get; set; }
2524

@@ -31,5 +30,17 @@ public class UserSegment
3130

3231
[JsonProperty("tags")]
3332
public IList<string> Tags { get; set; }
33+
34+
[JsonProperty("created_at")]
35+
public string CreatedAt { get; set; }
36+
37+
[JsonProperty("updated_at")]
38+
public string UpdatedAt { get; set; }
39+
40+
/// <summary>
41+
/// Whether the user segment is built-in. Built-in user segments cannot be modified
42+
/// </summary>
43+
[JsonProperty("built_in")]
44+
public bool BuiltIn { get; set; }
3445
}
3546
}

src/ZendeskApi_v2/Requests/HelpCenter/Topics.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public bool DeleteSubscription(long topicId, long SubscriptionId)
9292
}
9393
#endif
9494
#if ASYNC
95-
public async Task<GroupTopicResponse> GetTopicsAsync(int? perPage = default(int?), int? page = default(int?))
95+
public async Task<GroupTopicResponse> GetTopicsAsync(int? perPage = default, int? page = default)
9696
{
9797
return await GenericPagedGetAsync<GroupTopicResponse>("community/topics.json", perPage, page);
9898
}

src/ZendeskApi_v2/ZendeskApi_v2.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<IncludeSource>false</IncludeSource>
2424
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2525
<OutputType>Library</OutputType>
26+
<LangVersion>latest</LangVersion>
2627
</PropertyGroup>
2728

2829
<PropertyGroup>

test/ZendeskApi_v2.Test/AccountsAndActivityTests.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,5 @@ public void CanGetSettings()
1414
var res = api.AccountsAndActivity.GetSettings();
1515
Assert.IsNotEmpty(res.Settings.Branding.HeaderColor);
1616
}
17-
18-
[Test]
19-
public void CanGetActivities()
20-
{
21-
//the api returns empty objects and I'm not sure how to get it to populate
22-
var res = api.AccountsAndActivity.GetActivities();
23-
24-
//var res1 = api.AccountsAndActivity.GetActivityById()
25-
26-
}
2717
}
28-
29-
3018
}

0 commit comments

Comments
 (0)