Skip to content

Commit

Permalink
Merge 9a04db2 into a93b283
Browse files Browse the repository at this point in the history
  • Loading branch information
Lsdenis authored Jun 8, 2018
2 parents a93b283 + 9a04db2 commit aaf20ef
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/ZendeskApi_v2/Requests/HelpCenter/Categories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public class Categories : Core, ICategories
{
private string Locale { get; set; }

private string CategoriesPath => string.IsNullOrEmpty(Locale)
? "help_center/categories.json"
: $"help_center/{Locale}/categories.json";

public Categories(string yourZendeskUrl, string user, string password, string apiToken, string locale, string p_OAuthToken)
: base(yourZendeskUrl, user, password, apiToken, p_OAuthToken)
{
Expand All @@ -39,7 +43,7 @@ public Categories(string yourZendeskUrl, string user, string password, string ap
#if SYNC
public GroupCategoryResponse GetCategories()
{
return GenericGet<GroupCategoryResponse>("help_center/categories.json");
return GenericGet<GroupCategoryResponse>(CategoriesPath);
}

public IndividualCategoryResponse GetCategoryById(long id)
Expand All @@ -56,7 +60,7 @@ public IndividualCategoryResponse CreateCategory(Category category)

var body = new { category };

return GenericPost<IndividualCategoryResponse>("help_center/categories.json", body);
return GenericPost<IndividualCategoryResponse>(CategoriesPath, body);
}

public IndividualCategoryResponse UpdateCategory(Category category)
Expand All @@ -74,7 +78,7 @@ public bool DeleteCategory(long id)
#if ASYNC
public async Task<GroupCategoryResponse> GetCategoriesAsync()
{
return await GenericGetAsync<GroupCategoryResponse>("help_center/categories.json");
return await GenericGetAsync<GroupCategoryResponse>(CategoriesPath);
}

public async Task<IndividualCategoryResponse> GetCategoryByIdAsync(long id)
Expand All @@ -85,7 +89,7 @@ public async Task<IndividualCategoryResponse> GetCategoryByIdAsync(long id)
public async Task<IndividualCategoryResponse> CreateCategoryAsync(Category category)
{
var body = new { category };
return await GenericPostAsync<IndividualCategoryResponse>(string.Format("help_center/categories.json"), body);
return await GenericPostAsync<IndividualCategoryResponse>(CategoriesPath, body);
}

public async Task<IndividualCategoryResponse> UpdateCategoryAsync(Category category)
Expand Down

0 comments on commit aaf20ef

Please sign in to comment.