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
|
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.twiml import (
TwiML,
)
class MessagingResponse(TwiML):
"""<Response> TwiML for Messages"""
def __init__(self, **kwargs):
super(MessagingResponse, self).__init__(**kwargs)
self.name = "Response"
def message(
self,
body=None,
to=None,
from_=None,
action=None,
method=None,
status_callback=None,
**kwargs
):
"""
Create a <Message> element
:param body: Message Body
:param to: Phone Number to send Message to
:param from: Phone Number to send Message from
:param action: A URL specifying where Twilio should send status callbacks for the created outbound message.
:param method: Action URL Method
:param status_callback: Status callback URL. Deprecated in favor of action.
:param kwargs: additional attributes
:returns: <Message> element
"""
return self.nest(
Message(
body=body,
to=to,
from_=from_,
action=action,
method=method,
status_callback=status_callback,
**kwargs
)
)
def redirect(self, url, method=None, **kwargs):
"""
Create a <Redirect> element
:param url: Redirect URL
:param method: Redirect URL method
:param kwargs: additional attributes
:returns: <Redirect> element
"""
return self.nest(Redirect(url, method=method, **kwargs))
class Redirect(TwiML):
"""<Redirect> TwiML Verb"""
def __init__(self, url, **kwargs):
super(Redirect, self).__init__(**kwargs)
self.name = "Redirect"
self.value = url
class Message(TwiML):
"""<Message> TwiML Verb"""
def __init__(self, body=None, **kwargs):
super(Message, self).__init__(**kwargs)
self.name = "Message"
if body:
self.value = body
def body(self, message, **kwargs):
"""
Create a <Body> element
:param message: Message Body
:param kwargs: additional attributes
:returns: <Body> element
"""
return self.nest(Body(message, **kwargs))
def media(self, url, **kwargs):
"""
Create a <Media> element
:param url: Media URL
:param kwargs: additional attributes
:returns: <Media> element
"""
return self.nest(Media(url, **kwargs))
class Media(TwiML):
"""<Media> TwiML Noun"""
def __init__(self, url, **kwargs):
super(Media, self).__init__(**kwargs)
self.name = "Media"
self.value = url
class Body(TwiML):
"""<Body> TwiML Noun"""
def __init__(self, message, **kwargs):
super(Body, self).__init__(**kwargs)
self.name = "Body"
self.value = message
|