Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Commit ce53b9e

Browse files
author
Tommy Lacroix
committed
Added support for tickets endpoint
1 parent 5e25482 commit ce53b9e

3 files changed

Lines changed: 70 additions & 2 deletions

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,24 @@ Shows the number of reached goals.
202202

203203
Returns current LiveChat status.
204204

205+
### Tickets
206+
207+
#### api.tickets.list(parameters, callback)
208+
209+
Returns all tickets.
210+
211+
#### api.tickets.get(id, parameters, callback)
212+
213+
Returns single ticket item for the given `id`.
214+
215+
#### api.tickets.create(parameters, callback)
216+
217+
Create a ticket.
218+
219+
#### api.tickets.tags(id, parameters, callback)
220+
221+
Update tags of a single ticket item for the given `id`.
222+
205223
### Visitors
206224

207225
### api.visitors.list(callback)

lib/api.js

100755100644
Lines changed: 35 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api.coffee

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,22 @@ class PushPages extends BasicCrud
338338
constructor: (@api) ->
339339
super @api, 'push_pages'
340340

341+
class Tickets extends BasicCrud
342+
constructor: (@api) ->
343+
super @api, 'tickets'
344+
345+
delete @.update
346+
delete @.delete
347+
348+
tags: (id, params = {}, callback) =>
349+
if typeof params == 'function' and !callback?
350+
callback = params
351+
params = {}
352+
353+
@api.put 'tickets/' + id + '/tags', params, (response) =>
354+
if callback?
355+
callback response
356+
341357
class TrackingCode
342358
constructor: (@api) ->
343359
@path = 'tracking_code'
@@ -367,6 +383,7 @@ class LiveChatApi extends Requester
367383
@groups = new Groups(@) # 2
368384
@reports = new Reports(@) # @ 2
369385
@greetings = new Greetings(@) # 2
386+
@tickets = new Tickets(@) # 2
370387
else if @apiVersion == 1
371388
@operators = new Operators(@) # 1
372389
@offline_messages = new OfflineMessages(@) # 1

0 commit comments

Comments
 (0)