|
| 1 | +# coding=utf-8 |
| 2 | +r""" |
| 3 | +This code was generated by |
| 4 | +\ / _ _ _| _ _ |
| 5 | + | (_)\/(_)(_|\/| |(/_ v1.0.0 |
| 6 | + / / |
| 7 | +""" |
| 8 | + |
| 9 | +from twilio.base import deserialize |
| 10 | +from twilio.base.instance_context import InstanceContext |
| 11 | +from twilio.base.instance_resource import InstanceResource |
| 12 | +from twilio.base.list_resource import ListResource |
| 13 | +from twilio.base.page import Page |
| 14 | + |
| 15 | + |
| 16 | +class ArchivedCallList(ListResource): |
| 17 | + """ PLEASE NOTE that this class contains beta products that are subject to |
| 18 | + change. Use them with caution. """ |
| 19 | + |
| 20 | + def __init__(self, version): |
| 21 | + """ |
| 22 | + Initialize the ArchivedCallList |
| 23 | +
|
| 24 | + :param Version version: Version that contains the resource |
| 25 | +
|
| 26 | + :returns: twilio.rest.voice.v1.archived_call.ArchivedCallList |
| 27 | + :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallList |
| 28 | + """ |
| 29 | + super(ArchivedCallList, self).__init__(version) |
| 30 | + |
| 31 | + # Path Solution |
| 32 | + self._solution = {} |
| 33 | + |
| 34 | + def get(self, date, sid): |
| 35 | + """ |
| 36 | + Constructs a ArchivedCallContext |
| 37 | +
|
| 38 | + :param date: The date of the Call in UTC. |
| 39 | + :param sid: The unique string that identifies this resource |
| 40 | +
|
| 41 | + :returns: twilio.rest.voice.v1.archived_call.ArchivedCallContext |
| 42 | + :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallContext |
| 43 | + """ |
| 44 | + return ArchivedCallContext(self._version, date=date, sid=sid, ) |
| 45 | + |
| 46 | + def __call__(self, date, sid): |
| 47 | + """ |
| 48 | + Constructs a ArchivedCallContext |
| 49 | +
|
| 50 | + :param date: The date of the Call in UTC. |
| 51 | + :param sid: The unique string that identifies this resource |
| 52 | +
|
| 53 | + :returns: twilio.rest.voice.v1.archived_call.ArchivedCallContext |
| 54 | + :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallContext |
| 55 | + """ |
| 56 | + return ArchivedCallContext(self._version, date=date, sid=sid, ) |
| 57 | + |
| 58 | + def __repr__(self): |
| 59 | + """ |
| 60 | + Provide a friendly representation |
| 61 | +
|
| 62 | + :returns: Machine friendly representation |
| 63 | + :rtype: str |
| 64 | + """ |
| 65 | + return '<Twilio.Voice.V1.ArchivedCallList>' |
| 66 | + |
| 67 | + |
| 68 | +class ArchivedCallPage(Page): |
| 69 | + """ PLEASE NOTE that this class contains beta products that are subject to |
| 70 | + change. Use them with caution. """ |
| 71 | + |
| 72 | + def __init__(self, version, response, solution): |
| 73 | + """ |
| 74 | + Initialize the ArchivedCallPage |
| 75 | +
|
| 76 | + :param Version version: Version that contains the resource |
| 77 | + :param Response response: Response from the API |
| 78 | +
|
| 79 | + :returns: twilio.rest.voice.v1.archived_call.ArchivedCallPage |
| 80 | + :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallPage |
| 81 | + """ |
| 82 | + super(ArchivedCallPage, self).__init__(version, response) |
| 83 | + |
| 84 | + # Path Solution |
| 85 | + self._solution = solution |
| 86 | + |
| 87 | + def get_instance(self, payload): |
| 88 | + """ |
| 89 | + Build an instance of ArchivedCallInstance |
| 90 | +
|
| 91 | + :param dict payload: Payload response from the API |
| 92 | +
|
| 93 | + :returns: twilio.rest.voice.v1.archived_call.ArchivedCallInstance |
| 94 | + :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallInstance |
| 95 | + """ |
| 96 | + return ArchivedCallInstance(self._version, payload, ) |
| 97 | + |
| 98 | + def __repr__(self): |
| 99 | + """ |
| 100 | + Provide a friendly representation |
| 101 | +
|
| 102 | + :returns: Machine friendly representation |
| 103 | + :rtype: str |
| 104 | + """ |
| 105 | + return '<Twilio.Voice.V1.ArchivedCallPage>' |
| 106 | + |
| 107 | + |
| 108 | +class ArchivedCallContext(InstanceContext): |
| 109 | + """ PLEASE NOTE that this class contains beta products that are subject to |
| 110 | + change. Use them with caution. """ |
| 111 | + |
| 112 | + def __init__(self, version, date, sid): |
| 113 | + """ |
| 114 | + Initialize the ArchivedCallContext |
| 115 | +
|
| 116 | + :param Version version: Version that contains the resource |
| 117 | + :param date: The date of the Call in UTC. |
| 118 | + :param sid: The unique string that identifies this resource |
| 119 | +
|
| 120 | + :returns: twilio.rest.voice.v1.archived_call.ArchivedCallContext |
| 121 | + :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallContext |
| 122 | + """ |
| 123 | + super(ArchivedCallContext, self).__init__(version) |
| 124 | + |
| 125 | + # Path Solution |
| 126 | + self._solution = {'date': date, 'sid': sid, } |
| 127 | + self._uri = '/Archives/{date}/Calls/{sid}'.format(**self._solution) |
| 128 | + |
| 129 | + def delete(self): |
| 130 | + """ |
| 131 | + Deletes the ArchivedCallInstance |
| 132 | +
|
| 133 | + :returns: True if delete succeeds, False otherwise |
| 134 | + :rtype: bool |
| 135 | + """ |
| 136 | + return self._version.delete(method='DELETE', uri=self._uri, ) |
| 137 | + |
| 138 | + def __repr__(self): |
| 139 | + """ |
| 140 | + Provide a friendly representation |
| 141 | +
|
| 142 | + :returns: Machine friendly representation |
| 143 | + :rtype: str |
| 144 | + """ |
| 145 | + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) |
| 146 | + return '<Twilio.Voice.V1.ArchivedCallContext {}>'.format(context) |
| 147 | + |
| 148 | + |
| 149 | +class ArchivedCallInstance(InstanceResource): |
| 150 | + """ PLEASE NOTE that this class contains beta products that are subject to |
| 151 | + change. Use them with caution. """ |
| 152 | + |
| 153 | + def __init__(self, version, payload, date=None, sid=None): |
| 154 | + """ |
| 155 | + Initialize the ArchivedCallInstance |
| 156 | +
|
| 157 | + :returns: twilio.rest.voice.v1.archived_call.ArchivedCallInstance |
| 158 | + :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallInstance |
| 159 | + """ |
| 160 | + super(ArchivedCallInstance, self).__init__(version) |
| 161 | + |
| 162 | + # Marshaled Properties |
| 163 | + self._properties = { |
| 164 | + 'date': deserialize.iso8601_date(payload.get('date')), |
| 165 | + 'sid': payload.get('sid'), |
| 166 | + 'url': payload.get('url'), |
| 167 | + } |
| 168 | + |
| 169 | + # Context |
| 170 | + self._context = None |
| 171 | + self._solution = {'date': date or self._properties['date'], 'sid': sid or self._properties['sid'], } |
| 172 | + |
| 173 | + @property |
| 174 | + def _proxy(self): |
| 175 | + """ |
| 176 | + Generate an instance context for the instance, the context is capable of |
| 177 | + performing various actions. All instance actions are proxied to the context |
| 178 | +
|
| 179 | + :returns: ArchivedCallContext for this ArchivedCallInstance |
| 180 | + :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallContext |
| 181 | + """ |
| 182 | + if self._context is None: |
| 183 | + self._context = ArchivedCallContext( |
| 184 | + self._version, |
| 185 | + date=self._solution['date'], |
| 186 | + sid=self._solution['sid'], |
| 187 | + ) |
| 188 | + return self._context |
| 189 | + |
| 190 | + @property |
| 191 | + def date(self): |
| 192 | + """ |
| 193 | + :returns: date |
| 194 | + :rtype: date |
| 195 | + """ |
| 196 | + return self._properties['date'] |
| 197 | + |
| 198 | + @property |
| 199 | + def sid(self): |
| 200 | + """ |
| 201 | + :returns: sid |
| 202 | + :rtype: unicode |
| 203 | + """ |
| 204 | + return self._properties['sid'] |
| 205 | + |
| 206 | + @property |
| 207 | + def url(self): |
| 208 | + """ |
| 209 | + :returns: The absolute URL of the resource |
| 210 | + :rtype: unicode |
| 211 | + """ |
| 212 | + return self._properties['url'] |
| 213 | + |
| 214 | + def delete(self): |
| 215 | + """ |
| 216 | + Deletes the ArchivedCallInstance |
| 217 | +
|
| 218 | + :returns: True if delete succeeds, False otherwise |
| 219 | + :rtype: bool |
| 220 | + """ |
| 221 | + return self._proxy.delete() |
| 222 | + |
| 223 | + def __repr__(self): |
| 224 | + """ |
| 225 | + Provide a friendly representation |
| 226 | +
|
| 227 | + :returns: Machine friendly representation |
| 228 | + :rtype: str |
| 229 | + """ |
| 230 | + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) |
| 231 | + return '<Twilio.Voice.V1.ArchivedCallInstance {}>'.format(context) |
0 commit comments