8000 restapi support for queues, untested · thinkingserious/twilio-python@5805181 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5805181

Browse files
committed
restapi support for queues, untested
1 parent 2e5f51c commit 5805181

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

twilio/rest/resou 8000 rces.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,73 @@ def list(self, updated_before=None, updated_after=None, created_after=None,
11411141
return self.get_instances(kwargs)
11421142

11431143

1144+
class Member(InstanceResource):
1145+
pass
1146+
1147+
1148+
class Members(ListResource):
1149+
name = "Members"
1150+
instance = Member
1151+
1152+
def list(self, **kwargs):
1153+
"""
1154+
Returns a list of :class:`Member` resources in the given queue
1155+
1156+
:param queue_sid: Conference this participant is part of
1157+
"""
1158+
return self.get_instances(kwargs)
1159+
1160+
def dequeue(self, call_sid='Front', **kwargs):
1161+
"""
1162+
Dequeues a member from the queue and have the member's call
1163+
begin executing the TwiML document at the url.
1164+
1165+
:param call_sid: Call sid specifying the member, if not given,
1166+
the member at the front of the queue will be used
1167+
:param url: url of the TwiML document to be executed.
1168+
"""
1169+
return self.update_instance(call_sid, kwargs)
1170+
1171+
1172+
class Queue(InstanceResource):
1173+
1174+
subresources = [
1175+
Members
1176+
]
1177+
1178+
def update(self, **kwargs):
1179+
"""
1180+
Update this queue
1181+
:param friendly_name: A new friendly name for this queue
1182+
:param max_size: A new max size. Changing a max size to less than the
1183+
current size results in the queue rejecting incoming
1184+
requests until it shrinks below the new max size
1185+
"""
1186+
return self.parent.update(self.sid, kwargs)
1187+
1188+
def delete(self):
1189+
"""
1190+
Delete this queue. Can only be run on empty queues.
1191+
"""
1192+
return self.parent.delete(self.sid)
1193+
1194+
1195+
class Queues(ListResource):
1196+
name = "Queues"
1197+
instance = Queue
1198+
1199+
def list(self, **kwargs):
1200+
return self.get_instances(kwargs)
1201+
1202+
def create(self, **kwargs):
1203+
""" Create an :class:`Queue` with any of these optional parameters.
1204+
:param friendly_name: A human readable description of the application,
1205+
with maximum length 64 characters.
1206+
:param max_size: The upper limit of calls allowed into the queue
1207+
"""
1208+
return self.create_instance(kwargs)
1209+
1210+
11441211
class Application(InstanceResource):
11451212
""" An application resource """
11461213

0 commit comments

Comments
 (0)
0