File: configuration.py

package info (click to toggle)
python-twilio 9.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,756 kB
  • sloc: python: 8,281; makefile: 65
file content (439 lines) | stat: -rw-r--r-- 16,390 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
r"""
    This code was generated by
   ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
    |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
    |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \

    Twilio - Flex
    This is the public Twilio REST API.

    NOTE: This class is auto generated by OpenAPI Generator.
    https://openapi-generator.tech
    Do not edit the class manually.
"""

from datetime import datetime
from typing import Any, Dict, List, Optional, Union
from twilio.base import deserialize, values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
from twilio.base.version import Version


class ConfigurationInstance(InstanceResource):

    class Status(object):
        OK = "ok"
        INPROGRESS = "inprogress"
        NOTSTARTED = "notstarted"

    """
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Configuration resource.
    :ivar date_created: The date and time in GMT when the Configuration resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar date_updated: The date and time in GMT when the Configuration resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar attributes: An object that contains application-specific data.
    :ivar status: 
    :ivar taskrouter_workspace_sid: The SID of the TaskRouter Workspace.
    :ivar taskrouter_target_workflow_sid: The SID of the TaskRouter target Workflow.
    :ivar taskrouter_target_taskqueue_sid: The SID of the TaskRouter Target TaskQueue.
    :ivar taskrouter_taskqueues: The list of TaskRouter TaskQueues.
    :ivar taskrouter_skills: The Skill description for TaskRouter workers.
    :ivar taskrouter_worker_channels: The TaskRouter default channel capacities and availability for workers.
    :ivar taskrouter_worker_attributes: The TaskRouter Worker attributes.
    :ivar taskrouter_offline_activity_sid: The TaskRouter SID of the offline activity.
    :ivar runtime_domain: The URL where the Flex instance is hosted.
    :ivar messaging_service_instance_sid: The SID of the Messaging service instance.
    :ivar chat_service_instance_sid: The SID of the chat service this user belongs to.
    :ivar flex_service_instance_sid: The SID of the Flex service instance.
    :ivar flex_instance_sid: The SID of the Flex instance.
    :ivar ui_language: The primary language of the Flex UI.
    :ivar ui_attributes: The object that describes Flex UI characteristics and settings.
    :ivar ui_dependencies: The object that defines the NPM packages and versions to be used in Hosted Flex.
    :ivar ui_version: The Pinned UI version.
    :ivar service_version: The Flex Service version.
    :ivar call_recording_enabled: Whether call recording is enabled.
    :ivar call_recording_webhook_url: The call recording webhook URL.
    :ivar crm_enabled: Whether CRM is present for Flex.
    :ivar crm_type: The CRM type.
    :ivar crm_callback_url: The CRM Callback URL.
    :ivar crm_fallback_url: The CRM Fallback URL.
    :ivar crm_attributes: An object that contains the CRM attributes.
    :ivar public_attributes: The list of public attributes, which are visible to unauthenticated clients.
    :ivar plugin_service_enabled: Whether the plugin service enabled.
    :ivar plugin_service_attributes: The plugin service attributes.
    :ivar integrations: A list of objects that contain the configurations for the Integrations supported in this configuration.
    :ivar outbound_call_flows: The list of outbound call flows.
    :ivar serverless_service_sids: The list of serverless service SIDs.
    :ivar queue_stats_configuration: Configurable parameters for Queues Statistics.
    :ivar notifications: Configurable parameters for Notifications.
    :ivar markdown: Configurable parameters for Markdown.
    :ivar url: The absolute URL of the Configuration resource.
    :ivar flex_insights_hr: Object with enabled/disabled flag with list of workspaces.
    :ivar flex_insights_drilldown: Setting this to true will redirect Flex UI to the URL set in flex_url
    :ivar flex_url: URL to redirect to in case drilldown is enabled.
    :ivar channel_configs: Settings for different limits for Flex Conversations channels attachments.
    :ivar debugger_integration: Configurable parameters for Debugger Integration.
    :ivar flex_ui_status_report: Configurable parameters for Flex UI Status report.
    :ivar agent_conv_end_methods: Agent conversation end methods.
    :ivar citrix_voice_vdi: Citrix voice vdi configuration and settings.
    :ivar offline_config: Presence and presence ttl configuration
    """

    def __init__(self, version: Version, payload: Dict[str, Any]):
        super().__init__(version)

        self.account_sid: Optional[str] = payload.get("account_sid")
        self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
            payload.get("date_created")
        )
        self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
            payload.get("date_updated")
        )
        self.attributes: Optional[Dict[str, object]] = payload.get("attributes")
        self.status: Optional["ConfigurationInstance.Status"] = payload.get("status")
        self.taskrouter_workspace_sid: Optional[str] = payload.get(
            "taskrouter_workspace_sid"
        )
        self.taskrouter_target_workflow_sid: Optional[str] = payload.get(
            "taskrouter_target_workflow_sid"
        )
        self.taskrouter_target_taskqueue_sid: Optional[str] = payload.get(
            "taskrouter_target_taskqueue_sid"
        )
        self.taskrouter_taskqueues: Optional[List[Dict[str, object]]] = payload.get(
            "taskrouter_taskqueues"
        )
        self.taskrouter_skills: Optional[List[Dict[str, object]]] = payload.get(
            "taskrouter_skills"
        )
        self.taskrouter_worker_channels: Optional[Dict[str, object]] = payload.get(
            "taskrouter_worker_channels"
        )
        self.taskrouter_worker_attributes: Optional[Dict[str, object]] = payload.get(
            "taskrouter_worker_attributes"
        )
        self.taskrouter_offline_activity_sid: Optional[str] = payload.get(
            "taskrouter_offline_activity_sid"
        )
        self.runtime_domain: Optional[str] = payload.get("runtime_domain")
        self.messaging_service_instance_sid: Optional[str] = payload.get(
            "messaging_service_instance_sid"
        )
        self.chat_service_instance_sid: Optional[str] = payload.get(
            "chat_service_instance_sid"
        )
        self.flex_service_instance_sid: Optional[str] = payload.get(
            "flex_service_instance_sid"
        )
        self.flex_instance_sid: Optional[str] = payload.get("flex_instance_sid")
        self.ui_language: Optional[str] = payload.get("ui_language")
        self.ui_attributes: Optional[Dict[str, object]] = payload.get("ui_attributes")
        self.ui_dependencies: Optional[Dict[str, object]] = payload.get(
            "ui_dependencies"
        )
        self.ui_version: Optional[str] = payload.get("ui_version")
        self.service_version: Optional[str] = payload.get("service_version")
        self.call_recording_enabled: Optional[bool] = payload.get(
            "call_recording_enabled"
        )
        self.call_recording_webhook_url: Optional[str] = payload.get(
            "call_recording_webhook_url"
        )
        self.crm_enabled: Optional[bool] = payload.get("crm_enabled")
        self.crm_type: Optional[str] = payload.get("crm_type")
        self.crm_callback_url: Optional[str] = payload.get("crm_callback_url")
        self.crm_fallback_url: Optional[str] = payload.get("crm_fallback_url")
        self.crm_attributes: Optional[Dict[str, object]] = payload.get("crm_attributes")
        self.public_attributes: Optional[Dict[str, object]] = payload.get(
            "public_attributes"
        )
        self.plugin_service_enabled: Optional[bool] = payload.get(
            "plugin_service_enabled"
        )
        self.plugin_service_attributes: Optional[Dict[str, object]] = payload.get(
            "plugin_service_attributes"
        )
        self.integrations: Optional[List[Dict[str, object]]] = payload.get(
            "integrations"
        )
        self.outbound_call_flows: Optional[Dict[str, object]] = payload.get(
            "outbound_call_flows"
        )
        self.serverless_service_sids: Optional[List[str]] = payload.get(
            "serverless_service_sids"
        )
        self.queue_stats_configuration: Optional[Dict[str, object]] = payload.get(
            "queue_stats_configuration"
        )
        self.notifications: Optional[Dict[str, object]] = payload.get("notifications")
        self.markdown: Optional[Dict[str, object]] = payload.get("markdown")
        self.url: Optional[str] = payload.get("url")
        self.flex_insights_hr: Optional[Dict[str, object]] = payload.get(
            "flex_insights_hr"
        )
        self.flex_insights_drilldown: Optional[bool] = payload.get(
            "flex_insights_drilldown"
        )
        self.flex_url: Optional[str] = payload.get("flex_url")
        self.channel_configs: Optional[List[Dict[str, object]]] = payload.get(
            "channel_configs"
        )
        self.debugger_integration: Optional[Dict[str, object]] = payload.get(
            "debugger_integration"
        )
        self.flex_ui_status_report: Optional[Dict[str, object]] = payload.get(
            "flex_ui_status_report"
        )
        self.agent_conv_end_methods: Optional[Dict[str, object]] = payload.get(
            "agent_conv_end_methods"
        )
        self.citrix_voice_vdi: Optional[Dict[str, object]] = payload.get(
            "citrix_voice_vdi"
        )
        self.offline_config: Optional[Dict[str, object]] = payload.get("offline_config")

        self._context: Optional[ConfigurationContext] = None

    @property
    def _proxy(self) -> "ConfigurationContext":
        """
        Generate an instance context for the instance, the context is capable of
        performing various actions. All instance actions are proxied to the context

        :returns: ConfigurationContext for this ConfigurationInstance
        """
        if self._context is None:
            self._context = ConfigurationContext(
                self._version,
            )
        return self._context

    def fetch(
        self, ui_version: Union[str, object] = values.unset
    ) -> "ConfigurationInstance":
        """
        Fetch the ConfigurationInstance

        :param ui_version: The Pinned UI version of the Configuration resource to fetch.

        :returns: The fetched ConfigurationInstance
        """
        return self._proxy.fetch(
            ui_version=ui_version,
        )

    async def fetch_async(
        self, ui_version: Union[str, object] = values.unset
    ) -> "ConfigurationInstance":
        """
        Asynchronous coroutine to fetch the ConfigurationInstance

        :param ui_version: The Pinned UI version of the Configuration resource to fetch.

        :returns: The fetched ConfigurationInstance
        """
        return await self._proxy.fetch_async(
            ui_version=ui_version,
        )

    def update(
        self, body: Union[object, object] = values.unset
    ) -> "ConfigurationInstance":
        """
        Update the ConfigurationInstance

        :param body:

        :returns: The updated ConfigurationInstance
        """
        return self._proxy.update(
            body=body,
        )

    async def update_async(
        self, body: Union[object, object] = values.unset
    ) -> "ConfigurationInstance":
        """
        Asynchronous coroutine to update the ConfigurationInstance

        :param body:

        :returns: The updated ConfigurationInstance
        """
        return await self._proxy.update_async(
            body=body,
        )

    def __repr__(self) -> str:
        """
        Provide a friendly representation

        :returns: Machine friendly representation
        """

        return "<Twilio.FlexApi.V1.ConfigurationInstance>"


