8000 Document TaskRouter and move DependentPhoneNumbers down one level · madCode/twilio-python@11e2226 · GitHub
[go: up one dir, main page]

Skip to content

Commit 11e2226

Browse files
committed
Document TaskRouter and move DependentPhoneNumbers down one level
1 parent ed04e0e commit 11e2226

File tree

13 files changed

+496
-22
lines changed

13 files changed

+496
-22
lines changed

docs/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ A complete API reference to the :data:`twilio` module.
99

1010
api/rest/index
1111
api/rest/resources
12+
api/rest/resources/task_router
1213
api/twiml
1314
api/util
1415

docs/api/rest/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@
1818
:members:
1919
:inherited-members:
2020

21+
.. autoclass:: TwilioTaskRouterClient
22+
:members:
23+
:inherited-members:
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
.. module:: twilio.rest.resources.task_router
2+
3+
========================================
4+
:mod:`twilio.rest.resources.task_router`
5+
========================================
6+
7+
8+
Workspaces
9+
>>>>>>>>>>
10+
11+
.. autoclass:: Workspaces
12+
:members:
13+
:exclude-members: instance
14+
15+
.. autoclass:: Workspace
16+
17+
Workflows
18+
>>>>>>>>>
19+
20+
.. autoclass:: Workflows
21+
:members:
22+
:exclude-members: instance
23+
24+
.. autoclass:: Workflow
25+
26+
Activities
27+
>>>>>>>>>>
28+
29+
.. autoclass:: Activities
30+
:members:
31+
:exclude-members: instance
32+
33+
.. autoclass:: Activity
34+
.. attribute:: sid
35+
36+
The unique ID for this Activity.
37+
38+
.. attribute:: account_sid
39+
40+
The unique ID of the Account that owns this Activity.
41+
42+
.. attribute:: workspace_sid
43+
44+
The unique ID of the :class:`Workspace` that owns this Activity.
45+
46+
.. attribute:: friendly_name
47+
48+
A human-readable name for the Activity, such as 'on-call', 'break',
49+
'email', etc. These names will be used to calculate and expose
50+
statistics about workers, and give you visibility into the state of
51+
each of your workers.
52+
53+
.. attribute:: available
54+
55+
Boolean value indicating whether the worker should be eligible to
56+
receive a Task when they occupy this Activity. For example, in an
57+
activity called 'On Call', the worker would be unavailable to receive
58+
additional Task assignments.
59+
60+
.. attribute:: date_created
61+
62+
The date this Activity was created, given as UTC in ISO 8601 format.
63+
64+
.. attribute:: date_updated
65+
66+
The date this Activity was last updated, given as UTC in ISO 8601
67+
format.
68+
69+
Workers
70+
>>>>>>>>>>
71+
72+
.. autoclass:: Workers
73+
:members:
74+
:exclude-members: instance
75+
76+
.. autoclass:: Worker
77+
78+
TaskQueues
79+
>>>>>>>>>>
80+
81+
.. autoclass:: TaskQueues
82+
:members:
83+
:exclude-members: instance
84+
85+
.. autoclass:: TaskQueue
86+
87+
Tasks
88+
>>>>>>>>>>
89+
90+
.. autoclass:: Tasks
91+
:members:
92+
:exclude-members: instance
93+
94+
.. autoclass:: Task
95+
96+
Events
97+
>>>>>>>>>>
98+
99+
.. autoclass:: Events
100+
:members:
101+
:exclude-members: instance
102+
103+
.. autoclass:: Event

