Skip to content
Open
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
26 changes: 26 additions & 0 deletions src/Zammad.Client/Resources/Assets.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Data;
using Newtonsoft.Json;

namespace Zammad.Client.Resources
{
[JsonObject]
public class Assets
{
[JsonProperty("Ticket")]
public Dictionary<string, Ticket> Ticket { get; set; }

[JsonProperty("Group")]
public Dictionary<string, Group> Group { get; set; }

[JsonProperty("User")]
public Dictionary<string, User> User { get; set; }

[JsonProperty("Role")]
public Dictionary<string, Role> Role { get; set; }

[JsonProperty("Organization")]
public Dictionary<string, Organization> Organization { get; set; }
}
}
28 changes: 28 additions & 0 deletions src/Zammad.Client/Resources/Link.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Zammad.Client.Resources
{
public enum LinkType
{
child,
parent
}
public enum LinkObject
{
Ticket
}
[JsonObject]
public class Link
{
[JsonProperty("link_type")]
public string LinkType { get; set; }

[JsonProperty("link_object")]
public string LinkObject { get; set; }

[JsonProperty("link_object_value")]
public int LinkObjectValue { get; set; }
}
}
15 changes: 15 additions & 0 deletions src/Zammad.Client/Resources/Relations.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Zammad.Client.Resources
{
[JsonObject]
public class Relations
{
[JsonProperty("links")]
public List<Link> Links { get; set; }
[JsonProperty("assets")]
public Assets Assets { get; set; }
}
}
59 changes: 59 additions & 0 deletions src/Zammad.Client/Resources/Role.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Data;
using Newtonsoft.Json;

namespace Zammad.Client.Resources
{
[JsonObject]
public class Role
{
[JsonProperty("id")]
public int Id { get; set; }

[JsonProperty("signature_id")]
public int? SignatureId { get; set; }

[JsonProperty("email_address_id")]
public int EmailAddressId { get; set; }

[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("assignment_timeout")]
public int? AssignmentTimeout { get; set; }

[JsonProperty("follow_up_possible")]
public string FollowUpPossible { get; set; }

[JsonProperty("reopen_time_in_days")]
public int? ReopenTimeInDays { get; set; }

[JsonProperty("follow_up_assignment")]
public bool FollowUpAssignment { get; set; }

[JsonProperty("active")]
public bool Active { get; set; }

[JsonProperty("shared_drafts")]
public bool SharedDrafts { get; set; }

[JsonProperty("note")]
public string Note { get; set; }

[JsonProperty("updated_by_id")]
public int UpdatedById { get; set; }

[JsonProperty("create_by_id")]
public int CreatedById { get; set; }

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }

[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }

[JsonProperty("user_ids")]
public List<int> UserIds { get; set; }
}
}
4 changes: 4 additions & 0 deletions src/Zammad.Client/TicketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public Task<IList<Ticket>> GetTicketListAsync(int page, int count)
{
return GetAsync<IList<Ticket>>("/api/v1/tickets", $"page={page}&per_page={count}");
}
public Task<Relations> GetTicketRelations(LinkType linktype, LinkObject link_object,int link_object_value)
{
return GetAsync<Relations>("/api/v1/links", $"link_type={linktype}&link_object={link_object}&link_object_value={link_object_value.ToString()}");
}

public Task<IList<Ticket>> SearchTicketAsync(string query, int limit)
{
Expand Down