Code Monkey home page Code Monkey logo

zendeskapiclient's Introduction

Zendesk Api Client

NuGet Version NuGet Downloads AppVeyor Build Status Gitter

A .netstandard NuGet package for use with the Zendesk v2 API.

Breaking Changes

3.x.x

This is a complete rewrite so expect breaking changes.

Some noteworthy changes include:

  • PostAsync replaced with CreateAsync
  • PutAsync replaced with UpdateAsync
  • Search resource now uses SearchAsync instead of Find, and introduces a new fluent api to replace the old ZendeskQuery<T> class.

Creating a client

To register this in your DI, you just need to call...

services.AddZendeskClient("https://[your_url].zendesk.com", "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 = "https://[your_url].zendesk.com",
   Username = "username"
   Token = "token"
};

var loggerFactory = new LoggerFactory();
var zendeskOptionsWrapper = new OptionsWrapper<ZendeskOptions>(zendeskOptions);
var client = new ZendeskClient(new ZendeskApiClient(zendeskOptionsWrapper), loggerFactory.CreateLogger<ZendeskClient>());

Example methods

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);

Searching and filtering

await client.Search.SearchAsync<User>(q => 
    q.WithFilter("email", "[email protected]")
);

await client.Search.SearchAsync<Organization>(q => 
    q.WithFilter("name", "Cupcake Cafe")
);

// All non closed tickets
await client.Search.SearchAsync<Ticket>(q => 
    q.WithFilter("status", "closed", FilterOperator.LessThan)
);

The Zendesk API

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

Integration Tests

In order to run integration tests against your own zendesk instance use the Cake script provided by:

.\build.ps1 -Target "Run-Integration-Tests" -ScriptArgs '-zendeskUrl="<your zendesk url>"', '-zendeskUsername="<your zendesk username>"', '-zendeskToken="<your zendesk token>"'

Contributing

We are happy for anyone to contribute into this client, and help us evolve it over time.

Versioning

We aim to follow Semantic Versioning guidelines within this library. When increasing the version there are multiple places that will need to be changed:

zendeskapiclient's People

Contributors

jetski5822 avatar jonathanstowell avatar stormsys avatar katewritescode avatar cjsaurusrex avatar corneliuskopp avatar ulianashym avatar kbrimble avatar gareththackeray-je avatar andrewchaa avatar tobbentm avatar omar avatar acolom avatar comara avatar eduardtruuvaart avatar carlospuk avatar brainmurphy avatar bmartin5692 avatar vanvector avatar hampzter avatar cserkaran avatar kevsully5 avatar martincostello avatar withinfocus avatar nicholi avatar ilikepies avatar davemarsland avatar je-ewan avatar slang25 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.