twilio/rest/__init__.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,12 @@ def __init__(self, account=None, token=None, base="https://api.twilio.com",
8888
and be sure to replace the values for the Account SID and auth token with the
8989
values from your Twilio Account at https://www.twilio.com/user/account.
9090
""")
91-
9291
self.base = base
9392
self.auth = (account, token)
9493
self.timeout = timeout
9594
self.account_uri = "{0}/{1}/Accounts/{2}".format(base,
9695
version, account)
9796

98-
def dependent_phone_numbers(self, address_sid):
99-
"""
100-
Return a :class:`DependentPhoneNumbers
101-
<twilio.rest.resources.DependentPhoneNumbers>` instance for the
102-
:class:`Address <twilio.rest.resources.Address>` with the given
103-
address_sid
104-
"""
105-
base_uri = "%s/Addresses/%s" % (self.account_uri, address_sid)
106-
return DependentPhoneNumbers(base_uri, self.auth, self.timeout)
107-
10897
def request(self, path, method=None, vars=None):
10998
"""sends a request and gets a response from the Twilio REST API
11099
@@ -237,6 +226,16 @@ def feedback(self, call_sid):
237226
)
238227
return CallFeedback(call_feedback_list)
239228

229+
def dependent_phone_numbers(self, address_sid):
230+
"""
231+
Return a :class:`DependentPhoneNumbers
232+
<twilio.rest.resources.DependentPhoneNumbers>` instance for the
233+
:class:`Address <twilio.rest.resources.Address>` with the given
234+
address_sid
235+
"""
236+
base_uri = "%s/Addresses/%s" % (self.account_uri, address_sid)
237+
return DependentPhoneNumbers(base_uri, self.auth, self.timeout)
238+
240239

241240
class TwilioTaskRouterClient(TwilioClient):
242241
"""

twilio/rest/resources/task_router/activities.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,45 @@
33

44
class Activity(NextGenInstanceResource):
55
"""
6-
An Activity resource
6+
An Activity resource.
7+
See the `TaskRouter API reference
8+
<https://www.twilio.com/docs/taskrouter/activities>_`
9+
for more information.
10+
11+
.. attribute:: sid
12+
13+
The unique ID for this Activity.
14+
15+
.. attribute:: account_sid
16+
17+
The unique ID of the Account that owns this Activity.
18+
19+
.. attribute:: workspace_sid
20+
21+
The unique ID of the :class:`Workspace` that owns this Activity.
22+
23+
.. attribute:: friendly_name
24+
25+
A human-readable name for the Activity, such as 'on-call', 'break',
26+
'email', etc. These names will be used to calculate and expose
27+
statistics about workers, and give you visibility into the state of
28+
each of your workers.
29+
30+
.. attribute:: available
31+
32+
Boolean value indicating whether the worker should be eligible to
33+
receive a Task when they occupy this Activity. For example, in an
34+
activity called 'On Call', the worker would be unavailable to receive
35+
additional Task assignments.
36+
37+
.. attribute:: date_created
38+
39+
The date this Activity was created, given as UTC in ISO 8601 format.
40+
41+
.. attribute:: date_updated
42+
43+
The date this Activity was last updated, given as UTC in ISO 8601
44+
format.
745
"""
846

947
def delete(self):

twilio/rest/resources/task_router/events.py

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,42 @@
55

66

77
class Event(NextGenInstanceResource):
8-
""" A taskrouter event resource """
8+
"""An Event resource representing a state change in a TaskRouter
9+
Workspace.
10+
11+
See the `TaskRouter API reference
12+
<https://www.twilio.com/docs/taskrouter/events>_`
13+
for more information.
14+
15+
.. attribute:: event_type
16+
17+
An identifier for this event.
18+
19+
.. attribute:: account_sid
20+
21+
The unique ID of the Account that owns this Event.
22+
23+
.. attribute:: description
24+
25+
A description of the event.
26+
27+
.. attribute:: resource_type
28+
29+
The type of object this event is most relevant to (:class:`Task`,
30+
:class:`Reservation`, :class:`Worker`).
31+
32+
.. attribute:: resource_sid
33+
34+
The unique ID of the object this event is most relevant to.
35+
36+
.. attribute:: event_date
37+
38+
The time this event was sent, in UTC ISO 8601 format.
39+
40+
.. attribute:: event_data
41+
42+
Data about this specific Event.
43+
"""
944
pass
1045

1146

@@ -16,11 +51,12 @@ class Events(NextGenListResource):
1651
def list(self, **kwargs):
1752
"""
1853
Returns a page of :class:`Event` resources as a list. For paging
19-
information see :class:`NextGenListResource`
54+
information see :class:`NextGenListResource`
55+
2056
:param minutes: (Optional, Default=15) Definition of the interval in
21-
minutes prior to now.
57+
minutes prior to now.
2258
:param start_date: (Optional, Default=15 minutes prior) Filter events
23-
by a start date.
59+
by a start date.
2460
:param end_date: (Optional, Default=Now) Filter events by an end date.
2561
:param resource_sid: (Optional) Sid of the event resource.
2662
:param event_type: (Optional) The type of event to filter by.
@@ -32,6 +68,7 @@ def get_instances(self, params):
3268
Query the list resource for a list of InstanceResources.
3369
Raises a :exc:`~twilio.TwilioRestException` if requesting a page of
3470
results that does not exist.
71+
3572
:param dict params: List of URL parameters to be included in request
3673
:param str page_token: Token of the page of results to retrieve
3774
:param int page_size: The number of results to be returned.

