Skip to content

Commit

Permalink
Revert "Revert "Expose CompleteContact as its own API on Streams""
Browse files Browse the repository at this point in the history
This reverts commit 5f35c93.
  • Loading branch information
ctwomblyamzn committed Dec 20, 2019
1 parent d926f6e commit 86bd007
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,13 @@
}, callbacks);
};

Contact.prototype.complete = function (callbacks) {
var client = connect.core.getClient();
client.call(connect.ClientMethods.COMPLETE_CONTACT, {
contactId: this.getContactId()
}, callbacks);
};

Contact.prototype.notifyIssue = function (issueCode, description, callbacks) {
var client = connect.core.getClient();
client.call(connect.ClientMethods.NOTIFY_CONTACT_ISSUE, {
Expand Down Expand Up @@ -800,24 +807,12 @@
return this._getData().monitoringInfo;
};


Connection.prototype.destroy = function (callbacks) {
var client = connect.core.getClient();
var contact = new Contact(this.getContactId());
var shouldUseCompleteContact = (
contact.getStatus().type === connect.ContactStateType.ENDED &&
contact.getType() === connect.ContactType.CHAT
);
if (shouldUseCompleteContact) {
client.call(connect.ClientMethods.COMPLETE_CONTACT, {
contactId: this.getContactId()
}, callbacks);
} else {
client.call(connect.ClientMethods.DESTROY_CONNECTION, {
contactId: this.getContactId(),
connectionId: this.getConnectionId()
}, callbacks);
}
client.call(connect.ClientMethods.DESTROY_CONNECTION, {
contactId: this.getContactId(),
connectionId: this.getConnectionId()
}, callbacks);
};

Connection.prototype.sendDigits = function (digits, callbacks) {
Expand Down

0 comments on commit 86bd007

Please sign in to comment.