Skip to content

Commit

Permalink
Mege Develop (#36)
Browse files Browse the repository at this point in the history
Merge Develop
  • Loading branch information
S3bt3r authored Oct 25, 2018
1 parent 3c18840 commit 4ff6421
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Zammad.Client/GroupClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public Task<IList<Group>> GetGroupListAsync()

public Task<IList<Group>> GetGroupListAsync(int page, int count)
{
return GetAsync<IList<Group>>("/api/v1/groups", $"page={page},per_page={count}");
return GetAsync<IList<Group>>("/api/v1/groups", $"page={page}&per_page={count}");
}

public Task<Group> GetGroupAsync(int id)
Expand Down
2 changes: 1 addition & 1 deletion src/Zammad.Client/OnlineNotificationClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public Task<IList<OnlineNotification>> GetOnlineNotificationListAsync()

public Task<IList<OnlineNotification>> GetOnlineNotificationListAsync(int page, int count)
{
return GetAsync<IList<OnlineNotification>>("/api/v1/online_notifications", $"page={page},per_page={count}");
return GetAsync<IList<OnlineNotification>>("/api/v1/online_notifications", $"page={page}&per_page={count}");
}

public Task<OnlineNotification> GetOnlineNotificationAsync(int id)
Expand Down
2 changes: 1 addition & 1 deletion src/Zammad.Client/OrganizationClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public Task<IList<Organization>> GetOrganizationListAsync()

public Task<IList<Organization>> GetOrganizationListAsync(int page, int count)
{
return GetAsync<IList<Organization>>("/api/v1/organizations", $"page={page},per_page={count}");
return GetAsync<IList<Organization>>("/api/v1/organizations", $"page={page}&per_page={count}");
}

public Task<IList<Organization>> SearchOrganizationAsync(string query, int limit)
Expand Down
12 changes: 12 additions & 0 deletions src/Zammad.Client/Resources/Internal/StringTagList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Zammad.Client.Resources.Internal
{
[JsonObject]
public class StringTagList
{
[JsonProperty("tags")]
public IList<string> Tags { get; set; } = new List<string>();
}
}
2 changes: 1 addition & 1 deletion src/Zammad.Client/Services/ITagService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Zammad.Client.Services
{
public interface ITagService
{
Task<IList<Tag>> GetTagListAsync(string objectName, int objectId);
Task<IList<string>> GetTagListAsync(string objectName, int objectId);
Task<IList<Tag>> SearchTagAsync(string term);
Task<bool> AddTagAsync(string objectName, int objectId, string tagName);
Task<bool> RemoveTagAsync(string objectName, int objectId, string tagName);
Expand Down
4 changes: 2 additions & 2 deletions src/Zammad.Client/TagClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public TagClient(ZammadAccount account)

#region ITagService

public async Task<IList<Tag>> GetTagListAsync(string objectName, int objectId)
public async Task<IList<string>> GetTagListAsync(string objectName, int objectId)
{
var tagList = await GetAsync<TagList>("/api/v1/tags", $"object={objectName}&o_id={objectId}");
var tagList = await GetAsync<StringTagList>("/api/v1/tags", $"object={objectName}&o_id={objectId}");
return tagList.Tags;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Zammad.Client/TicketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Task<IList<Ticket>> GetTicketListAsync()

public Task<IList<Ticket>> GetTicketListAsync(int page, int count)
{
return GetAsync<IList<Ticket>>("/api/v1/tickets", $"page={page},per_page={count}");
return GetAsync<IList<Ticket>>("/api/v1/tickets", $"page={page}&per_page={count}");
}

public Task<IList<Ticket>> SearchTicketAsync(string query, int limit)
Expand Down Expand Up @@ -64,7 +64,7 @@ public Task<IList<TicketArticle>> GetTicketArticleListAsync()

public Task<IList<TicketArticle>> GetTicketArticleListAsync(int page, int count)
{
return GetAsync<IList<TicketArticle>>("/api/v1/ticket_articles", $"page={page},per_page={count}");
return GetAsync<IList<TicketArticle>>("/api/v1/ticket_articles", $"page={page}&per_page={count}");
}

public Task<IList<TicketArticle>> GetTicketArticleListForTicketAsync(int ticketId)
Expand Down Expand Up @@ -98,7 +98,7 @@ public Task<IList<TicketPriority>> GetTicketPriorityListAsync()

public Task<IList<TicketPriority>> GetTicketPriorityListAsync(int page, int count)
{
return GetAsync<IList<TicketPriority>>("/api/v1/ticket_priorities", $"page={page},per_page={count}");
return GetAsync<IList<TicketPriority>>("/api/v1/ticket_priorities", $"page={page}&per_page={count}");
}

public Task<TicketPriority> GetTicketPriorityAsync(int id)
Expand Down Expand Up @@ -132,7 +132,7 @@ public Task<IList<TicketState>> GetTicketStateListAsync()

public Task<IList<TicketState>> GetTicketStateListAsync(int page, int count)
{
return GetAsync<IList<TicketState>>("/api/v1/ticket_states", $"page={page},per_page={count}");
return GetAsync<IList<TicketState>>("/api/v1/ticket_states", $"page={page}&per_page={count}");
}

public Task<TicketState> GetTicketStateAsync(int id)
Expand Down
2 changes: 1 addition & 1 deletion src/Zammad.Client/UserClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Task<IList<User>> GetUserListAsync()

public Task<IList<User>> GetUserListAsync(int page, int count)
{
return GetAsync<IList<User>>("/api/v1/users", $"page={page},per_page={count}");
return GetAsync<IList<User>>("/api/v1/users", $"page={page}&per_page={count}");
}

public Task<IList<User>> SearchUserAsync(string query, int limit)
Expand Down
9 changes: 9 additions & 0 deletions src/Zammad.Client/ZammadAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ public OrganizationClient CreateOrganizationClient()
return new OrganizationClient(this);
}

/// <summary>
/// Initializes a new instance of the <see cref="TagClient"/> class.
/// </summary>
/// <returns>A new instance of the <see cref="TagClient"/> class.</returns>
public TagClient CreateTagClient()
{
return new TagClient(this);
}

/// <summary>
/// Initializes a new instance of the <see cref="TicketClient"/> class.
/// </summary>
Expand Down
19 changes: 19 additions & 0 deletions test/Zammad.Client.IntegrationTests/TagClientTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Threading.Tasks;
using Xunit;

namespace Zammad.Client.IntegrationTests
{
[TestCaseOrderer("Zammad.Client.IntegrationTests.TestOrderer", "Zammad.Client.IntegrationTests")]
public class TagClientTest
{
[Fact, Order(TestOrder.TagGetTagList)]
public async Task Tag_TagGetTagList_Test()
{
var account = TestHelper.CreateTestAccount();
var client = account.CreateTagClient();

var tagList = await client.GetTagListAsync("Ticket", 1);
Assert.NotNull(tagList);
}
}
}
2 changes: 2 additions & 0 deletions test/Zammad.Client.IntegrationTests/TestOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ public class TestOrder

public const int TicketCreate = OrganizationDelete + 1;
public const int TicketSearch = TicketCreate + 1;

public const int TagGetTagList = TicketSearch + 1;
}
}

0 comments on commit 4ff6421

Please sign in to comment.