|
1 |
| -from twilio.twiml import TwiML |
| 1 | +# coding=utf-8 |
| 2 | +""" |
| 3 | +This code was generated by |
| 4 | +\ / _ _ _| _ _ |
| 5 | + | (_)\/(_)(_|\/| |(/_ v1.0.0 |
| 6 | + / / |
| 7 | +""" |
| 8 | + |
| 9 | +import json |
| 10 | +from twilio.twiml import ( |
| 11 | + TwiML, |
| 12 | + format_language, |
| 13 | +) |
2 | 14 |
|
3 | 15 |
|
4 | 16 | class MessagingResponse(TwiML):
|
5 |
| - """ |
6 |
| - Messaging TwiML Response |
7 |
| - """ |
8 |
| - def __init__(self): |
9 |
| - """ |
10 |
| - Create a new <Response> |
11 |
| - """ |
12 |
| - super(MessagingResponse, self).__init__() |
| 17 | + """ <Response> TwiML for Messages """ |
| 18 | + |
| 19 | + def __init__(self, **kwargs): |
| 20 | + super(MessagingResponse, self).__init__(**kwargs) |
13 | 21 | self.name = 'Response'
|
14 | 22 |
|
15 |
| - def message(self, |
16 |
| - body, |
17 |
| - to=None, |
18 |
| - from_=None, |
19 |
| - method=None, |
20 |
| - action=None, |
21 |
| - status_callback=None, |
| 23 | + def message(self, message=None, to=None, from_=None, action=None, method=None, |
22 | 24 | **kwargs):
|
23 | 25 | """
|
24 |
| - Add a <Message> element |
25 |
| -
|
26 |
| - :param body: body of the message |
27 |
| - :param to: number to send to |
28 |
| - :param from_: number to send from |
29 |
| - :param method: action HTTP method |
30 |
| - :param action: action URL |
31 |
| - :param status_callback: callback URL |
32 |
| - :param kwargs: other attributes |
33 |
| - :return: <Response> element |
| 26 | + Create a <Message> element |
| 27 | +
|
| 28 | + :param message: Message Body |
| 29 | + :param to: Phone Number to send Message to |
| 30 | + :param from: Phone Number to send Message from |
| 31 | + :param action: Action URL |
| 32 | + :param method: Action URL Method |
| 33 | + :param kwargs: additional attributes |
| 34 | +
|
| 35 | + :returns: <Message> element |
34 | 36 | """
|
35 | 37 | return self.nest(Message(
|
36 |
| - body=body, |
| 38 | + message=message, |
37 | 39 | to=to,
|
38 | 40 | from_=from_,
|
39 |
| - method=method, |
40 | 41 | action=action,
|
41 |
| - status_callback=status_callback, |
| 42 | + method=method, |
42 | 43 | **kwargs
|
43 | 44 | ))
|
44 | 45 |
|
45 | 46 | def redirect(self, url, method=None, **kwargs):
|
46 | 47 | """
|
47 |
| - Add a <Redirect> element |
| 48 | + Create a <Redirect> element |
48 | 49 |
|
49 |
| - :param url: URL to redirect to |
50 |
| - :param method: HTTP method |
51 |
| - :param kwargs: other attributes |
52 |
| - :return: <Response> element |
| 50 | + :param url: Redirect URL |
| 51 | + :param method: Redirect URL method |
| 52 | + :param kwargs: additional attributes |
| 53 | +
|
| 54 | + :returns: <Redirect> element |
53 | 55 | """
|
54 | 56 | return self.nest(Redirect(
|
| 57 | + url, |
55 | 58 | method=method,
|
56 |
| - url=url, |
57 | 59 | **kwargs
|
58 | 60 | ))
|
59 | 61 |
|
60 | 62 |
|
| 63 | +class Redirect(TwiML): |
| 64 | + """ <Redirect> TwiML Verb """ |
| 65 | + |
| 66 | + def __init__(self, url, **kwargs): |
| 67 | + super(Redirect, self).__init__(**kwargs) |
| 68 | + self.name = 'Redirect' |
| 69 | + s
10000
elf.value = url |
| 70 | + |
| 71 | + |
61 | 72 | class Message(TwiML):
|
62 |
| - """ |
63 |
| - <Message> element |
64 |
| - """ |
65 |
| - def __init__(self, body=None, **kwargs): |
66 |
| - """ |
67 |
| - Create a new <Message> element |
| 73 | + """ <Message> TwiML Verb """ |
68 | 74 |
|
69 |
| - :param body: body of message |
70 |
| - :param kwargs: other attributes |
71 |
| - """ |
| 75 | + def __init__(self, message=None, **kwargs): |
72 | 76 | super(Message, self).__init__(**kwargs)
|
73 |
| - if body: |
74 |
| - self.value = body |
| 77 | + self.name = 'Message' |
| 78 | + if message: |
| 79 | + self.value = message |
75 | 80 |
|
76 |
| - def body(self, body): |
| 81 | + def body(self, message, **kwargs): |
77 | 82 | """
|
78 |
| - Add a <Body> element |
| 83 | + Create a <Body> element |
79 | 84 |
|
80 |
| - :param body: body of message |
81 |
| - :return: <Message> element |
82 |
| - """ |
83 |
| - return self.nest(Body(body)) |
| 85 | + :param message: Message Body |
| 86 | + :param kwargs: additional attributes |
84 | 87 |
|
85 |
| - def media(self, url): |
| 88 | + :returns: <Body> element |
86 | 89 | """
|
87 |
| - Add a <Media> element |
| 90 | + return self.nest(Body( |
| 91 | + message, |
| 92 | + **kwargs |
| 93 | + )) |
88 | 94 |
|
89 |
| - :param url: media URL |
90 |
| - :return: <Message> element |
| 95 | + def media(self, url, **kwargs): |
91 | 96 | """
|
92 |
| - return self.nest(Media(url)) |
93 |
| - |
| 97 | + Create a <Media> element |
94 | 98 |
|
95 |
| -class Body(TwiML): |
96 |
| - """ |
97 |
| - <Body> element |
98 |
| - """ |
99 |
| - def __init__(self, body): |
100 |
| - """ |
101 |
| - Create a new <Body> element |
| 99 | + :param url: Media URL |
| 100 | + :param kwargs: additional attributes |
102 | 101 |
|
103 |
| - :param body: message body |
| 102 | + :returns: <Media> element |
104 | 103 | """
|
105 |
| - super(Body, self).__init__() |
106 |
| - self.value = body |
| 104 | + return self.nest(Media( |
| 105 | + url, |
| 106 | + **kwargs |
| 107 | + )) |
107 | 108 |
|
108 | 109 |
|
109 | 110 | class Media(TwiML):
|
110 |
| - """ |
111 |
| - <Media> element |
112 |
| - """ |
113 |
| - def __init__(self, url): |
114 |
| - """ |
115 |
| - Create a new <Media> element |
| 111 | + """ <Media> TwiML Noun """ |
116 | 112 |
|
117 |
| - :param url: media URL location |
118 |
| - """ |
119 |
| - super(Media, self).__init__() |
| 113 | + def __init__(self, url, **kwargs): |
| 114 | + super(Media, self).__init__(**kwargs) |
| 115 | + self.name = 'Media' |
120 | 116 | self.value = url
|
121 | 117 |
|
122 | 118 |
|
123 |
| -class Redirect(TwiML): |
124 |
| - """ |
125 |
| - <Redirect> element |
126 |
| - """ |
127 |
| - def __init__(self, url, **kwargs): |
128 |
| - """ |
129 |
| - Create a new <Redirect> element |
130 |
| -
|
131 |
| - :param url: redirect URL location |
132 |
| - """ |
133 |
| - super(Redirect, self).__init__(**kwargs) |
134 |
| - self.value = url |
| 119 | +class Body(TwiML): |
| 120 | + """ <Body> TwiML Noun """ |
135 | 121 |
|
| 122 | + def __init__(self, message, **kwargs): |
| 123 | + super(Body, self).__init__(**kwargs) |
| 124 | + self.name = 'Body' |
| 125 | + self.value = message |
0 commit comments