class ConfigurationContext(InstanceContext):

    def __init__(self, version: Version):
        """
        Initialize the ConfigurationContext

        :param version: Version that contains the resource
        """
        super().__init__(version)

        self._uri = "/Configuration"

    def fetch(
        self, ui_version: Union[str, object] = values.unset
    ) -> ConfigurationInstance:
        """
        Fetch the ConfigurationInstance

        :param ui_version: The Pinned UI version of the Configuration resource to fetch.

        :returns: The fetched ConfigurationInstance
        """

        data = values.of(
            {
                "UiVersion": ui_version,
            }
        )

        headers = values.of({})

        headers["Accept"] = "application/json"

        payload = self._version.fetch(
            method="GET", uri=self._uri, params=data, headers=headers
        )

        return ConfigurationInstance(
            self._version,
            payload,
        )

    async def fetch_async(
        self, ui_version: Union[str, object] = values.unset
    ) -> ConfigurationInstance:
        """
        Asynchronous coroutine to fetch the ConfigurationInstance

        :param ui_version: The Pinned UI version of the Configuration resource to fetch.

        :returns: The fetched ConfigurationInstance
        """

        data = values.of(
            {
                "UiVersion": ui_version,
            }
        )

        headers = values.of({})

        headers["Accept"] = "application/json"

        payload = await self._version.fetch_async(
            method="GET", uri=self._uri, params=data, headers=headers
        )

        return ConfigurationInstance(
            self._version,
            payload,
        )

    def update(
        self, body: Union[object, object] = values.unset
    ) -> ConfigurationInstance:
        """
        Update the ConfigurationInstance

        :param body:

        :returns: The updated ConfigurationInstance
        """
        data = body.to_dict()

        headers = values.of({})

        headers["Content-Type"] = "application/json"

        headers["Accept"] = "application/json"

        payload = self._version.update(
            method="POST", uri=self._uri, data=data, headers=headers
        )

        return ConfigurationInstance(self._version, payload)

    async def update_async(
        self, body: Union[object, object] = values.unset
    ) -> ConfigurationInstance:
        """
        Asynchronous coroutine to update the ConfigurationInstance

        :param body:

        :returns: The updated ConfigurationInstance
        """
        data = body.to_dict()

        headers = values.of({})

        headers["Content-Type"] = "application/json"

        headers["Accept"] = "application/json"

        payload = await self._version.update_async(
            method="POST", uri=self._uri, data=data, headers=headers
        )

        return ConfigurationInstance(self._version, payload)

    def __repr__(self) -> str:
        """
        Provide a friendly representation

        :returns: Machine friendly representation
        """

        return "<Twilio.FlexApi.V1.ConfigurationContext>"


class ConfigurationList(ListResource):

    def __init__(self, version: Version):
        """
        Initialize the ConfigurationList

        :param version: Version that contains the resource

        """
        super().__init__(version)

    def get(self) -> ConfigurationContext:
        """
        Constructs a ConfigurationContext

        """
        return ConfigurationContext(self._version)

    def __call__(self) -> ConfigurationContext:
        """
        Constructs a ConfigurationContext

        """
        return ConfigurationContext(self._version)

    def __repr__(self) -> str:
        """
        Provide a friendly representation

        :returns: Machine friendly representation
        """
        return "<Twilio.FlexApi.V1.ConfigurationList>"