diff --git a/.gitignore b/.gitignore index d3a841a..7586c4b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,4 @@ .settings/ .project .pydevproject - - +.idea/ diff --git a/supportbee/__init__.py b/supportbee/__init__.py index c2f101a..ea53c5f 100644 --- a/supportbee/__init__.py +++ b/supportbee/__init__.py @@ -1,10 +1,13 @@ # -*- coding: utf-8 -*- +import json + +import requests + from supportbee.exceptions import ValidationFailureException, \ UnAuthorizedException, AccessDeniedException, ClientException, \ ServerFailureException, ServerException, SupportBeeException -import requests -import json + class SupportBee(object): BASE_URL = "https://%s.supportbee.com" @@ -80,7 +83,6 @@ def archive_ticket(self, ticket_id): """ return self._request('/tickets/%s/archive.json' % (ticket_id), method='POST') - def unarchive_ticket(self, ticket_id): """ Unarchives the given ticket. Supported parameters are available at https://developers.supportbee.com/api#ticket_actions @@ -106,7 +108,6 @@ def star_ticket(self, ticket_id): """ return self._request('/tickets/%s/star.json' % (ticket_id), method='POST') - def unstar_ticket(self, ticket_id): """ Unstars the given ticket. Supported parameters are available at https://developers.supportbee.com/api#ticket_actions @@ -115,7 +116,6 @@ def unstar_ticket(self, ticket_id): """ return self._request('/tickets/%s/star.json' % (ticket_id), method='DELETE') - def spam_ticket(self, ticket_id): """ Spams the given ticket. Supported parameters are available at https://developers.supportbee.com/api#ticket_actions @@ -124,7 +124,6 @@ def spam_ticket(self, ticket_id): """ return self._request('/tickets/%s/spam.json' % (ticket_id), method='POST') - def unspam_ticket(self, ticket_id): """ Un-spam the given ticket. Supported parameters are available at https://developers.supportbee.com/api#ticket_actions @@ -133,7 +132,6 @@ def unspam_ticket(self, ticket_id): """ return self._request('/tickets/%s/spam.json' % (ticket_id), method='DELETE') - def trash_ticket(self, ticket_id): """ Trashes the given ticket. Supported parameters are available at https://developers.supportbee.com/api#ticket_actions @@ -142,7 +140,6 @@ def trash_ticket(self, ticket_id): """ return self._request('/tickets/%s/trash.json' % (ticket_id), method='POST') - def untrash_ticket(self, ticket_id): """ Un-trashes the given ticket. Supported parameters are available at https://developers.supportbee.com/api#ticket_actions @@ -172,3 +169,12 @@ def show_reply(self, ticket_id, reply_id): """ return self._request('/tickets/%s/replies/%s.json' % (ticket_id, reply_id)) + def add_label_to_ticket(self, ticket_id, label): + """ + Adds the label to the ticket with id ticket_id. + Supported parameters are available at https://developers.supportbee.com/api#adding_label + Params + ticket_id: SuppportBee Ticket ID + label: label name to add + """ + return self._request('/tickets/%s/labels/%s' % (ticket_id, label), method='POST')