A .netstandard NuGet package for use with the Zendesk v2 API.
This is a complete rewrite so expect breaking changes.
Some noteworthy changes include:
PostAsync
replaced withCreateAsync
PutAsync
replaced withUpdateAsync
Search
resource now usesSearchAsync
instead ofFind
, and introduces a new fluent api to replace the oldZendeskQuery<T>
class.
To register this in your DI, you just need to call...
services.AddZendeskClient("enpointurl", "username", "token");
then you can inject in IZendeskClient anywhere you want to use it. Here you can access all the resources available.
If however you want to use the client in a DI less environment you can do this
var zendeskOptions = new ZendeskOptions
{
EndpointUri = "endpoint",
Username = "username"
Token = "token"
};
var loggerFactory = new LoggerFactory();
var zendeskOptionsWrapper = new OptionsWrapper<ZendeskOptions>(zendeskOptions);
var client = new ZendeskClient(new ZendeskApiClient(zendeskOptionsWrapper), loggerFactory.CreateLogger<ZendeskClient>());
var ticket = await client.Tickets.GetAsync(1234L); // Get ticket by Id
var tickets = await client.Tickets.GetAllAsync(new [] { 1234L, 4321L }); //
var ticket = await client.Tickets.UpdateAsync(ticket);
var ticket = await client.Tickets.CreateAsync(ticket);
await client.Tickets.DeleteAsync(1234L);
await client.Search.SearchAsync<User>(q =>
q.WithFilter("email", "jazzy.b@just-eat.com")
);
await client.Search.SearchAsync<Organization>(q =>
q.WithFilter("name", "Cupcake Cafe")
);
The zendesk api documentation is available at http://developer.zendesk.com/documentation/rest_api/introduction.html Querying and searching is limited by the searchable fields on the zendesk api