From ba0bd14e95c38129702a136e4fa458693c3755b4 Mon Sep 17 00:00:00 2001 From: Chyi Pin Lim Date: Thu, 9 Jun 2016 14:55:26 -0700 Subject: [PATCH] Add Greetings API --- lib/api.js | 15 ++++++++++++++- package.json | 2 +- src/api.coffee | 5 +++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/api.js b/lib/api.js index 87454ce..74b1694 100755 --- a/lib/api.js +++ b/lib/api.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 1.10.0 -var Agents, BasicCrud, ButtonCode, CannedResponses, Chats, Goals, Groups, LiveChatApi, OfflineMessages, Operators, PushPages, Reports, ReportsV1, Requester, Skills, Status, TrackingCode, Visitors, crypto, request, +var Agents, BasicCrud, ButtonCode, CannedResponses, Chats, Goals, Greetings, Groups, LiveChatApi, OfflineMessages, Operators, PushPages, Reports, ReportsV1, Requester, Skills, Status, TrackingCode, Visitors, crypto, request, bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; @@ -381,6 +381,18 @@ Goals = (function(superClass) { })(BasicCrud); +Greetings = (function(superClass) { + extend(Greetings, superClass); + + function Greetings(api) { + this.api = api; + Greetings.__super__.constructor.call(this, this.api, 'greetings'); + } + + return Greetings; + +})(BasicCrud); + Groups = (function(superClass) { extend(Groups, superClass); @@ -803,6 +815,7 @@ LiveChatApi = (function(superClass) { this.agents = new Agents(this); this.groups = new Groups(this); this.reports = new Reports(this); + this.greetings = new Greetings(this); } else if (this.apiVersion === 1) { this.operators = new Operators(this); this.offline_messages = new OfflineMessages(this); diff --git a/package.json b/package.json index 5416292..837c3f2 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ ], "name": "livechatapi", "description": "Livechat.com API Wrapper", - "version": "0.4.1", + "version": "0.5.0", "repository": { "url": "" }, diff --git a/src/api.coffee b/src/api.coffee index d28567a..a0aaa3e 100755 --- a/src/api.coffee +++ b/src/api.coffee @@ -161,6 +161,10 @@ class Goals extends BasicCrud if callback? callback response +class Greetings extends BasicCrud + constructor: (@api) -> + super @api, 'greetings' + class Groups extends BasicCrud constructor: (@api) -> super @api, 'groups' @@ -362,6 +366,7 @@ class LiveChatApi extends Requester @agents = new Agents(@) # 2 @groups = new Groups(@) # 2 @reports = new Reports(@) # @ 2 + @greetings = new Greetings(@) # 2 else if @apiVersion == 1 @operators = new Operators(@) # 1 @offline_messages = new OfflineMessages(@) # 1