twilio/rest/resources/task_router/reservations.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,41 @@
33

44
class Reservation(NextGenInstanceResource):
55
"""
6-
A Reservation resource
6+
A Reservation resource.
7+
8+
See the `TaskRouter API reference
9+
<https://www.twilio.com/docs/taskrouter/tasks#reservation>_`
10+
for more information.
11+
12+
.. attribute:: sid
13+
14+
The unique ID of this Reservation.
15+
16+
.. attribute:: account_Sid
17+
18+
The unique ID of the Account that owns this :class:`Task`.
19+
20+
.. attribute:: workspace_sid
21+
22+
The unique ID of the :class:`Workspace` that contains this
23+
:class:`Task`.
24+
25+
.. attribute:: task_sid
26+
27+
The unique ID of the reserved :class:`Task`.
28+
29+
.. attribute:: worker_sid
30+
31+
The unique ID of the reserved :class:`Worker`.
32+
33+
.. attribute:: worker_name
34+
35+
Human-readable description of the reserved Worker.
36+
37+
.. attribute:: reservation_status
38+
39+
The current status of the reservation. One of 'pending',
40+
'accepted', 'rejected', or 'timeout'.
741
"""
842

943
def update(self, **kwargs):

twilio/rest/resources/task_router/statistics.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33

44
class StatisticsInstance(NextGenInstanceResource):
5+
"""
6+
A resource representing collected statistics about TaskRouter
7+
resources.
8+
9+
See the `TaskRouter API reference
10+
<https://www.twilio.com/docs/taskrouter/statistics>_`
11+
for more information.
12+
"""
513
def __init__(self, parent):
614
self.parent = parent
715
super(StatisticsInstance, self).__init__(

twilio/rest/resources/task_router/task_queues.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,43 @@
44

55
class TaskQueue(NextGenInstanceResource):
66
"""
7-
A TaskQueue resource
7+
A TaskQueue resource.
8+
9+
See the `TaskRouter API reference
10+
<https://www.twilio.com/docs/taskrouter/taskqueues>_`
11+
for more information.
12+
13+
.. attribute:: sid
14+
15+
The unique ID of this TaskQueue.
16+
17+
.. attribute:: account_sid
18+
19+
The unique ID of the account that owns this TaskQueue.
20+
21+
.. attribute:: workspace_sid
22+
23+
The unique ID of the :class:`Workspace` that contains this TaskQueue.
24+
25+
.. attribute:: friendly_name
26+
27+
Human-readable description of this TaskQueue (e.g. "Customer Support"
28+
or "Sales").
29+
30+
.. attribute:: target_workers
31+
32+
The worker selection expressions associated with this TaskQueue.
33+
34+
.. attribute:: reservation_activity_sid
35+
36+
The :class:`Activity` to assign a :class:`Worker` when they are
37+
reserved for a :class:`Task` from this TaskQueue. Defaults to
38+
'Reserved for Task'.
39+
40+
.. attribute:: assignment_activity_sid
41+
42+
The Activity to assign a Worker when they accept a Task from this
43+
Taskqueue. Defaults to 'Unavailable for Assignment'.
844
"""
945
subresources = [
1046
Statistics,

0 commit comments

Comments
 (0)
0