diff --git a/.travis.yml b/.travis.yml index 8681760..5dfd23c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,13 +3,8 @@ sudo: true python: - "3.6" install: - - pip install twilio - - pip install pypyodbc + - pip install -r requirements.txt script: - cp src/* test/ - cd test - - python test_spider.py - - python test_spider.py - - python test_tool.py - - python test_tool.py - - python test_single_spider.py + - /usr/bin/time -v python test_spider.py \ No newline at end of file diff --git a/Pydoc/configs.html b/Pydoc/configs.html index e32242e..f3df5e4 100644 --- a/Pydoc/configs.html +++ b/Pydoc/configs.html @@ -9,11 +9,13 @@  
configs
index
f:\code\python\school_notice\src\configs.py
-

Created on Sep 19, 2018

-@author: QiZhao
+

@author: QiZhao
+@contact: zhaoqi99@outlook.com
+@since: 2018-09-19
@license: GNU GPLv3
-@version: 0.2.0

+@version: 0.3.0
+@LastModifiedBy: QiZhao
+@LastModifiedDate: 2018-12-24

@@ -22,16 +24,25 @@
        ACCOUNT_ID = ''
+APPID = ' '
AUTHOR_EMAIL = ''
AUTHOR_NAME = ''
AUTH_TOKEN = ''
+DATABASE_NAME = ''
EMAIL_PORT = 0
EMAIL_SERVER = ''
FROM_ADDR = ''
+GRANT_TYPE = 'client_credential'
LOG_ENABLED = True
PASSWORD = ''
+SAVE_TYPE = 'MYSQL'
SCHOOL_NAME = ''
-SPIDER_CONFIG = [{'coding': '', 'rule': '', 'subject_CN': '', 'subject_EN': '', 'url': '', 'url_main': ''}, {'coding': '', 'rule': '', 'subject_CN': '', 'subject_EN': '', 'url': '', 'url_main': ''}]
+SECRET = ' '
+SHOW_RIGHT = False
+SPIDER_CONFIG = []
+SQL_PASSWORD = ''
+SQL_USERNAME = ''
+TARGET_IP = ''
TWILIO_NUMBER = ''
VERSION = ''
\ No newline at end of file diff --git a/Pydoc/main.html b/Pydoc/main.html index b63cdff..f0d4361 100644 --- a/Pydoc/main.html +++ b/Pydoc/main.html @@ -9,7 +9,13 @@  
main
index
f:\code\python\school_notice\src\main.py
-

# encoding='utf-8'

+

@author: QiZhao
+@contact: zhaoqi99@outlook.com
+@since: 2018-05-08
+@license: GNU GPLv3
+@version: 0.3.0
+@LastModifiedBy: QiZhao
+@LastModifiedDate: 2018-10-27

diff --git a/Pydoc/send.html b/Pydoc/send.html index 4c58b1a..fa023de 100644 --- a/Pydoc/send.html +++ b/Pydoc/send.html @@ -9,7 +9,13 @@  
send
index
f:\code\python\school_notice\src\send.py
-

+

@author: QiZhao
+@contact: zhaoqi99@outlook.com
+@since: 2018-05-07
+@license: GNU GPLv3
+@version: 0.3.0
+@LastModifiedBy: QiZhao
+@LastModifiedDate: 2018-10-24

@@ -18,8 +24,11 @@
       
configs
-
smtplib
-
twilio
+json
+
requests
+smtplib
+
time
+twilio

@@ -27,10 +36,10 @@ Functions -
       
Send(msgs, subject, send_number, to_addr_str, flag=True)
向手机号码为send_number的人发送通知信息
+
Send(msgs, subject, send_number, to_addr_str, message_type, flag=True)
向手机号码为send_number的人发送通知信息
向to_addr_str中的邮箱地址发送主题为subject的通知信息
支持是否写入日志记录的选择               
-                                

Args:
    msgs: 存储要发送的内容的列表,且该列表的每个元素为字典,
        列表元素中的字典必须包含三个键值对,且key必须为'title','link','date',
@@ -40,6 +49,7 @@     send_number: 短信接收者的手机号码
    to_addr_str: 收件人的邮箱地址,多个邮箱地址之间应以','分割,类型为字符串
        例如:'example@qq.com','example1@qq.com,example2@qq.com'
+    message_type: 类型(通知/新闻)
    flag: 一个可选变量,用来决定是否在发送日志中记录此次发送信息,默认为True(记录)
Send_email(txt, to_addr_str, subject)
向to_addr_str中的邮箱地址发送主题为subject,正文部分为txt的邮件
支持多人同时发送
@@ -48,25 +58,28 @@     to_add_str: 收件人的邮箱地址,多个邮箱地址之间应以','分割,类型为字符串
        例如:'example@qq.com','example1@qq.com,example2@qq.com'
    subject: 邮件主题
-    

Returns:
    log_send_email: 经过处理的含收件人邮箱地址以及发送结果的日志信息,类型为字符串
        例如:'example@qq.com 邮件发送成功!'
        'example@qq.com 邮件发送失败,请检查你的账号是否有效或网络是否良好!'
        'example1@qq.com,example2@qq.com 邮件发送成功!'
-
Send_sms(send_number, msg)
向手机号码为send_number的人发送内容为msg的短信
+
Send_sms(send_number, msg)
向手机号码为send_number的人发送内容为msg的短信 
支持多个手机号码的发送
Args:
    send_number: 短信接收者的手机号码
    msg: 要发送的文本内容,类型为字符串
-    

Returns:
    经过处理的含短信接收者手机号码以及发送结果的日志信息,类型为字符串
    例如:
    '+8615012345678 短信已经发送'
    '+8615012345678 短信发送失败,请检查你的账号是否有效或网络是否良好!'
-    

send_number应已经在twilio上验证过
msg中不能包含敏感词,否则短信会被运营商拦截
+
get_token()
# 获取微信access_token
+# TODO 每两小时token会过期,一天大概只能获取2000次
+
send_to_wechat(str='default_words!')
# 发送消息给订阅号(订阅号由get_token决定
\ No newline at end of file diff --git a/Pydoc/spider.html b/Pydoc/spider.html index 1dd3db1..e190132 100644 --- a/Pydoc/spider.html +++ b/Pydoc/spider.html @@ -9,11 +9,7 @@  
spider
index
f:\code\python\school_notice\src\spider.py
-

Created on Mar 7, 2018

-@author: QiZhao
-@license: GNU GPLv3
-@version: 0.2.0

+

# encoding='utf-8'

@@ -21,48 +17,56 @@ Modules -
       
re
+
configs
+re
sqlhelper
-
tool
+tool
urllib
-

+

-
 
Functions
       
Data_processing(subject_EN, data, url_main)
读取数据文件,并将新抓取的通知信息中的链接部分处理为长链接,
-然后以通知链接为参照,与数据库中的数据进行对比,并将新通知写入数据库,
+
Data_processing(department_EN, data, url_main, message_type)
读取数据文件,并将新抓取的通知信息中的链接部分处理为长链接,
+然后以通知链接为参照,与文件/数据库中的数据进行对比,并将新通知写入文件/数据库,
返回检查更新的状态码与处理后的数据
 
Args:
-    subject_EN: 生成的数据文件的文件名
+    department_EN: 生成的数据文件的文件名
    data: 存储通知主要内容的列表,且该列表每个元素为字典
    例如:[{'title':'关于xxx的通知','date':'2017-03-10','link':'id=5'},
    {'title':'关于xxx的通知','date':'2017-03-10','link':'id=5'}]
    url_main: 单条通知的url的公共部分
+    message_type: 类型(通知/新闻)
Returns:
    status: 检查更新的状态码,无新通知时为0,首次抓取为-1,有新通知时通知条数
    new_data: 存储经处理后的通知内容的列表,且该列表每个元素为字典
        例如:[{'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com'},
    {'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com‘}]
-
Log_generate(status, data, subject_CN)
    依据检查更新的结果,生成不同的日志内容,并返回日志内容
+
Log_generate(status, data, department_CN, message_type)
依据检查更新的结果,生成不同的日志内容,并返回日志内容
 
-    Args:
-        data:存储通知提醒主要内容的列表,且该列表每个元素为字典
-        例如:[{'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com'},
-        {'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com'}]
-        subject_CN: 抓取的网站类型
-        status: 检查更新的状态码
+Args:
+    data:存储通知提醒主要内容的列表,且该列表每个元素为字典
+    例如:[{'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com'},
+    {'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com'}]
+    department_CN: 抓取的部门名称
+    status: 检查更新的状态码
 
-    Returns:
-        log_txt: 日志的主要内容,类型为字符串或每个元素均为列表的列表,且元素列表的元素均为字符串。
-        例如:'首次抓取师师大主页!
-','师大主页暂无新通知!
-'
-        [['关于xxx的通知','2017-03-10','http://xxxx.com'],['关于xxx的通知','2017-03-10','http://xxxx.com']]
-
Spider(url, url_main, rule, subject_CN, subject_EN, coding, flag=True)
爬取url的源码,并从中按照rule提供的正则表达式规则提取有用信息,并对数据进行处理,
+Returns:
+    log_txt: 日志的主要内容,类型为字符串或每个元素均为列表的列表,且元素列表的元素均为字符串。
+    例如:'首次抓取师师大主页!','师大主页暂无新通知!'
+    [['关于xxx的通知','2017-03-10','http://xxxx.com'],['关于xxx的通知','2017-03-10','http://xxxx.com']]
+
Save(new_data, department_EN, message_type)
将新抓取到的通知信息写入数据文件或数据库中

+Args:
+    new_data: 存储经处理后的通知内容的列表,且该列表每个元素为字典
+        例如:[{'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com'},
+    {'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com‘}]
+    department_EN: 生成的数据文件的文件名
+    message_type: 类型(通知/新闻)
+
Spider(dic, flag=True)
爬取url的源码,并从中按照rule提供的正则表达式规则提取有用信息,并对数据进行处理,
生成通知提醒的内容,在subject_EN+'_log.md'文件中记录日志,
返回检查更新的状态码,以及通知提醒的内容
若无新通知,则通知提醒的内容为空
diff --git a/Pydoc/sqlhelper.html b/Pydoc/sqlhelper.html index 89b987c..0147483 100644 --- a/Pydoc/sqlhelper.html +++ b/Pydoc/sqlhelper.html @@ -9,8 +9,13 @@  
sqlhelper
index
f:\code\python\school_notice\src\sqlhelper.py
-

Created on Oct 19, 2018
-@author: QiZhao

+

@author: QiZhao
+@contact: zhaoqi99@outlook.com
+@since: 2018-09-19
+@license: GNU GPLv3
+@version: 0.2.1
+@LastModifiedBy: jhy
+@LastModifiedDate: 2018-10-27

@@ -18,51 +23,91 @@ Modules -
       
os
-
pypyodbc
+
pymysql
+
re

- + +Classes - - +
 
-Functions
       
CreateDatabase(data_base)
判断当前路径是否存在数据库文件
-如果不存在,则尝试创建数据库文件,
-返回创建的结果
+
       
+
builtins.object +
+
+
SqlHelper +
+
+
+

+ + + + + + + +
 
+class SqlHelper(builtins.object)
   SqlHelper(target_ip, user_name, pwd)
 
+数据库帮助类,实现数据库的一些操作
Args:
-    data_base: 数据库文件的文件名
-Returns:
-    返回True或Flase
-
Execute(data_base, sql)
执行一条SQL语句,返回SQL语句执行后影响的行数
+    target_ip: 连接目标的ip
+    user_name: 数据库用户名
+    pwd: 数据库用户的密码
 
 Methods defined here:
+
CreateDatabase(self, db_name)
创建一个数据库.如果已存在该数据库,则删除该数据库后再创建
 
Args:
-    data_base: 数据库文件的文件名
+    db_name: 数据库名称
+Returns:
+    res: 返回True或Flase
+ +
Execute(self, db_name, sql)
执行一条SQL语句,返回SQL语句执行后影响的行数
+Args:
+    db_name: 数据库名称
    sql: SQL语句
Returns:
    res: SQL语句执行后影响的行数
-
ExistTable(data_base, table_name)
判断数据库中是否存在某张表,返回True或Flase
+ +
ExistDatabase(self, db_name)
判断是否存在某个数据库,返回True或Flase
 
Args:
-    data_base: 数据库文件的文件名
+    db_name: 数据库名称
+Returns: 返回True或Flase
+ +
ExistTable(self, db_name, table_name)
判断数据库中是否存在某张表,返回True或Flase
+Args:
+    db_name: 数据库名称
    table_name: 表名
Returns:
    返回True或Flase
-
FetchRow(data_base, sql, column)
执行一条sql语句,并从查询结果中筛选指定的某一列的所有内容

+ +
FetchAll(self, db_name, sql)
执行一条SQL语句,返回查询结果的所有行
Args:
-    data_base: 数据库文件的文件名
+    db_name: 数据库名称
    sql: SQL语句
-    column: 第几列,从0开始
Returns:
-    res: 一个list,包含指定列的所有结果
-
Fetchall(data_base, sql)
执行一条SQL语句,返回查询结果的所有行
+    res: 一个list,包含查询的结果,元素为元组,代表一行信息
+ +
FetchCol(self, db_name, table_name, sql, column)
执行一条sql语句,并从查询结果中筛选指定的某一列的所有内容
Args:
-    data_base: 数据库文件的文件名
+    db_name: 数据库名称
+    table_name: 表名
    sql: SQL语句
+    column: 第几列,从1开始
Returns:
-    res: 一个list,包含查询的结果,
-    元素为元组,代表一行信息
-
+    res: 一个list,包含指定列的所有结果 + +

__init__(self, target_ip, user_name, pwd)
Initialize self.  See help(type(self)) for accurate signature.
+ +
+Data descriptors defined here:
+
__dict__
+
dictionary for instance variables (if defined)
+
+
__weakref__
+
list of weak references to the object (if defined)
+
+

\ No newline at end of file diff --git a/Pydoc/tool.html b/Pydoc/tool.html index fe41ee2..af8cecd 100644 --- a/Pydoc/tool.html +++ b/Pydoc/tool.html @@ -9,11 +9,13 @@  
tool
index
f:\code\python\school_notice\src\tool.py
-

Created on Mar 8, 2018

-@author: QiZhao
+

@author: QiZhao
+@contact: zhaoqi99@outlook.com
+@since: 2018-05-08
@license: GNU GPLv3
-@version: 0.2.0

+@version: 0.3.0
+@LastModifiedBy: QiZhao
+@LastModifiedDate: 2018-12-24

@@ -37,7 +39,7 @@     subject: 生成的日志文件的文件名前缀,以及输出时显示在单条日志信息前的对日志类型的描述
    log_txt: 不带时间信息的日志内容,类型可以为字符串,每个元素均为列表(该列表中每个元素要求为字符串)的列表
    flag: 一个可选变量,决定是否在输出设备输出日志信息,默认为1(输出)
-    

Returns:
    返回由处理后的单条或多条日志信息组成的列表。
Mkdir(dir_name, flag=1)
获取到当前文件所在的目录,并检查是否有'dir_name'文件夹,
diff --git a/README.md b/README.md index d77638c..3a10898 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ An application of using python to check notifications update for various campus - [x] Send log、check udate log - [x] log function optional - [ ] The department which each user need to be reminded is optional -- [x] Database storage +- [x] Database storage/file storge ## Dependencies * [Python](http://www.python.org/) @@ -67,47 +67,70 @@ Whether logs can be logged in the log file, which is true by default ``` LOG_ENABLED = True ``` + +### Save Type Config +The type of storging data,including file storge,mysql storge +``` +SAVE_TYPE = 'MYSQL' +SAVE_TYPE = 'File' +``` +### Show Right Config +Whether show the information of copyright. +``` +SHOW_RIGHT = False +``` + ### Spider Config -Crawler configuration,including: department type (EN), department type (CN), "more notifications " page link, link public part, regular expression, Web page encoding format -subject_ENf: File name of data file -subject_CN: Used to display in logs, message headers +Crawler configuration,including: department type (EN), department type (CN), "more notifications " page link, link public part, regular expression, Web page encoding format,type(notice/news) +department_EN: File name of data file +department_CN: Used to display in logs, message headers **Warning: There must be three groups in the regular expression, which the name must be ` link,date,title`** Such as:`info/1085/(?P\d+\.htm)" target="_blank">(?P[\s\S]{5,100})((?P<date>\d*-\d*-\d*))` ```python SPIDER_CONFIG = [ -{ - 'subject_EN':'', - 'subject_CN':'', - 'url': '', - 'url_main' : '', - 'rule' : '', - 'coding':'' -}, -{ - 'subject_EN':'', - 'subject_CN':'', - 'url': '', - 'url_main' : '', - 'rule' : '', - 'coding':'' -} - ] + { + 'department_EN': '', + 'department_CN': '', + 'url': '', + 'url_main': '', + 'rule': '', + 'coding': '', + 'type': '' + }, + { + 'department_EN': '', + 'department_CN': '', + 'url': '', + 'url_main': '', + 'rule': '', + 'coding': '', + 'type': '' + } +] ``` Here is an example about crawler configuration: #### Example ```python SPIDER_CONFIG = [ -{ -'subject_EN':'snnu_index', 'subject_CN':'师大主页', 'url': 'http://www.snnu.edu.cn/tzgg.htm', 'url_main' : 'http://www.snnu.edu.cn/info/1085/', - 'rule' : 'info/1085/(?P<link>\d+\.htm)" target="_blank">(?P<title>[\s\S]{5,100})((?P<date>\d*-\d*-\d*))','coding':'utf-8'}, -{'subject_EN':'snnu_css', 'subject_CN':'计科院主页', 'url': 'http://ccs.snnu.edu.cn/tzgg.htm', 'url_main' : 'http://ccs.snnu.edu.cn/' -, 'rule' : '<a target="_blank" href="(?P<link>[^"]*)">(?P<title>[^( </)]*)[^"]*"[^>]*>(?P<date>\d*-\d*-\d*)','coding':'utf-8'}, -{'subject_EN':'snnu_jwc', 'subject_CN':'教务处主页', 'url': 'http://jwc.snnu.edu.cn/news_more.xhm?lm=2', 'url_main' : 'http://jwc.snnu.edu.cn/html/news_view.xhm?newsid=', - 'rule' : 'newsid=(?P<link>\d*)" [^ ]* title="(?P<title>[^(">)]*)[^<]*[^(]*\((?P<date>\d*/\d*/\d*)','coding':'gbk'}, -{'subject_EN':'snnu_xsc', 'subject_CN':'学生处主页', 'url': 'http://www.xsc.snnu.edu.cn/Announcements.asp', 'url_main' : 'http://www.xsc.snnu.edu.cn/Announcements.asp?id=144&bh=', - 'rule' : 'gk3">(?P<date>\d*-\d*-\d*)[^;]*;[^;]*;[^;]*;[^;]*;bh=(?P<link>\d*)[^>]*>(?P<title>[^</]*)','coding':'gbk'}, -{'subject_EN':'snnu_lib', 'subject_CN':'图书馆主页', 'url': 'http://www.lib.snnu.edu.cn/action.do?webid=w-d-bggg-l', 'url_main' : 'http://www.lib.snnu.edu.cn/action.do?webid=w-l-showmsg>ype=a&pid=', - 'rule' : 'pid=(?P<link>\d*)[\s\S]{20,57}>(?P<title>[^<]*)</[af][\S\s]{18,70}(?P<date>\d{4}-\d*-\d*)','coding':'utf-8'}] + { + 'department_EN': 'snnu_index', + 'department_CN': '学校主页', + 'url': 'http://www.snnu.edu.cn/tzgg.htm', + 'url_main': 'http://www.snnu.edu.cn/info/1085/', + 'rule': 'info/1085/(?P<link>\d+\.htm)" target="_blank">(?P<title>[\s\S]{5,100})((?P<date>\d*-\d*-\d*))', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_index', + 'department_CN': '学校主页', + 'url': 'http://www.snnu.edu.cn/sdxw.htm', + 'url_main': 'http://www.snnu.edu.cn/info/1084/', + 'rule': 'info/1084/(?P<link>\d+.htm)" target="_blank" title="(?P<title>[^"]+?)"><[^<]+?<[^<]+?<[^<]+?<p class="qh-wide-pushtime">(?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '新闻' + } +] ``` ## Packaging exe(Windows) 1. Install pywin32 @@ -120,6 +143,13 @@ SPIDER_CONFIG = [ 5. Go to the Dist folder and you can see the Main.exe `cd dist` +## Contributors + +Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)): + +| [<img src="https://avatars3.githubusercontent.com/u/7782671?v=4" width="100px;"/><br /><sub><b>Keyi Xie</b></sub>](https://xiekeyi98.github.io/)<br />[💻](https://github.com/ZhaoQi99/School_Notice/commits?author=xiekeyi98 "Code") [📖](https://github.com/ZhaoQi99/School_Notice/commits?author=xiekeyi98 "Documentation")| [<img src="https://avatars3.githubusercontent.com/u/40024866?v=4" width="100px;"/><br /><sub><b>jhy</b></sub>](https://Small-funny.github.io/)<br />[💻](https://github.com/ZhaoQi99/School_Notice/commits?author=Small-funny "Code") [📖](https://github.com/ZhaoQi99/School_Notice/commits?author=Small-funny "Documentation")| +| :---: | :---: | + ## License & Author * Author:Qi Zhao([zhaoqi99@outlook.com](mailto:zhaoqi99@outlook.com)) * License:[GNU General Public License v3.0](https://github.com/ZhaoQi99/School_Notice/blob/master/LICENSE) \ No newline at end of file diff --git a/README.zh-CN.md b/README.zh-CN.md index 4ee3415..faeb155 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -21,7 +21,7 @@ - [x] 发送日志、更新检查日志 - [x] 日志功能可选 - [ ] 每个用户要提醒的部门可选 -- [x] 数据库存储 +- [x] 数据库存储/文件存储 ## 依赖项 * [Python](http://www.python.org/) @@ -61,54 +61,75 @@ VERSION = '' AUTHOR_NAME = '' AUTHOR_EMAIL = '' ``` - ### Log Config 是否在日志文件中记录日志,默认为True ``` LOG_ENABLED = True ``` +### Save Type Config +数据存储类型,分为文件存储,数据库存储 +``` +SAVE_TYPE = 'MYSQL' +SAVE_TYPE = 'File' +``` +### Show Right Config +是否显示版权信息 +``` +SHOW_RIGHT = False +``` + ### Spider Config -爬虫的相关配置,包括:部门类型(EN),部门类型(CN)中,"更多通知"页的链接,链接的公共部分,正则表达式,网页编码格式 -subject_EN:数据文件的文件名 -subject_CN:用于在日志、邮件标题中显示 +爬虫的相关配置,包括:部门名称(EN),部门名称(CN)中,"更多通知"页的链接,链接的公共部分,正则表达式,网页编码格式,类型(通知/新闻) +department_EN:数据文件的文件名 +department_CN:用于在日志、邮件标题中显示 **警告:正则表达式中必须有三个分组,且名称必须为`link,date,title`** 如:`info/1085/(?P<link>\d+\.htm)" target="_blank">(?P<title>[\s\S]{5,100})((?P<date>\d*-\d*-\d*))` ```python SPIDER_CONFIG = [ -{ - 'subject_EN':'', - 'subject_CN':'', - 'url': '', - 'url_main' : '', - 'rule' : '', - 'coding':'' -}, -{ - 'subject_EN':'', - 'subject_CN':'', - 'url': '', - 'url_main' : '', - 'rule' : '', - 'coding':'' -} - ] + { + 'department_EN': '', + 'department_CN': '', + 'url': '', + 'url_main': '', + 'rule': '', + 'coding': '', + 'type': '' + }, + { + 'department_EN': '', + 'department_CN': '', + 'url': '', + 'url_main': '', + 'rule': '', + 'coding': '', + 'type': '' + } +] ``` 这里有一个爬虫配置的例子: #### 例子 ```python SPIDER_CONFIG = [ -{ -'subject_EN':'snnu_index', 'subject_CN':'师大主页', 'url': 'http://www.snnu.edu.cn/tzgg.htm', 'url_main' : 'http://www.snnu.edu.cn/info/1085/', - 'rule' : 'info/1085/(?P<link>\d+\.htm)" target="_blank">(?P<title>[\s\S]{5,100})((?P<date>\d*-\d*-\d*))','coding':'utf-8'}, -{'subject_EN':'snnu_css', 'subject_CN':'计科院主页', 'url': 'http://ccs.snnu.edu.cn/tzgg.htm', 'url_main' : 'http://ccs.snnu.edu.cn/' -, 'rule' : '<a target="_blank" href="(?P<link>[^"]*)">(?P<title>[^( </)]*)[^"]*"[^>]*>(?P<date>\d*-\d*-\d*)','coding':'utf-8'}, -{'subject_EN':'snnu_jwc', 'subject_CN':'教务处主页', 'url': 'http://jwc.snnu.edu.cn/news_more.xhm?lm=2', 'url_main' : 'http://jwc.snnu.edu.cn/html/news_view.xhm?newsid=', - 'rule' : 'newsid=(?P<link>\d*)" [^ ]* title="(?P<title>[^(">)]*)[^<]*[^(]*\((?P<date>\d*/\d*/\d*)','coding':'gbk'}, -{'subject_EN':'snnu_xsc', 'subject_CN':'学生处主页', 'url': 'http://www.xsc.snnu.edu.cn/Announcements.asp', 'url_main' : 'http://www.xsc.snnu.edu.cn/Announcements.asp?id=144&bh=', - 'rule' : 'gk3">(?P<date>\d*-\d*-\d*)[^;]*;[^;]*;[^;]*;[^;]*;bh=(?P<link>\d*)[^>]*>(?P<title>[^</]*)','coding':'gbk'}, -{'subject_EN':'snnu_lib', 'subject_CN':'图书馆主页', 'url': 'http://www.lib.snnu.edu.cn/action.do?webid=w-d-bggg-l', 'url_main' : 'http://www.lib.snnu.edu.cn/action.do?webid=w-l-showmsg>ype=a&pid=', - 'rule' : 'pid=(?P<link>\d*)[\s\S]{20,57}>(?P<title>[^<]*)</[af][\S\s]{18,70}(?P<date>\d{4}-\d*-\d*)','coding':'utf-8'}] + { + 'department_EN': 'snnu_index', + 'department_CN': '学校主页', + 'url': 'http://www.snnu.edu.cn/tzgg.htm', + 'url_main': 'http://www.snnu.edu.cn/info/1085/', + 'rule': 'info/1085/(?P<link>\d+\.htm)" target="_blank">(?P<title>[\s\S]{5,100})((?P<date>\d*-\d*-\d*))', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_index', + 'department_CN': '学校主页', + 'url': 'http://www.snnu.edu.cn/sdxw.htm', + 'url_main': 'http://www.snnu.edu.cn/info/1084/', + 'rule': 'info/1084/(?P<link>\d+.htm)" target="_blank" title="(?P<title>[^"]+?)"><[^<]+?<[^<]+?<[^<]+?<p class="qh-wide-pushtime">(?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '新闻' + } +] ``` ## 打包exe(Windows) 1. 安装pywin32 @@ -121,6 +142,13 @@ SPIDER_CONFIG = [ 5. 进入dist文件夹,可以看到main.exe `cd dist` +## 贡献者 + +感谢所有对本项目做出过贡献的开发者([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)): + +| [<img src="https://avatars3.githubusercontent.com/u/7782671?v=4" width="100px;"/><br /><sub><b>Keyi Xie</b></sub>](https://xiekeyi98.github.io/)<br />[💻](https://github.com/ZhaoQi99/School_Notice/commits?author=xiekeyi98 "Code") [📖](https://github.com/ZhaoQi99/School_Notice/commits?author=xiekeyi98 "Documentation")| [<img src="https://avatars3.githubusercontent.com/u/40024866?v=4" width="100px;"/><br /><sub><b>jhy</b></sub>](https://Small-funny.github.io/)<br />[💻](https://github.com/ZhaoQi99/School_Notice/commits?author=Small-funny "Code") [📖](https://github.com/ZhaoQi99/School_Notice/commits?author=Small-funny "Documentation")| +| :---: | :---: | + ## 开源协议 & 作者 * 作者:Qi Zhao([zhaoqi99@outlook.com](mailto:zhaoqi99@outlook.com)) * 开源协议:[GNU General Public License v3.0](https://github.com/ZhaoQi99/School_Notice/blob/master/LICENSE) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..22485a8 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,13 @@ +beautifulsoup4==4.6.3 +bs4==0.0.1 +certifi==2018.11.29 +chardet==3.0.4 +idna==2.8 +PyJWT==1.7.1 +PyMySQL==0.9.3 +PySocks==1.6.8 +pytz==2018.7 +requests==2.21.0 +six==1.12.0 +twilio==6.22.0 +urllib3==1.24.1 diff --git a/src/configs.py b/src/configs.py index 9a55528..9067984 100644 --- a/src/configs.py +++ b/src/configs.py @@ -1,11 +1,19 @@ # encoding='utf-8' ''' -Created on Sep 19, 2018 - @author: QiZhao +@contact: zhaoqi99@outlook.com +@since: 2018-09-19 @license: GNU GPLv3 -@version: 0.2.0 +@version: 0.3.0 +@LastModifiedBy: QiZhao +@LastModifiedDate: 2018-12-24 ''' +# show right +SHOW_RIGHT=False + +# save type +# File/MySQL +SAVE_TYPE='MYSQL' # show config SCHOOL_NAME = '' @@ -29,22 +37,6 @@ # spider config SPIDER_CONFIG = [ - { - 'subject_EN': '', - 'subject_CN': '', - 'url': '', - 'url_main': '', - 'rule': '', - 'coding': '' - }, - { - 'subject_EN': '', - 'subject_CN': '', - 'url': '', - 'url_main': '', - 'rule': '', - 'coding': '' - } ] # we_chat config @@ -53,3 +45,8 @@ APPID = ' ' SECRET = ' ' +# mysql config +TARGET_IP='' +SQL_USERNAME='' +SQL_PASSWORD='' +DATABASE_NAME='' diff --git a/src/main.py b/src/main.py index 2eb492b..c6a72a3 100644 --- a/src/main.py +++ b/src/main.py @@ -1,29 +1,25 @@ # encoding='utf-8' -import configs ''' -Created on Mar 8, 2018 - @author: QiZhao +@contact: zhaoqi99@outlook.com +@since: 2018-05-08 @license: GNU GPLv3 -@version: 0.2.0 +@version: 0.3.0 +@LastModifiedBy: QiZhao +@LastModifiedDate: 2018-10-27 ''' +import configs from spider import Spider import time from tool import Mkdir, Mkfile, Log_Write import os from traceback import format_exc import send -from sqlhelper import CreateDatabase - def Init(): '''首次使用时,程序初始化''' Mkdir('Log') Mkdir('Data') Mkfile('Log/' + 'Exception_log.log') - # 新建数据库 - database_name='database' - if CreateDatabase(database_name)==True: - Log_Write('新建文件', database_name + '\n') File_Path = os.getcwd() + '\\Data\\user.md' if not os.path.exists(File_Path): # 不存在user.md文件 @@ -50,13 +46,13 @@ def Show_right(): print('本程序仅供学习和研究使用,不得用于任何商业用途.') print('如您在使用中遇到任何问题,可联系作者邮箱: ' + configs.AUTHOR_EMAIL) print('请按回车键继续......', end='') - input() print('---------------------------------------------------') print(configs.SCHOOL_NAME + '校园通知自动提醒程序启动!') def main(): - Show_right() + if configs.SHOW_RIGHT: + Show_right() Init() f_obj = open('Data' + '/user.md') send_number = f_obj.readline() @@ -67,11 +63,10 @@ def main(): while(True): for dic in configs.SPIDER_CONFIG: try: - status, new_data = Spider(dic['url'], dic['url_main'], dic['rule'], dic['subject_CN'], - dic['subject_EN'], dic['coding'], configs.LOG_ENABLED) + status, new_data = Spider(dic, configs.LOG_ENABLED) if status >= 1: - send.Send(new_data, dic[ - 'subject_CN'], send_number, to_addr_str, configs.LOG_ENABLED) + send.Send(new_data, dic['department_CN'], + send_number, to_addr_str, dic['type'],configs.LOG_ENABLED) except Exception as e: print('Exception: ', e) Error_log = '异常信息如下:\n' + format_exc() + '-' * 70 + '\n' diff --git a/src/send.py b/src/send.py index 66a85a0..82f640c 100644 --- a/src/send.py +++ b/src/send.py @@ -1,11 +1,13 @@ -import twilio ''' -Created on Mar 7, 2018 - @author: QiZhao +@contact: zhaoqi99@outlook.com +@since: 2018-05-07 @license: GNU GPLv3 -@version: 0.2.0 +@version: 0.3.0 +@LastModifiedBy: QiZhao +@LastModifiedDate: 2018-10-24 ''' +import twilio from twilio.rest import Client from email.mime.text import MIMEText import smtplib @@ -13,6 +15,7 @@ import configs import requests import json +import time def Send_sms(send_number, msg): ''' @@ -132,18 +135,18 @@ def send_to_wechat(str='default_words!'): }, "msgtype":"text" } - url="https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token="+get_token() try: + url="https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token="+get_token() jsonstr = json.dumps(pay_send_all,ensure_ascii=False,indent = 2 ) ; # 转换到json,注意处理中文的unicode headers = {'content-type': 'text/json','charset':'utf-8'} # 加http header,命令以utf-8解析 r=requests.post(url=url,data=jsonstr.encode('utf-8') , headers=headers ) # result=r.json() log_send_wechat = '微信发送成功' - except ConnectionError: + except Exception: log_send_wechat = '微信发送失败' return log_send_wechat -def Send(msgs, subject, send_number, to_addr_str, flag=True): +def Send(msgs, subject, send_number, to_addr_str, message_type,flag=True): ''' 向手机号码为send_number的人发送通知信息 向to_addr_str中的邮箱地址发送主题为subject的通知信息 @@ -158,20 +161,20 @@ def Send(msgs, subject, send_number, to_addr_str, flag=True): send_number: 短信接收者的手机号码 to_addr_str: 收件人的邮箱地址,多个邮箱地址之间应以','分割,类型为字符串 例如:'example@qq.com','example1@qq.com,example2@qq.com' + message_type: 类型(通知/新闻) flag: 一个可选变量,用来决定是否在发送日志中记录此次发送信息,默认为True(记录) ''' - temp = '' log_send = [] # log_send=['test\n'] # Only for test for msg in msgs: - temp = subject + '有新通知了,快去看看吧' + '\n' + '标题:' + msg['title']\ - + '\n' + '时间:' + msg['date'] + '\n' + '查看:' + msg['link'] + temp="{}有新{},快去看看吧\n标题:{}\n时间:{}\n查看:{}".format( + subject,message_type,msg['title'],msg['date'],msg['link']) log_send_sms = [] log_send_email = [] - log_send_wechat = [] + log_send_wechat = [] log_send_sms.append(Send_sms(send_number, temp)) - log_send_email.append(Send_email(temp, to_addr_str, subject + '更新通知')) + log_send_email.append(Send_email(temp, to_addr_str, subject+message_type+'更新'+tool.time_text())) log_send_wechat.append(send_to_wechat(temp)) log_send.append(log_send_sms) log_send.append(log_send_email) diff --git a/src/spider.py b/src/spider.py index 901698b..b10adc1 100644 --- a/src/spider.py +++ b/src/spider.py @@ -1,10 +1,13 @@ # encoding='utf-8' +import configs ''' -Created on Mar 7, 2018 - @author: QiZhao +@contact: zhaoqi99@outlook.com +@since: 2018-05-07 @license: GNU GPLv3 -@version: 0.2.0 +@version: 0.3.0 +@LastModifiedBy: QiZhao +@LastModifiedDate: 2018-12-24 ''' import urllib.request import re @@ -24,7 +27,6 @@ def Spider_data(url, rule, coding='utf-8'): 例如:[{'title':'关于xxx的通知','date':'2017-03-10','link':'id=5'}, {'title':'关于xxx的通知','date':'2017-03-10','link':'id=5'}] ''' - response = urllib.request.urlopen(url) data = response.read().decode(coding) pattern = re.compile(rule, re.S) @@ -35,18 +37,19 @@ def Spider_data(url, rule, coding='utf-8'): return data_use -def Data_processing(subject_EN, data, url_main): +def Data_processing(department_EN, data, url_main,message_type): ''' 读取数据文件,并将新抓取的通知信息中的链接部分处理为长链接, - 然后以通知链接为参照,与数据库中的数据进行对比,并将新通知写入数据库, + 然后以通知链接为参照,与文件/数据库中的数据进行对比,并将新通知写入文件/数据库, 返回检查更新的状态码与处理后的数据 Args: - subject_EN: 生成的数据文件的文件名 + department_EN: 生成的数据文件的文件名 data: 存储通知主要内容的列表,且该列表每个元素为字典 例如:[{'title':'关于xxx的通知','date':'2017-03-10','link':'id=5'}, {'title':'关于xxx的通知','date':'2017-03-10','link':'id=5'}] url_main: 单条通知的url的公共部分 + message_type: 类型(通知/新闻) Returns: status: 检查更新的状态码,无新通知时为0,首次抓取为-1,有新通知时通知条数 new_data: 存储经处理后的通知内容的列表,且该列表每个元素为字典 @@ -57,41 +60,101 @@ def Data_processing(subject_EN, data, url_main): # 处理为长网址 for item_dict in data: item_dict['link'] = url_main + item_dict['link'] - - table_name = subject_EN - if sqlhelper.ExistTable('database', table_name) == False: - sql = 'CREATE TABLE' + ' ' + table_name + \ - '(link Text PRIMARY KEY,title Text,datee Text)' - sqlhelper.Execute('database', sql) - - # 收集所有的link信息 - sql = 'select * from' + ' ' + table_name - all_link = sqlhelper.FetchRow('database', sql, 0) - + # 生成新数据 status = 0 # 是否有新通知的标志 new_data = [] - for item in data: - if item['link'] not in all_link: - item['date'] = item['date'].replace('/', '-') # 将日期统一转换为yy-mm-dd格式 - status += 1 - new_data.append(item) - if len(all_link) == 0: # 首次抓取 - status = -1 - - # Todo: 解决频繁开启关闭数据库的问题 - # Todo: 异常处理 - - # 将新抓取到的通知信息写入数据文件 - for item in new_data: - sql = "insert into" + " " + table_name + "(link,title,datee) values ('%s','%s','%s')" % ( - item['link'], item['title'], item['date']) -# print(sql) - sqlhelper.Execute('database', sql) + + if configs.SAVE_TYPE.upper()=="FILE": + if message_type=="通知": + file = "Data/{}_{}.md".format(department_EN,"notice") + else: + file="Data/{}_{}.md".format(department_EN,"news") + tool.Mkfile(file) # 初次抓取时新建数据文件 + f_before = open(file, 'rb') # 读取数据文件中的通知信息 + txt_before = f_before.read().decode('utf-8') + f_before.close() + + # 收集所有的link信息 + all_link = [] + split_rule = '(?P<title>[^ ]*) (?P<date>\d*-\d*-\d*) (?P<link>[^\n]*)\n' + pattern = re.compile(split_rule, re.S) + data_before = pattern.finditer(txt_before) + for item in data_before: + dic = item.groupdict() + all_link.append(dic['link']) + + for item in data: + if item['link'] not in all_link: + item['date'] = item['date'].replace('/', '-') # 将日期统一转换为yy-mm-dd格式 + status += 1 + new_data.append(item) + + elif configs.SAVE_TYPE.upper()=="MYSQL": + helper = sqlhelper.SqlHelper( + configs.TARGET_IP, configs.SQL_USERNAME, configs.SQL_PASSWORD) + if helper.ExistDatabase(configs.DATABASE_NAME)==False: + helper.CreateDatabase(configs.DATABASE_NAME) + + table_name = department_EN + if helper.ExistTable(configs.DATABASE_NAME, table_name) == False: + sql = 'CREATE TABLE' + ' ' + table_name + \ + '(id int PRIMARY KEY AUTO_INCREMENT,link Text,title Text,date Text,type Text)' + helper.Execute(configs.DATABASE_NAME, sql) + + sql = "select count(*) from" + " " + table_name+" where type='"+message_type+"'" + link_count = helper.FetchCol(configs.DATABASE_NAME, table_name,sql,1)[0] + + for item in data: + temp_sql="select * from" + " " + table_name+" where link='"+item['link']+"'" + ret=helper.FetchCol(configs.DATABASE_NAME, table_name,temp_sql, 2) + if len(ret)==0: + item['date'] = item['date'].replace('/', '-') # 将日期统一转换为yy-mm-dd格式 + item['type']=message_type + status += 1 + new_data.append(item) + + if link_count == 0: # 首次抓取 + status = -1 return status, new_data +def Save(new_data,department_EN,message_type): + ''' + 将新抓取到的通知信息写入数据文件或数据库中 -def Log_generate(status, data, subject_CN): + Args: + new_data: 存储经处理后的通知内容的列表,且该列表每个元素为字典 + 例如:[{'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com'}, + {'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com‘}] + department_EN: 生成的数据文件的文件名 + message_type: 类型(通知/新闻) + ''' + if configs.SAVE_TYPE.upper()=="FILE": + if message_type=="通知": + file = "Data/{}_{}.md".format(department_EN,"notice") + else: + file="Data/{}_{}.md".format(department_EN,"news") + + # 存储到文件中 + f_temp = open(file, 'ab') + for item in new_data: + f_temp.write(item['title'].encode('utf-8')) + f_temp.write(" ".encode('utf-8') + item['date'].encode('utf-8')) + f_temp.write(" ".encode('utf-8') + item['link'].encode('utf-8')) + f_temp.write("\n".encode('utf-8')) + f_temp.close() + + elif configs.SAVE_TYPE.upper()=="MYSQL": + table_name=department_EN + helper = sqlhelper.SqlHelper( + configs.TARGET_IP, configs.SQL_USERNAME, configs.SQL_PASSWORD) + for item in new_data: + sql = "insert into" + " " + table_name + "(link,title,date,type) values ('%s','%s','%s','%s')" % ( + item['link'], item['title'], item['date'],item['type']) + helper.Execute(configs.DATABASE_NAME, sql) + return True + +def Log_generate(status, data, department_CN,message_type): ''' 依据检查更新的结果,生成不同的日志内容,并返回日志内容 @@ -99,18 +162,18 @@ def Log_generate(status, data, subject_CN): data:存储通知提醒主要内容的列表,且该列表每个元素为字典 例如:[{'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com'}, {'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com'}] - subject_CN: 抓取的网站类型 + department_CN: 抓取的部门名称 status: 检查更新的状态码 Returns: log_txt: 日志的主要内容,类型为字符串或每个元素均为列表的列表,且元素列表的元素均为字符串。 - 例如:'首次抓取师师大主页!\n','师大主页暂无新通知!\n' + 例如:'首次抓取师师大主页!','师大主页暂无新通知!' [['关于xxx的通知','2017-03-10','http://xxxx.com'],['关于xxx的通知','2017-03-10','http://xxxx.com']] ''' if status == -1: - log_txt = '首次抓取' + subject_CN + '!\n' + log_txt = '首次抓取{}:{}!'.format(department_CN,message_type) elif status == 0: - log_txt = subject_CN + "暂无新通知!" + '\n' + log_txt = "{}暂无新{}!".format(department_CN,message_type) else: log_txt = [] for dic in data: @@ -122,7 +185,7 @@ def Log_generate(status, data, subject_CN): return log_txt -def Spider(url, url_main, rule, subject_CN, subject_EN, coding, flag=True): +def Spider(dic, flag=True): ''' 爬取url的源码,并从中按照rule提供的正则表达式规则提取有用信息,并对数据进行处理, 生成通知提醒的内容,在subject_EN+'_log.md'文件中记录日志, @@ -144,10 +207,14 @@ def Spider(url, url_main, rule, subject_CN, subject_EN, coding, flag=True): 例如:[{'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com'}, {'title':'关于xxx的通知','date':'2017-03-10','link':'http://xxxx.com'}] ''' - data_use = Spider_data(url, rule, coding) - status, new_data = Data_processing(subject_EN, data_use, url_main) - - log_txt = Log_generate(status, new_data, subject_CN) + data_use = Spider_data(dic['url'], dic['rule'], dic['coding']) + status, new_data = Data_processing(dic['department_EN'], data_use, dic['url_main'],dic['type']) + Save(new_data, dic['department_EN'], dic['type']) + log_txt = Log_generate(status, new_data, dic['department_CN'],dic['type']) if flag == True: - tool.Log_Write(subject_EN, log_txt) + if dic['type']=="通知": + tool.Log_Write(dic['department_EN']+"_notice", log_txt) + else: + tool.Log_Write(dic['department_EN']+"_news", log_txt) + return status, new_data diff --git a/src/sqlhelper.py b/src/sqlhelper.py index 25a318b..60bd6b3 100644 --- a/src/sqlhelper.py +++ b/src/sqlhelper.py @@ -1,137 +1,181 @@ ''' -Created on Oct 19, 2018 @author: QiZhao +@contact: zhaoqi99@outlook.com +@since: 2018-09-19 +@license: GNU GPLv3 +@version: 0.2.1 +@LastModifiedBy: jhy +@LastModifiedDate: 2018-10-27 ''' -import pypyodbc -import os +import pymysql +import re -def ExistTable(data_base, table_name): +class SqlHelper(): ''' - 判断数据库中是否存在某张表,返回True或Flase - + 数据库帮助类,实现数据库的一些操作 Args: - data_base: 数据库文件的文件名 - table_name: 表名 - Returns: - 返回True或Flase - ''' - - path = os.getcwd() + "\\" + data_base + ".mdb" - try: - connection = pypyodbc.win_connect_mdb(path) - cursor = connection.cursor() - res = cursor.tables() - tables = [] - for i in res: - tables.append(i[2]) - if table_name in tables: - return True - else: - return False - except Exception as e: - connection.rollback() - connection.close() - raise e - - -def Execute(data_base, sql): + target_ip: 连接目标的ip + user_name: 数据库用户名 + pwd: 数据库用户的密码 ''' - 执行一条SQL语句,返回SQL语句执行后影响的行数 - - Args: - data_base: 数据库文件的文件名 - sql: SQL语句 - Returns: - res: SQL语句执行后影响的行数 - ''' - - path = os.getcwd() + "\\" + data_base + ".mdb" - try: - connection = pypyodbc.win_connect_mdb(path) - cursor = connection.cursor() - res = cursor.execute(sql) - connection.commit() - connection.close() - return res - except Exception as e: - connection.rollback() - connection.close() - raise e - -def CreateDatabase(data_base): - ''' - 判断当前路径是否存在数据库文件 - 如果不存在,则尝试创建数据库文件, - 返回创建的结果 - - Args: - data_base: 数据库文件的文件名 - Returns: - 返回True或Flase - ''' - path = os.getcwd() + "\\" + data_base + ".mdb" - try: - if not os.path.exists(path): - connection = pypyodbc.win_create_mdb(path) + def __init__(self, target_ip, user_name, pwd): + self.target_ip = target_ip + self.user_name = user_name + self.pwd = pwd + + def ExistTable(self, db_name, table_name): + ''' + 判断数据库中是否存在某张表,返回True或Flase + Args: + db_name: 数据库名称 + table_name: 表名 + Returns: + 返回True或Flase + ''' + try: + connection = pymysql.connect( + host=self.target_ip, user=self.user_name, passwd=self.pwd, db=db_name) + cursor = connection.cursor() + sql = 'show tables;' + cursor.execute(sql) + tables = [cursor.fetchall()] + table_list = re.findall('(\'.*?\')', str(tables)) + table_list = [re.sub("'", '', each) for each in table_list] + if table_name in table_list: + return True + else: + return False + except Exception as e: + connection.rollback() connection.close() - return True - return False - except Exception as e: - raise e - - -def Fetchall(data_base, sql): - ''' - 执行一条SQL语句,返回查询结果的所有行 - Args: - data_base: 数据库文件的文件名 - sql: SQL语句 - Returns: - res: 一个list,包含查询的结果, - 元素为元组,代表一行信息 - ''' - path = os.getcwd() + "\\" + data_base + ".mdb" - try: - connection = pypyodbc.win_connect_mdb(path) - cursor = connection.cursor() - cursor.execute(sql) - res = cursor.fetchall() - connection.close() - return res - except Exception as e: - connection.rollback() - connection.close() - raise e - - -def FetchRow(data_base, sql, column): - ''' - 执行一条sql语句,并从查询结果中筛选指定的某一列的所有内容 - - Args: - data_base: 数据库文件的文件名 - sql: SQL语句 - column: 第几列,从0开始 - Returns: - res: 一个list,包含指定列的所有结果 - ''' - path = os.getcwd() + "\\" + data_base + ".mdb" - try: - connection = pypyodbc.win_connect_mdb(path) - cursor = connection.cursor() - cursor.execute(sql) - row_count = cursor._NumOfCols() - if column >= row_count: - raise IndexError - res = cursor.fetchall() - ret = [] - for col in res: - ret.append(col[column]) - connection.close() - return ret - except Exception as e: - connection.rollback() - connection.close() - raise e + raise e + + def Execute(self, db_name, sql): + ''' + 执行一条SQL语句,返回SQL语句执行后影响的行数 + Args: + db_name: 数据库名称 + sql: SQL语句 + Returns: + res: SQL语句执行后影响的行数 + ''' + try: + connection = pymysql.connect( + host=self.target_ip, user=self.user_name, passwd=self.pwd, db=db_name) + cursor = connection.cursor() + res = cursor.execute(sql) + connection.commit() + connection.close() + return res + except Exception as e: + connection.rollback() + connection.close() + raise e + + def FetchAll(self, db_name, sql): + ''' + 执行一条SQL语句,返回查询结果的所有行 + Args: + db_name: 数据库名称 + sql: SQL语句 + Returns: + res: 一个list,包含查询的结果,元素为元组,代表一行信息 + ''' + try: + connection = pymysql.connect( + host=self.target_ip, user=self.user_name, passwd=self.pwd, db=db_name) + cursor = connection.cursor() + cursor.execute(sql) + res = cursor.fetchall() + connection.close() + return res + except Exception as e: + connection.rollback() + connection.close() + raise e + + def FetchCol(self, db_name, table_name, sql, column): + ''' + 执行一条sql语句,并从查询结果中筛选指定的某一列的所有内容 + Args: + db_name: 数据库名称 + table_name: 表名 + sql: SQL语句 + column: 第几列,从1开始 + Returns: + res: 一个list,包含指定列的所有结果 + ''' + try: + connection = pymysql.connect( + host=self.target_ip, user=self.user_name, passwd=self.pwd, db=db_name) + cursor = connection.cursor() + temp_sql = "select count(*) from information_schema.columns where table_schema='" + \ + db_name + "' and table_name='" + table_name+"'" + cursor.execute(temp_sql) + tup=cursor.fetchone() + col_count=int(tup[0]) + if column > col_count or column < 1: + raise IndexError + cursor.execute(sql) + res = cursor.fetchall() + ret = [] + column-=1 + for col in res: + ret.append(col[column]) + connection.close() + return ret + except Exception as e: + connection.rollback() + connection.close() + raise e + + def CreateDatabase(self,db_name): + ''' + 创建一个数据库.如果已存在该数据库,则删除该数据库后再创建 + + Args: + db_name: 数据库名称 + Returns: + res: 返回True或Flase + ''' + try: + connection = pymysql.connect( + host=self.target_ip, user=self.user_name, passwd=self.pwd) + cursor = connection.cursor() + sql='DROP DATABASE '+db_name + cursor.execute(sql) + sql='CREATE DATABASE if not exists '+db_name + cursor.execute(sql) + connection.commit() + connection.close() + except Exception as e: + connection.rollback() + connection.close() + raise e + + def ExistDatabase(self,db_name): + ''' + 判断是否存在某个数据库,返回True或Flase + + Args: + db_name: 数据库名称 + Returns: 返回True或Flase + ''' + try: + connection = pymysql.connect( + host=self.target_ip, user=self.user_name, passwd=self.pwd) + cursor = connection.cursor() + cursor.execute('show databases') + databases = cursor.fetchall() + database_list=re.findall('(\'.*?\')', str(databases)) + database_list = [re.sub("'", '', each) for each in database_list] + if db_name in database_list: + return True + else: + return False + except Exception as e: + connection.rollback() + connection.close() + raise e diff --git a/src/tool.py b/src/tool.py index 11db7b5..4439ef2 100644 --- a/src/tool.py +++ b/src/tool.py @@ -1,11 +1,14 @@ # encoding='utf-8' ''' -Created on Mar 8, 2018 - @author: QiZhao +@contact: zhaoqi99@outlook.com +@since: 2018-05-08 @license: GNU GPLv3 -@version: 0.2.0 +@version: 0.3.0 +@LastModifiedBy: QiZhao +@LastModifiedDate: 2018-12-24 ''' + import time import os @@ -39,7 +42,7 @@ def Log_Write(subject, log_txt, flag=1): log_show = '' log_return = [] if(type(log_txt) == str): # 处理第一次爬取或无新通知时的日志的写入 - temp = time_text() + ' ' + log_txt + temp = time_text() + ' ' + log_txt+"\n" log_show = subject + ':' + temp log_return.append(temp) file.write(temp) @@ -69,7 +72,7 @@ def Mkdir(dir_name, flag=1): File_Path = os.getcwd() + '/' + dir_name + '/' if not os.path.exists(File_Path): os.makedirs(File_Path) - Log_Write('新建文件夹', File_Path + '\n', flag) + Log_Write('新建文件夹', File_Path, flag) def Mkfile(fname, flag=1): @@ -85,4 +88,4 @@ def Mkfile(fname, flag=1): if not os.path.exists(fname): fobj = open(fname, 'w') fobj.close() - Log_Write('新建文件', fname + '\n', flag) + Log_Write('新建文件', fname, flag) diff --git a/test/configs_sample1.py b/test/configs_sample1.py new file mode 100644 index 0000000..7bd2096 --- /dev/null +++ b/test/configs_sample1.py @@ -0,0 +1,502 @@ +# encoding='utf-8' +''' +@author: QiZhao +@contact: zhaoqi99@outlook.com +@since: 2018-09-19 +@license: GNU GPLv3 +@version: 0.3.0 +@LastModifiedBy: QiZhao +@LastModifiedDate: 2018-12-24 +''' +# show right +SHOW_RIGHT=False + +# save type +# File/MySQL +SAVE_TYPE='File' + +# show config +SCHOOL_NAME = '' +VERSION = '' +AUTHOR_NAME = '' +AUTHOR_EMAIL = '' + +# twillo config +ACCOUNT_ID = '' +AUTH_TOKEN = '' +TWILIO_NUMBER = '' + +# send_email config +FROM_ADDR = "" +PASSWORD = "" +EMAIL_PORT = 0 +EMAIL_SERVER = '' + +# Log Config +LOG_ENABLED = True + +# spider config +SPIDER_CONFIG = [ + { + 'department_EN': 'snnu_index', + 'department_CN': '学校主页', + 'url': 'http://www.snnu.edu.cn/tzgg.htm', + 'url_main': 'http://www.snnu.edu.cn/info/1085/', + 'rule': 'info/1085/(?P<link>\d+\.htm)" target="_blank">(?P<title>[\s\S]{5,100})((?P<date>\d*-\d*-\d*))', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_index', + 'department_CN': '学校主页', + 'url': 'http://www.snnu.edu.cn/sdxw.htm', + 'url_main': 'http://www.snnu.edu.cn/info/1084/', + 'rule': 'info/1084/(?P<link>\d+.htm)" target="_blank" title="(?P<title>[^"]+?)"><[^<]+?<[^<]+?<[^<]+?<p class="qh-wide-pushtime">(?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_css', + 'department_CN': '计算机科学学院', + 'url': 'http://ccs.snnu.edu.cn/tzgg.htm', + 'url_main': 'http://ccs.snnu.edu.cn/', + 'rule': '<a target="_blank" href="(?P<link>[^"]*)">(?P<title>[^<]*)<[^"]*"[^>]*>(?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_css', + 'department_CN': '计算机科学学院', + 'url': 'http://ccs.snnu.edu.cn/xydt.htm', + 'url_main': 'http://ccs.snnu.edu.cn/', + 'rule': '<a target="_blank" href="(?P<link>[^"]*)">(?P<title>[^<]*?)<[^"]*"[^>]*>(?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_jwc', + 'department_CN': '教务处', + 'url': 'http://jwc.snnu.edu.cn/news_more.xhm?lm=2', + 'url_main': 'http://jwc.snnu.edu.cn/html/news_view.xhm?newsid=', + 'rule': 'newsid=(?P<link>\d*)" [^ ]* title="(?P<title>[^(">)]*)[^<]*[^(]*\((?P<date>\d*/\d*/\d*)', + 'coding': 'gbk', + 'type': '通知' + }, + { + 'department_EN': 'snnu_jwc', + 'department_CN': '教务处', + 'url': 'http://jwc.snnu.edu.cn/news_more.xhm?lm=1', + 'url_main': 'http://jwc.snnu.edu.cn/html/news_view.xhm?newsid=', + 'rule': 'newsid=(?P<link>\d*)" [^ ]* title="(?P<title>[^(">)]*)[^<]*[^(]*\((?P<date>\d*/\d*/\d*)', + 'coding': 'gbk', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_xsc', + 'department_CN': '学生处', + 'url': 'http://www.xsc.snnu.edu.cn/Announcements.asp', + 'url_main': 'http://www.xsc.snnu.edu.cn/Announcements.asp?id=144&bh=', + 'rule': 'gk3">(?P<date>\d*-\d*-\d*)[^;]*;[^;]*;[^;]*;[^;]*;bh=(?P<link>\d*)[^>]*>(?P<title>[^</]*)', + 'coding': 'gbk', + 'type': '通知' + }, + { + 'department_EN': 'snnu_xsc', + 'department_CN': '学生处', + 'url': 'http://www.xsc.snnu.edu.cn/News.asp', + 'url_main': 'http://www.xsc.snnu.edu.cn/News.asp?id=159&bh=', + 'rule': 'gk3">(?P<date>\d*-\d*-\d*)[^;]*;[^;]*;[^;]*;[^;]*;bh=(?P<link>\d*)[^>]*>(?P<title>[^</]*)', + 'coding': 'gbk', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_lib', + 'department_CN': '图书馆', + 'url': 'http://www.lib.snnu.edu.cn/action.do?webid=w-d-bggg-l', + 'url_main': 'http://www.lib.snnu.edu.cn/action.do?webid=w-l-showmsg>ype=a&pid=', + 'rule': 'pid=(?P<link>\d*)[\s\S]{20,57}>(?P<title>[^<]*)</[af][\S\s]{18,70}(?P<date>\d{4}-\d*-\d*)', + 'coding': 'utf-8', + 'type':'通知' + }, + { + 'department_EN': 'snnu_lib', + 'department_CN': '图书馆', + 'url': 'http://www.lib.snnu.edu.cn/action.do?webid=w-d-bgxw-l', + 'url_main': 'http://www.lib.snnu.edu.cn/action.do?webid=w-l-showmsg>ype=a&pid=', + 'rule': 'pid=(?P<link>\d*)[\s\S]{20,57}>(?P<title>[^<]*)</[af][\S\s]{18,70}(?P<date>\d{4}-\d*-\d*)', + 'coding': 'utf-8', + 'type':'新闻' + }, + { + 'department_EN': 'snnu_clxy', + 'department_CN': '材料科学与工程学院', + 'url': 'http://clxy.snnu.edu.cn/home/list/?bh=008', + 'url_main': 'http://clxy.snnu.edu.cn/Home/show/', + 'rule': 'show[/](?P<link>\d*)"[\s\S]{1,}?"(?P<title>[\s\S]{1,}?)"[^<]{1,}?</a>[\S\s]{1,200}<td align="center">[^\d]*(?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_clxy', + 'department_CN': '材料科学与工程学院', + 'url': 'http://clxy.snnu.edu.cn/home/list/?bh=009', + 'url_main': 'http://clxy.snnu.edu.cn/Home/show/', + 'rule': 'show[/](?P<link>\d*)"[\s\S]{1,}?"(?P<title>[\s\S]{1,}?)"[^<]{1,}?</a>[\S\s]{1,200}<td align="center">[^\d]*(?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_marxism', + 'department_CN': '马克思主义学院', + 'url': 'http://marxism.snnu.edu.cn/tzgg/tzgg.htm', + 'url_main': 'http://marxism.snnu.edu.cn/info/1062/', + 'rule': 'class="fr">(?P<date>\d*-\d*-\d*)</span>[\s]+?<a href="../info/1062/(?P<link>\d+.htm)" target="_blank" title="(?P<title>[^"]+?)">', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_marxism', + 'department_CN': '马克思主义学院', + 'url': 'http://marxism.snnu.edu.cn/xyxw/xyxw.htm', + 'url_main': 'http://marxism.snnu.edu.cn/info/1062/', + 'rule': 'href="../info/1061/(?P<link>\d+.htm)" target="_blank" title="(?P<title>[^"]+?)">[\S]+[\s]+?<h2>(?P<date>\d*-\d*-\d*)<', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_lit', + 'department_CN': '文学院', + 'url': 'http://www.lit.snnu.edu.cn/index.php?m=content&c=index&a=lists&catid=62', + 'url_main': 'http://www.lit.snnu.edu.cn/index.php?m=content&c=index&a=show&catid=', + 'rule': 'show&catid=(?P<link>\d*&id=\d*)[\s\S]+?title">(?P<title>[^<]*)<[\s\S]+?date2">(?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_lit', + 'department_CN': '文学院', + 'url': 'http://www.lit.snnu.edu.cn/index.php?m=content&c=index&a=lists&catid=9', + 'url_main': 'http://www.lit.snnu.edu.cn/index.php?m=content&c=index&a=show&catid=', + 'rule': 'show&catid=(?P<link>\d*&id=\d*)[\s\S]+?title">(?P<title>[^<]*)<[\s\S]+?date2">(?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_his', + 'department_CN': '历史文化学院', + 'url': 'http://his.snnu.edu.cn/notice.asp', + 'url_main': 'http://his.snnu.edu.cn/notice.asp?id=', + 'rule': 'notice.asp[?]id=(?P<link>\d*)">(?P<title>[^<]*)[^\[]*\[(?P<date>\d*/\d*/\d*)', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_his', + 'department_CN': '历史文化学院', + 'url': 'http://his.snnu.edu.cn/news.asp', + 'url_main': 'http://his.snnu.edu.cn/news.asp?id=', + 'rule': 'news.asp[?]id=(?P<link>\d*)">(?P<title>[^<]*)[^\[]*\[(?P<date>\d*/\d*/\d*)', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_se', + 'department_CN': '教育学院', + 'url': 'http://se.snnu.edu.cn/news.php?cat_id=1342', + 'url_main': 'http://se.snnu.edu.cn/news_detail.php?id=', + 'rule': 'php[?]id=(?P<link>\d*)">(?P<title>[^(]*)((?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_se', + 'department_CN': '教育学院', + 'url': 'http://se.snnu.edu.cn/news.php?cat_id=1341', + 'url_main': 'http://se.snnu.edu.cn/news_detail.php?id=', + 'rule': 'php[?]id=(?P<link>\d*)">(?P<title>[^(]*)((?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_psych', + 'department_CN': '心理学院', + 'url': 'http://psych.snnu.edu.cn/home/list/?bh=008', + 'url_main': 'http://psych.snnu.edu.cn/home/show/', + 'rule': 'show/(?P<link>\d*)[^>]+?>(?P<title>[^ ]*)[\S\s]+?<td align=[\s\S]+?(?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_psych', + 'department_CN': '心理学院', + 'url': 'http://psych.snnu.edu.cn/home/list/?bh=009', + 'url_main': 'http://psych.snnu.edu.cn/home/show/', + 'rule': 'show/(?P<link>\d*)[^>]+?>(?P<title>[^ ]*)[\S\s]+?<td align=[\s\S]+?(?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_wyxy', + 'department_CN': '外国语学院', + 'url': 'http://www.wyxy.snnu.edu.cn/wenzi_list.jsp?urltype=tree.TreeTempUrl&wbtreeid=1044', + 'url_main': 'http://www.wyxy.snnu.edu.cn/info/1044/', + 'rule': 'info/1044/(?P<link>\d+.htm)" title="" class="left">(?P<title>\S{4,100})</a><span class="right">(?P<date>\d*-\d*-\d*)<', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_wyxy', + 'department_CN': '外国语学院', + 'url': 'http://www.wyxy.snnu.edu.cn/wenzi_list.jsp?urltype=tree.TreeTempUrl&wbtreeid=1043', + 'url_main': 'http://www.wyxy.snnu.edu.cn/info/1043/', + 'rule': 'info/1043/(?P<link>\d+.htm)" title="" class="left">(?P<title>\S{4,100})</a><span class="right">(?P<date>\d*-\d*-\d*)<', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_maths', + 'department_CN': '数学与信息科学学院', + 'url': 'http://maths.snnu.edu.cn/ggtz.htm', + 'url_main': 'http://maths.snnu.edu.cn/info/1041/', + 'rule': '1041/(?P<link>\d*.htm)">[\s\S]{18}(?P<title>[^ ]+)[ ]{5,}[^[]+?[^\d]+?(?P<date>\d+-\d+-\d+)', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_maths', + 'department_CN': '数学与信息科学学院', + 'url': 'http://maths.snnu.edu.cn/xyxw.htm', + 'url_main': 'http://maths.snnu.edu.cn/info/1042/', + 'rule': '1042/(?P<link>\d*.htm)">[\s\S]{18}(?P<title>[^ ]+)[ ]{5,}[^[]+?[^\d]+?(?P<date>\d+-\d+-\d+)', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_wuli', + 'department_CN': '物理学与信息技术学院', + 'url': 'http://wuli.snnu.edu.cn/home/list/12', + 'url_main': 'http://wuli.snnu.edu.cn/home/content/', + 'rule': 'content/(?P<link>\d+)" title="(?P<title>[^"]*)[^<]+?</a>[^>]+?>(?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_wuli', + 'department_CN': '物理学与信息技术学院', + 'url': 'http://wuli.snnu.edu.cn/home/list/11', + 'url_main': 'http://wuli.snnu.edu.cn/home/content/', + 'rule': 'content/(?P<link>\d+)" title="(?P<title>[^"]*)[^<]+?</a>[^>]+?>(?P<date>\d*-\d*-\d*)', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_spg', + 'department_CN': '哲学与政府管理学院', + 'url': 'http://spg.snnu.edu.cn/Notice.asp', + 'url_main': 'http://spg.snnu.edu.cn/Notice.asp?id=32&bh=', + 'rule': 'bh=(?P<link>\d+)[^>]+?>(?P<title>[^<]+?)<[^;]+?;[^;]+?;">(?P<date>\d+-\d+-\d+)', + 'coding': 'gbk', + 'type': '通知' + }, + { + 'department_EN': 'snnu_spg', + 'department_CN': '哲学与政府管理学院', + 'url': 'http://spg.snnu.edu.cn/College_News.asp', + 'url_main': 'http://spg.snnu.edu.cn/College_News.asp?id=31&bh=', + 'rule': 'bh=(?P<link>\d+)[^>]+?>(?P<title>[^<]+?)<[^;]+?;[^;]+?;">(?P<date>\d+-\d+-\d+)', + 'coding': 'gbk', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_chem', + 'department_CN': '化学化工学院', + 'url': 'http://www.chem.snnu.edu.cn/wenzi_list.aspx?category_id=19', + 'url_main': 'http://www.chem.snnu.edu.cn/neiye_show.aspx?id=', + 'rule': 'aspx[?]id=(?P<link>\d*)">(?P<title>[^<]*)<[\S\s]{1,45}(?P<date>\d{4}-\d{2}-\d{2})', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_chem', + 'department_CN': '化学化工学院', + 'url': 'http://www.chem.snnu.edu.cn/wenzi_list.aspx?category_id=20', + 'url_main': 'http://www.chem.snnu.edu.cn/neiye_show.aspx?id=', + 'rule': 'aspx[?]id=(?P<link>\d*)">(?P<title>[^<]*)<[\S\s]{1,45}(?P<date>\d{4}-\d{2}-\d{2})', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_lifesci', + 'department_CN': '生命科学学院', + 'url': 'http://lifesci.snnu.edu.cn/listall.aspx?Index_code=tzgg', + 'url_main': 'http://lifesci.snnu.edu.cn/inforshow.aspx?id=', + 'rule': 'aspx[?]id=(?P<link>\d*)">(?P<title>[^<]*)</a></li>[^>]*>(?P<date>\d*-\d*-\d*)</li>', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_lifesci', + 'department_CN': '生命科学学院', + 'url': 'http://lifesci.snnu.edu.cn/listall.aspx?Index_code=xydt', + 'url_main': 'http://lifesci.snnu.edu.cn/inforshow.aspx?id=', + 'rule': 'aspx[?]id=(?P<link>\d*)">(?P<title>[^<]*)</a></li>[^>]*>(?P<date>\d*-\d*-\d*)</li>', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_geog', + 'department_CN': '地理科学与旅游学院', + 'url': 'http://geog.snnu.edu.cn/news.jsp?urltype=tree.TreeTempUrl&wbtreeid=1020', + 'url_main': 'http://geog.snnu.edu.cn/info/1020/', + 'rule': '<span class="fr">(?P<date>\d{4}-\d{2}-\d{2})<[^"]{1,100}"info/1020/(?P<link>\d*.htm)">(?P<title>[^<]*)<', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_geog', + 'department_CN': '地理科学与旅游学院', + 'url': 'http://geog.snnu.edu.cn/news.jsp?urltype=tree.TreeTempUrl&wbtreeid=1019', + 'url_main': 'http://geog.snnu.edu.cn/info/1019/', + 'rule': '<span class="fr">(?P<date>\d{4}-\d{2}-\d{2})<[^"]{1,100}"info/1019/(?P<link>\d*.htm)">(?P<title>[^<]*)<', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_cxinw', + 'department_CN': '新闻与传播学院', + 'url': 'http://cxinw.snnu.edu.cn/News_bulletin.asp?id=15', + 'url_main': 'http://cxinw.snnu.edu.cn/News_bulletin.asp?id=15&bh=', + 'rule': 'bh=(?P<link>\d*)" class="c5">(?P<title>[^<]*)</a>[\s\S]{1,100}<span class="gk3">(?P<date>\d*-\d*-\d*)<', + 'coding': 'gbk', + 'type': '通知' + }, + { + 'department_EN': 'snnu_cxinw', + 'department_CN': '新闻与传播学院', + 'url': 'http://cxinw.snnu.edu.cn/News_bulletin.asp?id=14', + 'url_main': 'http://cxinw.snnu.edu.cn/News_bulletin.asp?id=14&bh=', + 'rule': 'bh=(?P<link>\d*)" class="c5">(?P<title>[^<]*)</a>[\s\S]{1,100}<span class="gk3">(?P<date>\d*-\d*-\d*)<', + 'coding': 'gbk', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_tyxy', + 'department_CN': '体育学院', + 'url': 'http://tyxy.snnu.edu.cn/Notice.asp', + 'url_main': 'http://tyxy.snnu.edu.cn/Notice.asp?id=34&bh=', + 'rule': 'font-weight:normal;">(?P<date>\d*-\d*-\d*)</span></td>[^&]+? /   <a href="/News_information.asp[?]id=33&bh=(?P<link>\d*)">\r\n(?P<title>[^\r]*?)\r\n', + 'coding': 'gbk', + 'type': '通知' + }, + { + 'department_EN': 'snnu_tyxy', + 'department_CN': '体育学院', + 'url': 'http://tyxy.snnu.edu.cn/News_information.asp', + 'url_main': 'http://tyxy.snnu.edu.cn/News_information.asp?id=33&bh=', + 'rule': 'font-weight:normal;">(?P<date>\d*-\d*-\d*)</span></td>[^&]+? /   <a href="/News_information.asp[?]id=33&bh=(?P<link>\d*)">\r\n(?P<title>[^\r]*?)\r\n', + 'coding': 'gbk', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_music', + 'department_CN': '音乐学院', + 'url': 'http://music.snnu.edu.cn/xwzx/tzgg.htm', + 'url_main': 'http://music.snnu.edu.cn/info/1018/', + 'rule': '<span class="fr">(?P<date>\d{4}-\d{2}-\d{2})<[^\d]{1,50}1018/(?P<link>\d*.htm)">(?P<title>[^<]*)<', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_music', + 'department_CN': '音乐学院', + 'url': 'http://music.snnu.edu.cn/xwzx/xyxw.htm', + 'url_main': 'http://music.snnu.edu.cn/info/1017/', + 'rule': '<span class="fr">(?P<date>\d{4}-\d{2}-\d{2})<[^\d]{1,50}1017/(?P<link>\d*.htm)">(?P<title>[^<]*)<', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_meishuxy', + 'department_CN': '美术学院', + 'url': 'http://meishuxy.snnu.edu.cn/News_Center.asp?id=15', + 'url_main': 'http://meishuxy.snnu.edu.cn/News_Center.asp?id=15&bh=', + 'rule': 'bh=(?P<link>\d*)" class="c5">(?P<title>[^<]*)</a>[\s\S]{1,160}>(?P<date>\d*-\d*-\d*)<', + 'coding': 'gbk', + 'type': '通知' + }, + { + 'department_EN': 'snnu_meishuxy', + 'department_CN': '美术学院', + 'url': 'http://meishuxy.snnu.edu.cn/News_Center.asp?id=14', + 'url_main': 'http://meishuxy.snnu.edu.cn/News_Center.asp?id=14&bh=', + 'rule': 'bh=(?P<link>\d*)" class="c5">(?P<title>[^<]*)</a>[\s\S]{1,160}>(?P<date>\d*-\d*-\d*)<', + 'coding': 'gbk', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_ibs', + 'department_CN': '国际商学院', + 'url': 'http://www.ibs.snnu.edu.cn/Announcements.asp', + 'url_main': 'http://www.ibs.snnu.edu.cn/Announcements.asp?id=18&bh=', + 'rule': 'bh=(?P<link>\d*)" class="c5">(?P<title>[^<]*)</a>[\s\S]{1,150}>\[(?P<date>\d*-\d*-\d*)\]', + 'coding': 'gbk', + 'type': '通知' + }, + { + 'department_EN': 'snnu_ibs', + 'department_CN': '国际商学院', + 'url': 'http://www.ibs.snnu.edu.cn/News.asp', + 'url_main': 'http://www.ibs.snnu.edu.cn/Announcements.asp?id=16&bh=', + 'rule': 'bh=(?P<link>\d*)" class="c5">(?P<title>[^<]*)</a>[\s\S]{1,150}>\[(?P<date>\d*-\d*-\d*)\]', + 'coding': 'gbk', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_iscs', + 'department_CN': '国际汉学院', + 'url': 'http://iscs.snnu.edu.cn/xwdt/xygg.htm', + 'url_main': 'http://iscs.snnu.edu.cn/info/1132/', + 'rule': '1132[/](?P<link>\d*.htm)"[^>]*>(?P<title>[^<]*)</a>[\s\S]{1,80}>(?P<date>\d*-\d*-\d*) <', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_iscs', + 'department_CN': '国际汉学院', + 'url': 'http://iscs.snnu.edu.cn/xwdt/zhyw.htm', + 'url_main': 'http://iscs.snnu.edu.cn/info/1133/', + 'rule': '1133[/](?P<link>\d*.htm)"[^>]*>(?P<title>[^<]*)</a>[\s\S]{1,80}>(?P<date>\d*-\d*-\d*) <', + 'coding': 'utf-8', + 'type': '新闻' + }, + { + 'department_EN': 'snnu_spgcx', + 'department_CN': '食品工程与营养科学学院', + 'url': 'http://spgcx.snnu.edu.cn/xwdt/tzgg.htm', + 'url_main': 'http://spgcx.snnu.edu.cn/info/1193/', + 'rule': 'class="fr">(?P<date>\d*-\d*)</span><a href="../info/1193/(?P<link>\d*.htm)" target="_blank" title="(?P<title>[^"]*?)"', + 'coding': 'utf-8', + 'type': '通知' + }, + { + 'department_EN': 'snnu_spgcx', + 'department_CN': '食品工程与营养科学学院', + 'url': 'http://spgcx.snnu.edu.cn/xwdt/xyxw.htm', + 'url_main': 'http://spgcx.snnu.edu.cn/info/1192/', + 'rule': 'class="fr">(?P<date>\d*-\d*)</span><a href="../info/1192/(?P<link>\d*.htm)" target="_blank" title="(?P<title>[^"]*?)"', + 'coding': 'utf-8', + 'type': '新闻' + } +] + +# we_chat config + +GRANT_TYPE = 'client_credential' +APPID = ' ' +SECRET = ' ' + +# mysql config +TARGET_IP='localhost' +SQL_USERNAME='root' +SQL_PASSWORD='root' +DATABASE_NAME='test' diff --git a/test/html/snnu_chem_news.html b/test/html/snnu_chem_news.html new file mode 100644 index 0000000..4c91fcb --- /dev/null +++ b/test/html/snnu_chem_news.html @@ -0,0 +1,635 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> + <script type="text/javascript" src="/templates/main/js/jquery.js"></script> + <title>学院新闻 + + + + + + + + + + + + 西安市公安局文化保卫支队 + + + + + + + + + + + + + +
+
+ + +
+ 手机站 +
+
+ + +
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + +
+
+ + 新闻 +
+ + +
+ +
+ + + + + + +
+
+ + + + + + + + + + + +
+
+
+
+ + +
+ +
+ + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + + +
+ +
化学化工学院团委微信公众号
+
+
+
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/test/html/snnu_chem_notice.html b/test/html/snnu_chem_notice.html new file mode 100644 index 0000000..bf0d5a0 --- /dev/null +++ b/test/html/snnu_chem_notice.html @@ -0,0 +1,635 @@ + + + + + + + 通知公告 + + + + + + + + + + + + 西安市公安局文化保卫支队 + + + + + + + + + + + + + +
+
+ + +
+ 手机站 +
+
+ + +
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + +
+
+ + 新闻 +
+ + +
+ +
+ + + + + + +
+
+ + + + + + + + + + + +
+
+
+
+ + +
+ +
+ + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + + +
+ +
化学化工学院团委微信公众号
+
+
+
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/test/html/snnu_clxy_notice.html b/test/html/snnu_clxy_notice.html new file mode 100644 index 0000000..fafd263 --- /dev/null +++ b/test/html/snnu_clxy_notice.html @@ -0,0 +1,4698 @@ + + + + + 陕西师范大学材料科学与工程学院 + + + + + + +
+ +
+ 当前位置: 首页 > 通知公告 +
+ +
+ 日期范围: + + 至 + + +      + + 标题: + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 类型 + + 标题 + + 发布人 + + 发布时间 +
+ 新闻动态 + + 我院在大面积柔性钙钛矿单晶薄膜研究中取得突破性进展 + + + admin + + 2018-12-24 17:06:01 +
+ 新闻动态 + + 学院召开党支部书记抓党建述职评议会议 + + + admin + + 2018-12-21 11:11:08 +
+ 新闻动态 + + 我院组织低年级学生观看学习庆祝改革开放40周年大会 + + + admin + + 2018-12-19 17:39:58 +
+ 新闻动态 + + 学院党总支组织师生党员观看改革开放四十周年大会 + + + admin + + 2018-12-19 16:56:08 +
+ 新闻动态 + + 李玉虎教授出席“减少灾害风险管理和促进文献遗产可持续保护全球论坛” + + + admin + + 2018-12-18 20:26:26 +
+ 新闻动态 + + 材料学子大讲堂第十二讲——做自己的锦鲤 + + + admin + + 2018-12-14 17:56:15 +
+ 新闻动态 + + 李玉虎教授获“陕西最美科技工作者”荣誉称号 + + + admin + + 2018-12-14 08:52:08 +
+ 新闻动态 + + 波兰国家档案馆代表团来我院历史文化遗产保护教育部工程研究中心交流学习 + + + admin + + 2018-12-12 13:05:15 +
+ 新闻动态 + + “材与你相遇”学院2019年迎新晚会 + + + admin + + 2018-12-12 09:01:35 +
+ 新闻动态 + + 我院成功举办光电功能高分子材料学术论坛 + + + admin + + 2018-12-11 10:03:40 +
+ 新闻动态 + + 材料学子大讲堂第十一讲——大学怎样度过 + + + admin + + 2018-12-07 18:10:51 +
+ 新闻动态 + + 2018级研究生新生健康讲座----艾滋病的流行与预防 + + + admin + + 2018-12-03 11:12:01 +
+ 新闻动态 + + “与你同行,很温暖”——我院举行2018级新生心理团体辅导活动 + + + admin + + 2018-12-01 16:49:20 +
+ 新闻动态 + + 学院实验室安全与卫生检查情况 + + + admin + + 2018-11-30 16:42:07 +
+ 新闻动态 + + 材料学子大讲堂第十讲——与新同学的对话 + + + admin + + 2018-11-22 15:07:13 +
+ 新闻动态 + + 我校材料科学进入ESI全球排名前5‰ + + + admin + + 2018-11-19 14:33:51 +
+ 新闻动态 + + 材料学子大讲堂第九讲——大学生活及未来的职业规划 + + + admin + + 2018-11-16 16:27:56 +
+ 新闻动态 + + 我院为低年级学生举办英语四级备考指导讲座 + + + admin + + 2018-11-12 16:22:27 +
+ 新闻动态 + + 我院在稳定高效的全无机钙钛矿电池研究方面取得重要进展 + + + admin + + 2018-11-12 15:30:42 +
+ 新闻动态 + + 浙江工业大学李瑛教授应邀来我院进行学术交流 + + + admin + + 2018-11-09 17:50:53 +
+ 新闻动态 + + 我院开展大学生艾滋病预防专题讲座 + + + admin + + 2018-11-07 16:59:28 +
+ 新闻动态 + + 材料学子大讲堂第八讲——大学教育与自我成长 + + + admin + + 2018-11-06 11:30:24 +
+ 新闻动态 + + 我院为大二学生举行英语四级模拟考试 + + + admin + + 2018-11-05 10:47:26 +
+ 新闻动态 + + 学院各团支部十月团日活动集锦 + + + admin + + 2018-11-05 10:15:07 +
+ 新闻动态 + + 我院江瑞斌、赵奎老师入选2018年陕西省中青年科技创新领军人才 + + + admin + + 2018-11-05 09:49:07 +
+ 新闻动态 + + 心动力,新起点 ----研究生新生心理适应讲座 + + + admin + + 2018-11-02 17:28:39 +
+ 新闻动态 + + 我院研究生在研究生“迎新杯”篮球联赛小组赛首场获胜 + + + admin + + 2018-10-31 16:54:46 +
+ 新闻动态 + + 日本高知工科大学山本哲也教授应邀来我院进行学术交流 + + + admin + + 2018-10-31 10:09:46 +
+ 新闻动态 + + 学院召开党总支委员会换届选举大会 + + + admin + + 2018-10-28 17:31:25 +
+ 新闻动态 + + 我院刘生忠教授团队在Angewandte Chemie上发表柔性钙钛矿太阳能电池的综述文章 + + + + + 2018-10-23 17:20:24 +
+ 新闻动态 + + 我院成功举办成果转化与专利申请及其风险防控专题研讨会 + + + admin + + 2018-10-22 10:05:30 +
+ 新闻动态 + + 我院开展入学教育讲座第七讲——机会是留给有准备的人 + + + admin + + 2018-10-22 09:01:21 +
+ 新闻动态 + + 故宫博物院古建部赵鹏副主任应邀来我院进行学术交流 + + + admin + + 2018-10-22 08:49:41 +
+ 新闻动态 + + 陕西关中地区部分古建彩画发展概况及地域特征学术交流在我校举行 + + + admin + + 2018-10-22 08:35:38 +
+ 新闻动态 + + 我院赴吉林省重点中学进行招生宣传 + + + admin + + 2018-10-18 08:17:55 +
+ 新闻动态 + + 我院领导班子成员赴陕西科技大学调研交流 + + + admin + + 2018-10-17 15:11:36 +
+ 新闻动态 + + 学院召开研究生会成立大会及本科生学生会工作例会 + + + admin + + 2018-10-17 14:31:04 +
+ 新闻动态 + + 我院成功举办第二届师生友谊赛秋季运动会 + + + admin + + 2018-10-16 19:59:18 +
+ 新闻动态 + + 哈尔滨师范大学化学化工学院来我院调研本科教学工作 + + + admin + + 2018-10-12 18:01:13 +
+ 新闻动态 + + 奏响人才培养主旋律--材料学院深化工程教育改革工作拉开帷幕 + + + admin + + 2018-10-08 14:58:04 +
+ 新闻动态 + + 我院2018级研究生开学典礼暨入学教育圆满完成 + + + admin + + 2018-10-08 11:25:39 +
+ 新闻动态 + + 材料学院班子成员外出考察学习 + + + admin + + 2018-10-07 14:14:12 +
+ 新闻动态 + + 我院成功举办第三届“曲江学者论坛”材料学分论坛 + + + admin + + 2018-09-28 16:35:06 +
+ 新闻动态 + + 学院为2018级新生开展入学教育讲座——材料科学与工程简介 + + + admin + + 2018-09-24 17:51:42 +
+ 新闻动态 + + 我院召开2019届研究生就业动员会 + + + admin + + 2018-09-20 15:17:50 +
+ 新闻动态 + + 2018级入学教育讲座进行时——我院为新生开展学业规范、班风建设及安全教育讲座 + + + admin + + 2018-09-17 14:51:29 +
+ 新闻动态 + + 学院召开全院教职工大会 + + + admin + + 2018-09-16 09:52:47 +
+ 新闻动态 + + 学院举行2018级研究生开学典礼暨师生见面会 + + + admin + + 2018-09-16 09:52:11 +
+ 新闻动态 + + 我院组织2018级本科生参观实验室 + + + admin + + 2018-09-14 12:25:19 +
+ 新闻动态 + + 我院新增一个校外本科/研究生人才培养基地 + + + admin + + 2018-09-14 09:41:43 +
+ 新闻动态 + + 欢乐Party过教师节 + + + admin + + 2018-09-14 08:14:50 +
+ 新闻动态 + + 郑州宇通集团有限公司来学院做招聘宣讲 + + + admin + + 2018-09-12 10:03:10 +
+ 新闻动态 + + 逐迹寻真,究源求知——学院2018暑期社会实践活动系列报道 + + + admin + + 2018-09-05 12:03:40 +
+ 新闻动态 + + 材料科学与工程学院2018级新生工作启航——入学教育与军训 + + + admin + + 2018-09-01 16:16:58 +
+ 新闻动态 + + 学院检查新学期实验室安全及科研平台运行情况 + + + admin + + 2018-08-30 10:29:38 +
+ 新闻动态 + + 迎新---紧张、繁忙并快乐、期盼着 ——材料科学与工程学院迎新工作记 + + + admin + + 2018-08-27 08:26:10 +
+ 新闻动态 + + 我院领导班子召开新学期部署工作会议 + + + admin + + 2018-08-24 11:41:58 +
+ 新闻动态 + + 材料科学与工程学院学工组走访2018级新生困难家庭 + + + admin + + 2018-08-23 12:59:12 +
+ 新闻动态 + + 我院9项项目获2018年国家自然科学基金资助 + + + admin + + 2018-08-22 11:20:06 +
+ 新闻动态 + + 我校与常州市武进区签署产学研合作协议 + + + admin + + 2018-08-02 08:30:57 +
+ 新闻动态 + + 关爱让生活更温馨—学院工会给教工过生日 + + + admin + + 2018-07-23 14:47:21 +
+ 新闻动态 + + 研究生第三党支部赴八路军西安办事处纪念馆参观学习 + + + admin + + 2018-07-11 18:27:19 +
+ 新闻动态 + + 喜讯:我院2部教材获得校级教材建设项目立项支持 + + + admin + + 2018-07-11 17:54:38 +
+ 新闻动态 + + 我院举行2018年暑期夏令营开营仪式 + + + admin + + 2018-07-10 18:16:51 +
+ 新闻动态 + + 我院举行2015级材料化学专业教育实习动员会 + + + admin + + 2018-07-09 14:00:51 +
+ 新闻动态 + + 我院石峰老师入选2019年度陕西省青年科技新星 + + + admin + + 2018-07-09 09:18:17 +
+ 新闻动态 + + 学院召开期末全院教职工大会 + + + admin + + 2018-07-06 17:38:42 +
+ 新闻动态 + + 我院首次获批陕西省科技创新团队 + + + admin + + 2018-07-06 09:23:39 +
+ 新闻动态 + + 我院6项项目获得2018年度陕西省科技计划资助 + + + + + 2018-07-05 17:33:14 +
+ 新闻动态 + + 我院召开学院发展规划专题会议 + + + admin + + 2018-07-05 10:11:01 +
+ 新闻动态 + + 我院召开本科生期末考试动员大会 + + + admin + + 2018-07-02 16:02:48 +
+ 新闻动态 + + 青春不散场,毕业不别离—— 材料科学与工程学院2018届毕业生欢送会 + + + admin + + 2018-06-29 17:13:55 +
+ 新闻动态 + + 我院召开2018年本科生材料学子科研创新基金项目评审会 + + + + + 2018-06-29 12:48:15 +
+ 新闻动态 + + 我院陈煜教授课题组在乙醇电氧化领域取得新进展 + + + admin + + 2018-06-28 15:19:38 +
+ 新闻动态 + + 学风建设系列讲座——学院为低年级学生举办优秀学子交流会 + + + admin + + 2018-06-19 20:35:37 +
+ 新闻动态 + + 我院学生社团海燕爱心社与西安世博园举行长期合作签约仪式 + + + admin + + 2018-06-15 16:48:00 +
+ 新闻动态 + + 助力研途,扬帆起航——四川大学、西安交通大学来我院举办研究生招生宣讲 + + + admin + + 2018-06-07 18:17:32 +
+ 新闻动态 + + 我院举行材料科学与工程博士学位授权点和材料工程专业硕士学位授权点自我评估评审会 + + + admin + + 2018-06-07 12:56:59 +
+ 新闻动态 + + 学风建设系列讲座——学院为低年级学生举办英语四六级备考指导讲座 + + + admin + + 2018-05-28 11:47:24 +
+ 新闻动态 + + 学院组织2016级本科生学习习近平在北京大学师生座谈会上的讲话精神 + + + admin + + 2018-05-14 16:45:09 +
+ 新闻动态 + + 学院召开第一次教学与课程建设委员会会议 + + + + + 2018-05-14 13:10:04 +
+ 新闻动态 + + 我院学生党支部组织党员观看纪录片《厉害了,我的国》 + + + admin + + 2018-05-09 11:41:39 +
+ 新闻动态 + + 首届电子元器件关键材料与技术研讨会在我校成功举办 + + + admin + + 2018-05-02 09:58:49 +
+ 新闻动态 + + 人事处来学院召开青年教师座谈会 + + + admin + + 2018-05-02 07:19:55 +
+ 新闻动态 + + 凝心聚力 奋勇拼搏——记我院2018年校运动 + + + admin + + 2018-04-29 10:24:59 +
+ 新闻动态 + + 学校党委副书记马博虎同志来学院指导工作 + + + admin + + 2018-04-27 17:48:47 +
+ 新闻动态 + + 我院师生党员前往铜川照金参观学习 + + + admin + + 2018-04-23 11:51:57 +
+ 新闻动态 + + 教育部本科教学工作审核评估专家走访材料科学与工程学院 + + + admin + + 2018-04-18 15:33:00 +
+ 新闻动态 + + 学风建设系列讲座——学院为2017级学生举办专业指导讲座Ⅱ + + + admin + + 2018-04-17 13:25:50 +
+ 新闻动态 + + 我院召开全院教职工大会 + + + admin + + 2018-04-13 13:47:42 +
+ 新闻动态 + + 我院召开党员大会选举党代表 + + + + + 2018-04-11 12:19:17 +
+ 新闻动态 + + 我院学生社团海燕爱心社与西安世博园合作开展志愿服务活动 + + + admin + + 2018-04-03 19:56:43 +
+ 新闻动态 + + 学风建设系列讲座——学院为2017级学生举办专业指导讲座 + + + admin + + 2018-03-28 18:11:05 +
+ 新闻动态 + + 本科教学工作审核评估预评估专家来院检查指导工作 + + + admin + + 2018-03-22 18:43:50 +
+ 新闻动态 + + 学风建设系列讲座——考研英语学习方法指导 + + + admin + + 2018-03-21 09:30:03 +
+ 新闻动态 + + 我院刘渝城同学入选2017年陕西省大学生自强之星 + + + admin + + 2018-03-18 20:08:10 +
+ 新闻动态 + + 学院召开本科教学工作审核评估预备会 Ⅱ + + + admin + + 2018-03-16 18:29:32 +
+ 新闻动态 + + 学院召开第十一次党代会工作部署会 + + + admin + + 2018-03-15 17:36:04 +
+ 新闻动态 + + 学院召开本科教学工作审核评估预备会 + + + admin + + 2018-03-14 15:30:35 +
+ 新闻动态 + + 精准定位找差距 凝心聚力谋发展-学院召开新学期工作部署会 + + + admin + + 2018-03-12 18:05:47 +
+ 新闻动态 + + 学院第三届工会委员会换届选举大会顺利召开 + + + admin + + 2018-03-10 11:05:14 +
+ 新闻动态 + + 研究生院一行来我院调研指导 + + + admin + + 2018-03-08 16:23:20 +
+ 新闻动态 + + 学院检查督导新学期实验室安全工作 + + + admin + + 2018-03-06 17:16:14 +
+ 新闻动态 + + 学院组织观看十三届全国人大一次会议 + + + admin + + 2018-03-05 18:05:07 +
+ 新闻动态 + + 学院开展教学档案整改工作 + + + admin + + 2018-02-19 11:44:38 +
+ 新闻动态 + + 学院召开教研室主任工作会议 + + + admin + + 2018-02-02 07:16:48 +
+ 新闻动态 + + 第十届电介质材料物理交流讨论会在我院成功举办 + + + admin + + 2018-01-30 15:33:38 +
+ 新闻动态 + + 学院举行中央高校基本业务费自由探索项目答辩会 + + + admin + + 2018-01-18 09:45:13 +
+ 新闻动态 + + 学院召开青年教师座谈会 + + + admin + + 2018-01-18 09:24:29 +
+ 新闻动态 + + 学院召开党总支中心组学习研讨会 + + + admin + + 2018-01-17 10:33:32 +
+ 新闻动态 + + 学院召开期末考试动员大会 + + + admin + + 2018-01-16 18:54:08 +
+ 新闻动态 + + 我院成功举办第四届研究生学术论坛 + + + admin + + 2018-01-16 11:40:09 +
+ 新闻动态 + + 我院与陕西德飞新能源科技有限公司开展深化合作交流座谈会 + + + admin + + 2018-01-16 10:18:34 +
+ 新闻动态 + + 材料学院召开全院大会部署学期末工作 + + + admin + + 2018-01-09 20:24:53 +
+ 新闻动态 + + 学院深入学习十九大报告精神 + + + + + 2018-01-05 09:40:58 +
+ 新闻动态 + + 我院学生参加学校第三届大学生课外学术科技作品博览会 + + + admin + + 2017-12-27 16:16:18 +
+ 新闻动态 + + 我院学生参加学校乒乓球比赛获得团体第七名 + + + admin + + 2017-12-27 11:41:44 +
+ 新闻动态 + + 材德兼备铭初心 笃行致远创未来 ----学院2018年迎新晚会成功举办 + + + admin + + 2017-12-18 15:13:55 +
+ 新闻动态 + + 我院青年教师在第十届青年教师教学基本功大赛中喜获佳绩 + + + admin + + 2017-12-14 08:10:36 +
+ 新闻动态 + + 陕西省文物修复与环保工程技术研究中心工程项目顺利通过验收 + + + admin + + 2017-12-14 08:31:33 +
+ 新闻动态 + + 第二届曲江学者论坛暨陕西省丝绸之路青年学者论坛--材料学分论坛圆满结束 + + + admin + + 2017-11-29 08:27:31 +
+ 新闻动态 + + 基础实验教学中心开展主题党日活动-- 认真学习党的十九大报告 + + + admin + + 2017-11-27 08:51:12 +
+ 新闻动态 + + 天使的守护——学院新生团体心理辅导活动 + + + admin + + 2017-11-24 15:45:43 +
+ 新闻动态 + + 材料科学与工程学院党总支认真学习党的十九大报告 + + + admin + + 2017-11-17 16:28:08 +
+ 新闻动态 + + 学院教师党支部与机关党委实验室建设与管理处党支部一起学习党的十九大报告 + + + admin + + 2017-11-10 18:14:57 +
+ 新闻动态 + + 利用校外资源优化职业生涯课程 + + + admin + + 2017-11-10 17:33:24 +
+ 新闻动态 + + 李玉虎教授主持感光影像档案修复与保护关键技术研究项目获国家档案局优秀科技成果特等奖 + + + admin + + 2017-11-10 16:36:10 +
+ 新闻动态 + + 夯实基础管理 创新服务模式-材料学院召开第二次全院教职工大会 + + + admin + + 2017-11-02 15:49:45 +
+ 新闻动态 + + 不忘初心 牢记使命——学院主题党日活动 + + + admin + + 2017-11-02 12:04:48 +
+ 新闻动态 + + 学风建设系列活动——学院邀请西安交通大学师生做思维导图在化学学习中应用的讲座 + + + admin + + 2017-10-30 17:26:57 +
+ 新闻动态 + + 学院举行2018届研究生毕业生就业动员会 + + + admin + + 2017-10-28 15:54:33 +
+ 新闻动态 + + 2017级材料工程专业研究生赴大荔德飞新能源科技有限公司实习实践 + + + admin + + 2017-10-23 11:32:18 +
+ 新闻动态 + + 学院师生集体观看党的十九大开幕式 + + + admin + + 2017-10-18 16:02:05 +
+ 新闻动态 + + 我院研究生在陕西省第二届微结构摄影大赛中取得佳绩 + + + admin + + 2017-10-09 22:03:59 +
+ 新闻动态 + + 材料科学与工程学院学风建设活动---实验室安全教育篇 + + + admin + + 2017-09-30 13:13:42 +
+ 新闻动态 + + 带你走好研途第一步——2017级研究生新生入学教育系列讲座 + + + admin + + 2017-09-19 17:45:41 +
+ 新闻动态 + + 我院石峰副教授课题组参与国家重点研发计划项目 + + + admin + + 2017-09-14 09:07:18 +
+ 新闻动态 + + 学院举行2014级教学实习动员大会 + + + admin + + 2017-09-07 09:57:35 +
+ 新闻动态 + + 我院获批2017年国家自然基金项目11项 + + + admin + + 2017-09-01 18:11:36 +
+ 新闻动态 + + 架起沟通桥,铺就成长路—我院召开2017级新生家长座谈会 + + + admin + + 2017-08-25 22:29:22 +
+ 新闻动态 + + 科研筑梦 实践探寻——学院暑期三下乡社会实践活动顺利完成 + + + admin + + 2017-08-02 11:57:40 +
+ 新闻动态 + + 我院陈煜教授在制氢领域取得系列进展 + + + admin + + 2017-07-17 09:21:34 +
+ 新闻动态 + + 我院与陕西德飞新能源科技有限公司举行实践基地授牌仪式 + + + admin + + 2017-07-14 14:46:49 +
+ 新闻动态 + + 材料科学与工程学院成功举办第一届优秀大学生暑期夏令营 + + + admin + + 2017-07-12 18:05:44 +
+ 新闻动态 + + 学院召开推进两学一做学习教育常态化制度化工作部署会 + + + admin + + 2017-07-08 12:51:42 +
+ 新闻动态 + + 印度尼西亚国家档案局局长考察我院历史文化遗产保护教育部工程研究中心 + + + admin + + 2017-06-22 16:53:53 +
+ 新闻动态 + + 我院学生作品在挑战杯陕西省大学生课外学术科技作品竞赛中荣获二等奖 + + + admin + + 2017-06-13 15:48:47 +
+ 新闻动态 + + 学风建设系列活动—学院举办求职经验分享会 + + + admin + + 2017-06-08 17:16:32 +
+ 新闻动态 + + 我院举办研究生安全教育培训讲座 + + + admin + + 2017-06-01 11:43:14 +
+ 新闻动态 + + 学风建设系列活动——学院举办国家留学基金委资助本科生出国交流项目经验分享会 + + + admin + + 2017-05-31 15:58:44 +
+ 新闻动态 + + 学风建设系列活动—学院成功举办考研经验分享会 + + + admin + + 2017-05-25 21:22:29 +
+ 新闻动态 + + 学风建设系列活动—学院推出学业指导和职业生涯规划系列讲座 + + + admin + + 2017-05-23 17:30:53 +
+ 新闻动态 + + 学院召开毕业生就业工作推进会 + + + + + 2017-05-16 17:46:21 +
+ 新闻动态 + + 学风建设系列活动—优秀毕业生出国留学经验分享会 + + + admin + + 2017-05-15 17:34:11 +
+ 新闻动态 + + 纪念建军90周年,喜迎党的十九大——经典再现·胶片老电影展示会 + + + admin + + 2017-05-15 11:56:18 +
+ 新闻动态 + + 材料科学与工程学院2017年师生球类友谊赛成功举办 + + + + + 2017-05-13 18:06:52 +
+ 新闻动态 + + 追忆红色岁月,缅怀革命先烈——材料科学与工程学院2015级研究生赴杨虎城止园别墅旧址参观 + + + admin + + 2017-05-12 15:45:03 +
+ 新闻动态 + + 学院行政党支部政治理论学习工作会 + + + admin + + 2017-04-28 17:05:18 +
+ 新闻动态 + + 我院成功举办经典再现·胶片老电影保护研讨展示会——著名艺术表演家许还山先生出席 + + + admin + + 2017-04-24 11:41:47 +
+ 新闻动态 + + 学院举办春季优秀宿舍评比活动 + + + admin + + 2017-03-31 11:16:48 +
+ 新闻动态 + + 学院召开党支部政治理论学习工作部署会 + + + admin + + 2017-03-25 11:07:32 +
+ 新闻动态 + + 学风建设系列讲座—树立学术规范理念 促进科研知识创新 + + + admin + + 2017-03-22 11:15:46 +
+ 新闻动态 + + 外国语学院教师和我院师生座谈 + + + admin + + 2017-03-21 12:46:53 +
+ 新闻动态 + + 学风建设系列讲座—出国留学及英语学习 + + + admin + + 2017-03-20 16:38:51 +
+ 新闻动态 + + 学院有序推进学生就业工作 + + + admin + + 2017-03-17 18:33:02 +
+ 新闻动态 + + 学院学生积极关注总理政府报告 + + + admin + + 2017-03-07 16:04:30 +
+ 新闻动态 + + 我院召开新学期工作部署会议 + + + + + 2017-03-06 12:00:20 +
+ 新闻动态 + + 我院博士毕业生张慧入围江苏省第五期333工程第三层次培养对象 + + + admin + + 2017-02-15 09:42:45 +
+ 新闻动态 + + 我院承担的蓝田猿人遗址黄土剖面病害抢救性治理工程通过验收 + + + admin + + 2017-01-17 10:32:33 +
+ 新闻动态 + + 学院召开2016年领导班子民主生活会 + + + admin + + 2017-01-16 11:02:11 +
+ 新闻动态 + + 材料学院召开二级教代会 + + + admin + + 2017-01-13 17:41:13 +
+ 新闻动态 + + 马博虎同志参加学院青年教师座谈会 + + + admin + + 2017-01-12 10:59:02 +
+ 新闻动态 + + 第八届电介质材料物理交流讨论会(西安片区)在我院成功举办 + + + admin + + 2017-01-12 08:54:49 +
+ 新闻动态 + + 我院承担的江西庐山(星子)明代高僧墓壁画抢救修复保护工程顺利通过验收 + + + admin + + 2017-01-10 14:57:46 +
+ 新闻动态 + + 陕西师范大学历史文化遗产保护教育部工程研究中心承担的中国第二历史档案馆2016年特藏档案抢救保护项目顺利通过验收 + + + admin + + 2017-01-10 14:46:48 +
+ 新闻动态 + + 学院党总支召开2016年民主评议党员工作部署会 + + + admin + + 2016-12-30 16:09:40 +
+ 新闻动态 + + 学校党委书记甘晖到我院调研两学一做学习教育工作 + + + admin + + 2016-12-26 17:22:43 +
+ 新闻动态 + + 扬帆起航材料梦,求索笃行学子心——学院举办2017年迎新晚会 + + + admin + + 2016-12-21 18:36:40 +
+ 新闻动态 + + 材料科学与工程学院召开省级工程实验室及重点实验室学术委员会会议 + + + admin + + 2016-12-13 09:33:56 +
+ 新闻动态 + + 学院党中心组召开学习十八届六中全会精神会议 + + + admin + + 2016-12-11 19:32:53 +
+ 新闻动态 + + 马博虎同志参加学院教师党支部专题学习会 + + + admin + + 2016-11-29 16:52:37 +
+ 新闻动态 + + 学院教师党支部选举大会顺利召开 + + + admin + + 2016-11-04 17:51:01 +
+ 新闻动态 + + 学校两学一做学习教育督导组来学院检查工作 + + + admin + + 2016-11-04 11:06:22 +
+ 新闻动态 + + 我院2014级本科生团体心理辅导活动顺利开展 + + + admin + + 2016-11-03 15:31:10 +
+ 新闻动态 + + 材料科学与工程学院教工党支部两学一做第四专题讨论会 + + + admin + + 2016-11-01 11:40:52 +
+ 新闻动态 + + 学院党中心组两学一做学习研讨会 + + + admin + + 2016-11-01 11:35:09 +
+ 新闻动态 + + 我院举行第九届青年教师教学基本功预赛 + + + admin + + 2016-10-28 17:05:11 +
+ 新闻动态 + + 我院储能材料研究团队取得重要成果 + + + admin + + 2016-10-25 16:29:57 +
+ 新闻动态 + + 我院举办2016级研究生新生教育系列讲座 + + + admin + + 2016-10-25 15:20:53 +
+ % + + 我院举办纪念中央红军长征胜利80周年主题团日活动 + + + admin + + 2016-10-24 18:02:37 +
+ 新闻动态 + + 常州天合光能有限公司来我院招聘毕业生 + + + admin + + 2016-10-24 11:31:47 +
+ 新闻动态 + + 发扬长征精神 走好当代长征路--学院党中心组两学一做学习研讨会 + + + admin + + 2016-10-23 15:59:58 +
+ 新闻动态 + + 我院研究生力夺2016届新生篮球赛亚军 + + + admin + + 2016-10-17 15:06:28 +
+ 新闻动态 + + 我院举行学生会换届大会 + + + admin + + 2016-10-12 11:24:40 +
+ 新闻动态 + + 学院党总支中心组召开第三专题学习讨论会 + + + admin + + 2016-09-30 15:30:37 +
+ 新闻动态 + + 学院教工党支部两学一做专题讨论 + + + + + 2016-09-29 10:52:38 +
+ 新闻动态 + + 我院召开新学期工作部署会议 + + + admin + + 2016-09-23 11:32:15 +
+ 新闻动态 + + 成材之路——我院2013级本科生实习工作圆满结束 + + + admin + + 2016-09-22 18:10:33 +
+ 新闻动态 + + 我院2013级考研动员大会顺利举行 + + + admin + + 2016-09-22 17:10:18 +
+ 新闻动态 + + 材料科学与工程学院2016级研究生实验安全教育培训讲座圆满结束 + + + admin + + 2016-09-18 16:42:43 +
+ 新闻动态 + + 我院2016年本科生新生入学工作圆满完成 + + + admin + + 2016-09-05 10:08:15 +
+ 新闻动态 + + 我院2016级研究生迎新工作圆满结束 + + + admin + + 2016-09-05 09:40:12 +
+ 新闻动态 + + 我院本科教学管理工作得到学校肯定 + + + admin + + 2016-09-01 11:44:14 +
+ 新闻动态 + + 温暖开学季,迎新更赢心 + + + admin + + 2016-08-15 10:10:37 +
+ 新闻动态 + + 访革命旧址,探文保之路——我院2016年暑期社会实践 + + + admin + + 2016-07-22 16:05:13 +
+ 新闻动态 + + 学院党总支中心组召开学习习总书记七一讲话专题会议 + + + admin + + 2016-07-21 21:43:14 +
+ 新闻动态 + + 我院召开全院教职工教学研讨会 + + + admin + + 2016-07-13 11:21:08 +
+ 新闻动态 + + 材料学院党总支组织党员参观习仲勋陵园并举行新党员入党宣誓仪式 + + + admin + + 2016-07-01 10:06:45 +
+ 新闻动态 + + 我校协办联合国教科文组织世界记忆项目亚太地区档案保护研讨会 + + + admin + + 2016-06-21 09:15:49 +
+ 新闻动态 + + 化学化工学院和我院邀请任晓伟教授为师生党员作 两学一做专题报告 + + + admin + + 2016-06-17 17:24:48 +
+ 新闻动态 + + 材料科学与工程学院学子出国留学再创佳绩 + + + admin + + 2016-06-06 17:58:57 +
+ 新闻动态 + + 学院教工党支部两学一做专题讨论 + + + admin + + 2016-06-06 12:24:53 +
+ 新闻动态 + + 学院召开研究生就业工作推进会 + + + admin + + 2016-05-27 09:02:31 +
+ 新闻动态 + + 材料学院组织2015级材料化学专业学生来院参观 + + + admin + + 2016-05-27 08:27:42 +
+ 新闻动态 + + 我院在金纳米晶的制备和光学性质研究方面获得新突破 + + + admin + + 2016-05-25 11:55:52 +
+ 新闻动态 + + 我院在二维原子晶体材料制备研究中取得重要进展 + + + admin + + 2016-05-18 15:59:00 +
+ 新闻动态 + + 材料学院开展放飞梦想,展望未来主题团日活动 + + + admin + + 2016-05-17 11:02:50 +
+ 新闻动态 + + 学院党总支中心组召开专题学习讨论活动 + + + admin + + 2016-05-11 15:57:50 +
+ 新闻动态 + + 材料学院两学一做学习教育系列活动 + + + admin + + 2016-05-04 15:30:18 +
+ 新闻动态 + + 材料科学与工程学院召开两学一做学习教育动员部署会 + + + admin + + 2016-04-28 17:04:55 +
+ 新闻动态 + + 天生我材必有用—学院师生在校运会上获佳绩 + + + admin + + 2016-04-25 19:26:05 +
+ 新闻动态 + + 学院2016年师生趣味运动会 + + + admin + + 2016-04-22 19:51:23 +
+ 新闻动态 + + 学院研究生会新学期工作安排部署会 + + + admin + + 2016-03-30 10:57:10 +
+ 新闻动态 + + 学院组织学生观看第十二届全国人民代表大会第四次会议 + + + admin + + 2016-03-07 15:17:38 +
+ 新闻动态 + + 我院召开2015年年终总结及二级教代会 + + + admin + + 2016-01-16 09:19:41 +
+ 新闻动态 + + 第六届电介质材料物理研究生交流讨论会在我院成功举办 + + + admin + + 2016-01-16 08:47:35 +
+ 新闻动态 + + 我院召开领导班子三严三实专题民主生活会 + + + admin + + 2016-01-14 15:34:23 +
+ 新闻动态 + + 学院举办海外留学经验交流会 + + + admin + + 2016-01-06 08:58:31 +
+ 新闻动态 + + 材料科学与工程学院2016年迎新晚会举办 + + + admin + + 2016-01-04 11:47:15 +
+ 新闻动态 + + 我院参加2015年纪念12.9运动阳光体育半程马拉松比赛 + + + admin + + 2015-12-17 16:50:42 +
+ 新闻动态 + + 德飞新能源科技有限公司马振忠总经理访问我院 + + + admin + + 2015-12-10 11:09:34 +
+ 新闻动态 + + 我院进行2015年教学委员会第一次会议 + + + admin + + 2015-12-08 10:06:47 +
+ 新闻动态 + + 我院举行2012级本科生实习总结大会 + + + admin + + 2015-12-04 17:09:16 +
+ 新闻动态 + + 我院学生在陕西省大学生武术套路锦标赛中获太极拳冠军 + + + admin + + 2015-12-03 10:14:18 +
+ 新闻动态 + + 我院举行2014级博士及硕士研究生中期考核 + + + admin + + 2015-12-01 09:30:37 +
+ 新闻动态 + + 复旦大学赵东元院士访问我院 + + + admin + + 2015-12-01 08:27:29 +
+ 新闻动态 + + 我院领导参加了第六届知名大学材料学院院长沙龙 + + + admin + + 2015-11-19 11:49:45 +
+ 新闻动态 + + 我院组织全体教工党员学习《准则》和《条例》 + + + admin + + 2015-11-15 18:02:18 +
+ 新闻动态 + + 我院学生参观陕西省第二届研究生创新成果展暨创新成果洽谈会 + + + admin + + 2015-11-09 10:04:25 +
+ 新闻动态 + + 材料科学与工程学院党总支召开三严三实第二专题研讨会 + + + admin + + 2015-11-03 10:21:25 +
+ 新闻动态 + + 我院举行第八届青年教师教学基本功大赛预赛 + + + admin + + 2015-11-03 08:37:23 +
+ 新闻动态 + + 我院迎接陕西省高校巡视诊断工作圆满结束 + + + admin + + 2015-10-29 15:04:48 +
+ 新闻动态 + + 材料科学与工程学院2015年专业实习纪实 + + + + + 2015-10-28 11:23:59 +
+ 新闻动态 + + 职业导航——陕西德飞新能源科技有限公司刘建波博士来我院进行主题讲座 + + + admin + + 2015-10-22 15:01:07 +
+ 新闻动态 + + 学而思西安分校来我院举行专场招聘会 + + + admin + + 2015-10-20 09:26:42 +
+ 新闻动态 + + 学院参加纪念中国人民抗日战争暨世界反法西斯战争胜利70周年合唱比赛荣获优秀组织奖 + + + admin + + 2015-10-18 17:14:52 +
+ 新闻动态 + + 学院召开2016届毕业生就业动员会 + + + admin + + 2015-10-12 10:20:39 +
+ 新闻动态 + + 我院召开迎接陕西高校巡视诊断工作部署会议 + + + admin + + 2015-09-30 10:32:30 +
+ 新闻动态 + + 院学生会举办新老生交流会 + + + admin + + 2015-09-30 08:56:43 +
+ 新闻动态 + + 以德治企,助梦飞翔----记2012级本科生德飞集团实习总结交流会 + + + admin + + 2015-09-29 11:08:59 +
+ 新闻动态 + + 齐心协力迎接省高校巡诊工作-我院召开新学期教职工大会 + + + admin + + 2015-09-25 15:04:41 +
+ 新闻动态 + + 学院举办2015级研究生新生心理讲座 + + + admin + + 2015-09-25 09:23:34 +
+ 新闻动态 + + 陕西师范大学材料科学与工程学院——陕西德飞集团教育教学实践基地启动仪式成功举行 + + + admin + + 2015-09-15 11:31:06 +
+ 新闻动态 + + 学院组织师生收看抗战胜利70周年纪念大会现场直播 + + + admin + + 2015-09-06 16:00:18 +
+ 新闻动态 + + 材料科学与工程学院和化学化工学院2015暑期三下乡社会实践活动圆满结束 + + + admin + + 2015-07-28 10:16:03 +
+ 新闻动态 + + 学院教工党支部召开三严三实专题组织生活会 + + + admin + + 2015-07-16 11:21:25 +
+ 新闻动态 + + 我院召开期末教职工大会 + + + admin + + 2015-07-06 17:21:29 +
+ 新闻动态 + + 世界那么大,我想去看看 + + + admin + + 2015-07-06 16:10:59 +
+ 新闻动态 + + 常州石墨烯研究所实习动员会 + + + admin + + 2015-07-06 11:01:34 +
+ 新闻动态 + + 土耳其国家档案总局代表团访问历史文化遗产保护教育部工程研究中心 + + + admin + + 2015-06-26 10:07:31 +
+ 新闻动态 + + 我院举行专业实践基地及产学研合作基地揭牌仪式 + + + admin + + 2015-06-26 09:56:57 +
+ 新闻动态 + + 学院举办三严三实专题教育党课 + + + admin + + 2015-06-18 09:55:35 +
+ 新闻动态 + + 我院在常州企业暨研究院建立实习基地 + + + admin + + 2015-05-29 15:50:19 +
+ 新闻动态 + + 我院学生作品在挑战杯陕西省大学生课外学术科技作品竞赛中荣获一等奖 + + + admin + + 2015-05-25 20:38:45 +
+ 新闻动态 + + 西汉彩绘兵马俑彩绘层微米级龟裂缝隙显微修复与动态检测技术顺利通过国家文物局专家鉴定 + + + admin + + 2015-05-20 16:16:03 +
+ 新闻动态 + + 我院召开一流学科建设讨论会 + + + admin + + 2015-05-06 17:44:06 +
+ 新闻动态 + + 陕西德飞新能源研究所刘建波一行来我院交流座谈 + + + admin + + 2015-05-05 15:30:13 +
+ 新闻动态 + + 材料学院2015届毕业生就业工作推进会 + + + admin + + 2015-04-30 11:10:09 +
+ 新闻动态 + + 蛮拼的材料学院师生 + + + admin + + 2015-04-29 12:00:44 +
+ 新闻动态 + + 我院圆满完成2014年度科技目标任务 + + + admin + + 2015-04-10 10:42:02 +
+ 新闻动态 + + 学院举行党课培训开班典礼 + + + admin + + 2015-04-14 09:50:51 +
+ 新闻动态 + + 学院举行考研助力交流会 + + + admin + + 2015-04-13 11:23:35 +
+ 新闻动态 + + 我院召开新学期教职工大会 + + + admin + + 2015-03-19 05:05:02 +
+ 新闻动态 + + 国际交流与合作处徐峰处长一行访问我院 + + + admin + + 2015-03-13 11:30:48 +
+ 新闻动态 + + 游旭群副校长一行来我院走访座谈 + + + admin + + 2015-04-15 17:35:09 +
+ 新闻动态 + + 李玉虎教授被授予中国感光学会突出贡献奖 + + + admin + + 2015-04-15 17:36:14 +
+ 新闻动态 + + 我校10项科技成果获2015年度陕西高等学校科学技术奖 + + + admin + + 2015-03-06 11:13:40 +
+ 新闻动态 + + 2014级材料化学专业学生来院参观 + + + admin + + 2015-03-05 07:33:27 +
+ 新闻动态 + + 李玉虎教授主持的档案保护科研项目获国家档案局优秀科技成果一等奖 + + + admin + + 2015-03-05 11:03:47 +
+ 新闻动态 + + 材料科学与工程学院教学研讨会成功举办 + + + admin + + 2015-01-29 02:11:03 +
+ 新闻动态 + + 《新能源材料与器件科学论坛》成功举行 + + + admin + + 2015-04-15 17:37:01 +
+ 新闻动态 + + 我院召开2015年国家自然科学基金申请院内评审会 + + + admin + + 2015-01-19 05:48:24 +
+ 新闻动态 + + 第四届电介质材料物理交流讨论会在我院成功举办 + + + admin + + 2015-01-15 10:15:09 +
+ 新闻动态 + + 材料科学与工程学院举办2015年迎新晚会 + + + admin + + 2015-01-05 04:59:44 +
+ 新闻动态 + + 我院和化学化工学院联合举办非师范专业学生职业规划培训课程 + + + admin + + 2014-12-30 11:35:19 +
+ 新闻动态 + + 2012级材料化学本科生专业指导教师见面会 + + + admin + + 2014-12-02 10:44:31 +
+ 新闻动态 + + 我院召开全院教职工大会 + + + admin + + 2014-11-26 09:49:25 +
+ 新闻动态 + + 材料学院校庆70周年系列活动 历史文化遗产保护教育部工程研究中心成立十周年学术研讨会暨史前彩绘陶器科学研究博物馆开馆仪式顺利举行 + + + admin + + 2014-10-11 03:17:42 +
+ 新闻动态 + + 参观学习 + + + admin + + 2014-09-27 09:34:46 +
+ 新闻动态 + + 2014级研究生入学教育第一课—研究生的国际化交流 + + + admin + + 2014-09-18 10:27:23 +
+ 新闻动态 + + 我校承担的抢救修复韩城元代建筑藻井画抢救修复项目受到专家高度评价 + + + admin + + 2014-08-19 05:47:43 +
+ 新闻动态 + + 我校成功科学修复保护唐皇城墙含光门、大唐西市两处唐代土遗址 + + + admin + + 2014-08-19 05:46:29 +
+ 新闻动态 + + 陕西省档案局局长王建领一行来我校历史文化遗产保护教育部工程研究中心考察调研 + + + admin + + 2014-08-19 05:41:38 +
+ 新闻动态 + + 留住回忆,放飞梦想--材料科学与工程学院欢送2014届毕业生系列活动 + + + admin + + 2014-06-13 08:59:15 +
+ 新闻动态 + + 程光旭校长莅临我院走访调研 + + + admin + + 2014-06-06 09:48:53 +
+ 新闻动态 + + 喀什师范学院来我院招聘 + + + admin + + 2014-05-21 04:35:03 +
+ 新闻动态 + + 我院参加第二届西安市高校材料论坛开幕式 + + + admin + + 2014-05-15 09:59:12 +
+ 新闻动态 + + 李玉虎教授主持的陕西省13115科技创新工程重大专项通过验收与鉴定 + + + admin + + 2014-04-18 10:39:07 +
+ 新闻动态 + + 我院在研究生运动会上取得可喜成绩 + + + admin + + 2014-04-04 04:01:04 +
+ 新闻动态 + + 我院成功举办第二期材料科学论坛 + + + admin + + 2014-03-10 01:05:59 +
+ 新闻动态 + + 我院刘宗怀教授、雷志斌教授受邀参加亚太电化学能源储存与转化会议 + + + admin + + 2014-02-19 11:18:10 +
+ 新闻动态 + + 我院成功举办首期材料科学论坛暨2013年学术年会 + + + admin + + 2014-01-22 01:39:23 +
+ + + + + + + + + + + +

+ + + + diff --git a/test/html/snnu_css_news.html b/test/html/snnu_css_news.html new file mode 100644 index 0000000..b41aa15 --- /dev/null +++ b/test/html/snnu_css_news.html @@ -0,0 +1,413 @@ + + + +学院动态-陕西师范大学计算机科学学院 + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ + + +
+ +
+ +
+ + +
+ +
+
+
+
+
+ 学院动态
+
+ 当前位置: + 网站首页 + + +
+
+ + +
+ +
+ +
+ + + + + +
+
共542条  1/37 
首页上页  
+
+ +
+
+
+ + +
+ +
+ + + + diff --git a/test/html/snnu_css_notice.html b/test/html/snnu_css_notice.html new file mode 100644 index 0000000..624805e --- /dev/null +++ b/test/html/snnu_css_notice.html @@ -0,0 +1,418 @@ + + + +通知公告-陕西师范大学计算机科学学院 + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ + + +
+ +
+ +
+ + +
+ +
+
+
+
+
+ 通知公告
+
+ 当前位置: + 网站首页 + + +
+
+ + +
+ +
+ +
+ + + + + +
+
共396条  1/27 
首页上页  
+
+ +
+
+
+ + +
+ +
+ + + + diff --git a/test/html/snnu_cxinw_news.html b/test/html/snnu_cxinw_news.html new file mode 100644 index 0000000..3090ee4 --- /dev/null +++ b/test/html/snnu_cxinw_news.html @@ -0,0 +1,670 @@ + + + + + + +ѧԺ-ʦѧ봫ѧԺ-վ֧֣ + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + +
+
+ +
+ + + + + + + +
+ + + + + + + + + + +
+
+ +
+ +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ҳѧԺſŹʦʶѧѧоѧչʽУ
+ +
+
+ + + + + +
+ + + + +
+ + + + + + +
+ + + + + + + + + + +
+ + + + + +
+ Ź
+ + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
ѧԺλãҳ > ѧԺ
+
+ + + + + + +
+ + + + +
+ + + + + + + + +
Ժչ2018-12-20
+ + + + + + + +
Ժٿ2018-2019ѧѧᣨߴΣ2018-12-20
+ + + + + + + +
˹ŵѧʮڡ־ҺӵӺϰƽŴʵŴҪо2018-12-19
+ + + + + + + +
괫㣬ǡԺ2019ӭԲ2018-12-19
+ + + + + + + +
ĸ↑ʮѧϰ˳2018-12-19
+ + + + + + + +
˹ŵѧʮڡȹ㣺ý顢ۡѧ2018-12-18
+ + + + + + + +
˼Źϵн̳ʮһϰƽۺ˼ۡµ۹2018-12-13
+ + + + + + + +
ӰءʽԺ2018-12-13
+ + + + + + + +
ѧУʵҰȫԺʵҰȫ2018-12-13
+ + + + + + + +
ԺУѵγ˳2018-12-11
+ + + + + + + +
´רãΪѧƵķչשߡʦר2018-12-10
+ + + + + + + +
У201812·9˶ɽɹ2018-12-10
+ + + + + + + +
´רã ÿѧ˼άһϰ ר2018-12-09
+ + + + + + + +
´רãλרҵ ΰר2018-12-09
+ + + + + + + +
Ժӭ˳2018-12-08
+ + + + + + + +
´רãҵתδչר2018-12-08
+ + + + + + + +
´רãС»㽭ӣʷ ־ǿר2018-12-08
+ + + + + + + +
´רãһУһ ѧ֮Ϊ˴֮ƽר2018-12-08
+ + + + + + + +
˹ŵѧ70ڣܡ㴫ͳĻ Ļ2018-12-07
+ + + + + + + +
Ժٰ˹ŵѧ̳71ڡޣ̨˼𡷵Ĵ˼2018-12-07
+ + + + + + + +
Ժٰ˹ŵѧ̳69ڡ裺ÿѧ˼άΪһϰ2018-12-07
+ + + + + + + +
ѧϰ᳹ȫᾫ񡪡ΪԺʦ2018-12-07
+ + + + + + + +
Ժ2016㲥ӱർרҵϰչӳ˳2018-12-06
+ + + + + + + +
Ժٿ2018-2019ѧѧᣨΣ2018-12-06
+ + + + + + + +
ԺУѵγ̵ڶ˳չ2018-12-05
+ + + + + +
+ + + + +
+
 36ҳ ҳ 
+
+ +
+
+
+ +
+
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + +
+ + + + + +
+
+ + + + +
+ + + + +
+ + + + +
+
+ + + \ No newline at end of file diff --git a/test/html/snnu_cxinw_notice.html b/test/html/snnu_cxinw_notice.html new file mode 100644 index 0000000..211fcae --- /dev/null +++ b/test/html/snnu_cxinw_notice.html @@ -0,0 +1,670 @@ + + + + + + +֪ͨ-ʦѧ봫ѧԺ-վ֧֣ + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + +
+
+ +
+ + + + + + + +
+ + + + + + + + + + +
+
+ +
+ +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ҳѧԺſŹʦʶѧѧоѧչʽУ
+ +
+
+ + + + + +
+ + + + +
+ + + + + + +
+ + + + + + + + + + +
+ + + + + +
+ Ź
+ + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
֪ͨλãҳ > ֪ͨ
+
+ + + + + + +
+ + + + +
+ + + + + + + + +
Ժ2018оѧѧѡĹʾ2018-12-21
+ + + + + + + +
˼Ź̳ϵнԤ棺ϰƽۺŹۡµ۹2018-12-06
+ + + + + + + +
봫ѧԺ20181215࿼ʦ֪ͨ2018-12-06
+ + + + + + + +
봫ѧԺ2018רҵԱƸ μӱԱ԰2018-12-06
+ + + + + + + +
˹ŵѧԤ棺л㴫ͳĻĻ2018-12-02
+ + + + + + + +
˹ŵѧԤ棺ÿѧ˼άΪһϰ2018-12-02
+ + + + + + + +
봫ѧԺ2018רҵְְʸʾ2018-11-20
+ + + + + + + +
ѡƸѧԺʦ2019굣αε֪ͨ2018-11-16
+ + + + + + + +
˼Ź̳ϵнԤ棺ʩķ֮йѧʮ2018-11-06
+ + + + + + + +
˼Ź̳ϵнԤ棺й˼ʵ۵ĵ2018-11-06
+ + + + + + + +
ʦѧ봫ѧԺѧĿĻ񽱹ʾ2018-11-01
+ + + + + + + +
봫ѧԺ2019ҵƸ뺯2018-10-31
+ + + + + + + +
2018 йʷѧ༭оίԱѧߡʱı༭۴ҵչ̳֪ͨ2018-10-25
+ + + + + + + +
2018봫ѧԺѧ֪ͨ2018-10-23
+ + + + + + + +
Ժ2018оҽѧѡĹʾ2018-10-16
+ + + + + + + +
˿·Ӱڡ˿·µĵӰʴ߷̳֮У԰ӳὫУ2018-10-11
+ + + + + + + +
2018ȴýѧڶιֻ֪ͨ2018-10-11
+ + + + + + + +
ʦѧ봫ѧԺѧʾ2018-10-10
+ + + + + + + +
˿·µĵӰʴ߷̳УУ2018-10-10
+ + + + + + + +
˿·ӰڡУ԰ӳᡱԺ2018-10-09
+ + + + + + + +
ٴӳ봫ѧԺ2018ʵ鼼ԱƸʱĹ2018-10-09
+ + + + + + + +
2018ֵల2018-09-26
+ + + + + + + +
봫ѧԺ2017-2018ѧȹҽѧⱨʾ2018-09-26
+ + + + + + + +
ʦѧ봫ѧԺƼԹ2019о֪ͨ2018-09-20
+ + + + + + + +
ھٰʦѧʮһʦѧ֪ͨ2018-09-20
+ + + + + +
+ + + + +
+
 16ҳ ҳ 
+
+ +
+
+
+ +
+
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + +
+ + + + + +
+
+ + + + +
+ + + + +
+ + + + +
+
+ + + \ No newline at end of file diff --git a/test/html/snnu_geog_news.html b/test/html/snnu_geog_news.html new file mode 100644 index 0000000..983b349 --- /dev/null +++ b/test/html/snnu_geog_news.html @@ -0,0 +1,276 @@ + + +学院新闻-地理科学与旅游学院 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ +
+ +
+ + +
+
+ + + + + + + + + + + +
+
+
+ + 学院新闻 +
+
+ 您现在所在的位置: + 首页 + >> + 学院新闻 + +
+
+
+ +
+
共1188条  1/80 
上页123456..80
+ +
+
+
+
+ + + + + + + + diff --git a/test/html/snnu_geog_notice.html b/test/html/snnu_geog_notice.html new file mode 100644 index 0000000..db46830 --- /dev/null +++ b/test/html/snnu_geog_notice.html @@ -0,0 +1,276 @@ + + +通知公告-地理科学与旅游学院 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ +
+ +
+ + +
+
+ + + + + + + + + + + +
+
+
+ + 通知公告 +
+
+ 您现在所在的位置: + 首页 + >> + 通知公告 + +
+
+
+ +
+
共981条  1/66 
上页123456..66
+ +
+
+
+
+ + + + + + + + diff --git a/test/html/snnu_his_news.html b/test/html/snnu_his_news.html new file mode 100644 index 0000000..1de54e9 --- /dev/null +++ b/test/html/snnu_his_news.html @@ -0,0 +1,297 @@ + + + + + +新闻中心 新闻中心陕西师范大学历史文化学院 + + + + + + + + + +
+
+ + +
+
+ + +
+
+

新闻中心

+
+
+
+

新闻中心

+
您当前所在位置首页 > 新闻中心
+
+ + + +
+ + + +
+ +
+
+
首页12345尾页共 [ 230 ] 页
+
+
+ +
+
+
+ + +
+
+ +
+
+ 院长:hzl AT snnu.edu.cn
+ 书记:duhaibin AT snnu.edu.cn +
+ + + + +
+
+
+ + + + diff --git a/test/html/snnu_his_notice.html b/test/html/snnu_his_notice.html new file mode 100644 index 0000000..3546b02 --- /dev/null +++ b/test/html/snnu_his_notice.html @@ -0,0 +1,294 @@ + + + + + +通知公告 通知公告陕西师范大学历史文化学院 + + + + + + + + + +
+
+ + +
+
+ + +
+
+

通知公告

+
+
+
+

通知公告

+
您当前所在位置首页 > 通知公告
+
+ + + +
+
+ +
+
+
首页12345尾页共 [ 149 ] 页
+
+
+ +
+
+
+ + +
+
+ +
+
+ 院长:hzl AT snnu.edu.cn
+ 书记:duhaibin AT snnu.edu.cn +
+ + + + +
+
+
+ + + + diff --git a/test/html/snnu_ibs_news.html b/test/html/snnu_ibs_news.html new file mode 100644 index 0000000..851c986 --- /dev/null +++ b/test/html/snnu_ibs_news.html @@ -0,0 +1,815 @@ + + + + + +ѧԺ-ʦѧѧԺ-֧֣ + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
 ǣ20181224 һ + + + + +
 Ժ    ̹¼
+ + + + + + + + + + +
ѧУҳղEnglish
 
+ + + + +
  + + + + + + + +
+
+ + +
+ + + + +
+ + + + + + + + + + +
+
    +
  • +
  • + +
+
+
+ + + + +
+ + + + + +
+ + + + + +
+ + + + + + + + + + +
ѧԺ
+ + + + +
+ + + + +
+ +
+ + + + +
+
+
+ + + + +
+ + + + + + + + + +
+ + + + +
+ + + + + + +
ѧԺ λãҳ > ѧԺ
+ + + + +
+ + + + +
+ + + + + + + +
ʦѧƶоġũҵȺչɳɹ[2018-12-22]
+ + + + + + + +
Ժܽʱ̡ۺϱӭɹٰ[2018-12-21]
+ + + + + + + +
Ժ֯ʦտףĸ↑40[2018-12-18]
+ + + + + + + +
ԺѧμУ2019ҵƸ[2018-12-17]
+ + + + + + + +
ѧԺٿ֧ǹ[2018-12-14]
+ + + + + + + +
Ժڶоѧ˼̳ɹٰ[2018-12-12]
+ + + + + + + +
ԺٿMBAָʦ[2018-12-11]
+ + + + + + + +
ԺμйѧᲢѡµλ[2018-12-10]
+ + + + + + + +
Ժٿ2019Ȼѧ걨[2018-12-10]
+ + + + + + + +
ԺѧٻѼ[2018-12-10]
+ + + + + + + +
Уٿĸ﷢չѧоؽ[2018-12-07]
+ + + + + + + +
Ժٿίѧϰ[2018-12-06]
+ + + + + + + +
Ժٿȫᾫֻ[2018-12-06]
+ + + + + + + +
Ժ2018ѧ´ҵ⽲[2018-12-05]
+ + + + + + + +
ԺԱڵרٻ칫ʮѧѧɹ[2018-12-05]
+ + + + + +
+ + + + +
+
+ ҳ   + һҳ   + һҳ   + ĩҳ   + 47ҳ  ǵڡ1ҳ   + ת + + + ҳ +
+
+
+
+
+
+ + + + +
+ + + + +
+ + + +
Copyright © 2012- All Rights Reserved.ʦѧѧԺ Ȩ ֧֣
ַʡг620 ʱࣺ710119 绰02985310273
+
+ + + diff --git a/test/html/snnu_ibs_notice.html b/test/html/snnu_ibs_notice.html new file mode 100644 index 0000000..6bb3ace --- /dev/null +++ b/test/html/snnu_ibs_notice.html @@ -0,0 +1,776 @@ + + + + + +֪ͨ-ʦѧѧԺ-֧֣ + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
 ǣ20181224 һ + + + + +
 Ժ    ̹¼
+ + + + + + + + + + +
ѧУҳղEnglish
 
+ + + + +
  + + + + + + + +
+
+ + +
+ + + + +
+ + + + + + + + + + +
+
    +
  • +
  • + +
+
+
+ + + + +
+ + + + + +
+ + + + + +
+ + + + + + + + + + +
֪ͨ
+ + + + +
+ + + + +
+ +
+ + + + +
+
+
+ + + + +
+ + + + + + + + + +
+ + + + +
+ + + + + +
֪ͨλãҳ > ֪ͨ
+ + + + +
+ + + + +
+ + + + + + + +
ѧԺD˲϶ʾ[2018-12-24]
+ + + + + + + +
ѧԺѧԤ[2018-12-18]
+ + + + + + + +
ھٰԺ2018ۺϱӭ֪ͨ[2018-12-17]
+ + + + + + + +
ѧԺݿ⣨S180561SHANGXUE012Fɹ[2018-12-17]
+ + + + + + + +
ݿɹ[2018-11-28]
+ + + + + + + +
ѧԺ2018ְ걨Ϲʾ[2018-11-19]
+ + + + + + + +
ѧԺѧԤ[2018-11-16]
+ + + + + + + +
ѧԺѧԤ[2018-11-02]
+ + + + + + + +
ѧԺСʱʦOffice Hourű[2018-10-08]
+ + + + + + + +
2018ֵలű[2018-09-29]
+ + + + + + + +
2018ֵలű[2018-09-21]
+ + + + + + + +
ѧԺѧԤ[2018-09-21]
+ + + + + + + +
ѧԺʮ߽ѧᡢоҪѧɲʾ[2018-09-18]
+ + + + + + + +
ѧԺ2019Ƽо˵[2018-09-13]
+ + + + + + + +
ھйѧԺ2018ѧ֪ͨ[2018-09-10]
+ + + + + +
+ + + + +
+
+ ҳ   + һҳ   + һҳ   + ĩҳ   + 28ҳ  ǵڡ1ҳ   + ת + + + ҳ +
+
+
+
+
+
+ + + + +
+ + + + +
+ + + +
Copyright © 2012- All Rights Reserved.ʦѧѧԺ Ȩ ֧֣
ַʡг620 ʱࣺ710119 绰02985310273
+
+ + + diff --git a/test/html/snnu_index_news.html b/test/html/snnu_index_news.html new file mode 100644 index 0000000..075c728 --- /dev/null +++ b/test/html/snnu_index_news.html @@ -0,0 +1,401 @@ + + +师大新闻-陕西师范大学 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+
您的位置: 首页 >> 师大新闻
+
+

师大新闻

+ + +
+ +
+ + +

2018-12-24

【扶贫在路上】“陕西师范大学扶贫政策与评估研究中心”揭牌
详情 12月20日下午,“陕西师范大学扶贫政策与评估研究中心”揭牌仪式在文澜楼举行。我校杨祖培副校长与...
+
+ + +
+ + +

2018-12-24

我校召开“中华礼仪文化街区建设”研讨会
详情 12月23日上午,“中华礼仪文化街区建设”研讨会在雁塔校区崇鋈楼三层敏行厅召开。副校长党怀兴出席...
+
+ + +
+ + +

2018-12-24

我校印度尼西亚籍博士入选2018年度“博士后国际交流计划”引进项目
详情 12月20日,全国博士后管委会办公室公布了2018年度“博士后国际交流计划”引进项目获选结果,由我校...
+
+ + +
+ + +

2018-12-24

【科研动态】我校在大面积柔性钙钛矿单晶薄膜研究中取得突破性进展
详情 钙钛矿单晶由于具有高的吸收系数,长的载流子寿命,大的迁移率以及高的缺陷容忍性等特点而备受关注...
+
+ + +
+ + +

2018-12-24

出版总社开展致敬改革开放40周年系列宣传
详情 12月18日出版的《中国出版传媒商报》、19日出版的《中国新闻出版广电报》先后发布了“致敬改革开放4...
+
+ + +
+ + +

2018-12-23

“梦回长安——百万校友回归”我校专场活动隆重举行
详情 12月22日下午,由中共西安市委、西安市人民政府、陕西师范大学主办的“梦回长安——百万校友回归”...
+
+ + + + + +
+ + +

2018-12-22

我校组织召开第五届中国教育后勤互联网大会
详情 12月19日,由中国教育后勤协会和中国教育后勤协会信息化建设专业委员会主办的“第五届中国教育后勤...
+
+ +
+
共5972条  1/747 
首页上页  
+ +

[ 返回顶部 | 师大新闻网 ]

+
+ +
+
+
+
+ + + + + + + + diff --git a/test/html/snnu_index_notice.html b/test/html/snnu_index_notice.html new file mode 100644 index 0000000..173c6fc --- /dev/null +++ b/test/html/snnu_index_notice.html @@ -0,0 +1,397 @@ + + +通知公告-陕西师范大学 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ 您的位置: 首页 >> 通知公告 +
+ +

通知公告

+ + +
+ +
+
共4079条  1/204 
首页上页  
+
+
+
+
+ + + + + + + diff --git a/test/html/snnu_iscs_news.html b/test/html/snnu_iscs_news.html new file mode 100644 index 0000000..de7041e --- /dev/null +++ b/test/html/snnu_iscs_news.html @@ -0,0 +1,968 @@ + + + + + + + +综合要闻-陕西师范大学国际汉学院 + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + +
+ 设为首页 + | + 加入收藏 + |联系我们
+ +
+ + + + + + + +
+ + +
+ + + + + + + +
+ + +
+
+ + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + +
+ + + + + +
 
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
院长寄语 +
+ + + +
学院概况 +
+ + + +
学院领导 +
+ + + +
机构设置 +
+ + + +
师资队伍 +
+ + + +
管理制度 +
+ + + +
合作交流 +
+ + + + + + + + + + + +
+ + + + + +
 
+ + +
+ +地址:陕西省西安市长安南路199号 +
邮编:710062 +
网址:http://iscs.snnu.edu.cn +
传真:86-29-85303653 +
邮箱:hxyuan@snnu.edu.cn +
+ + + + +
+ + + +
+ + + + + + +
+ + + + +
  +
+
+ +
您现在的位置: + + 首页 + + >> + + 新闻动态 + + >> + + 综合要闻 + +
+ + + + + + + + + + +
综合要闻
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
国际汉学院在首届研究生汉语教学微课大赛(全国邀请赛)中荣获佳绩 2018-12-24
​中山大学周小兵教授莅临国际汉学院作学术讲座 2018-12-24
数月磨砺,且看今朝——国际汉学院举办考研、考汉办志愿者学生慰问座谈会 2018-12-24
匈牙利赛格德大学客座教授李文焘莅临国际汉学院作学术讲座 2018-12-10
国际汉学院开展冬季学生宿舍全面检查 2018-11-13
2018年国侨办“热心海外华教人士”研习班 在我校顺利结业 2018-10-23
2018年国侨办“热心海外华教人士”研习班 开班仪式在我校举行 2018-10-23
“感知中国-创业舞台”陕西省来华留学生就业创业体验活动启动仪式在我校成功举办 2018-10-17
2018“青年汉学家研修计划(西安)”开班仪式成功举办 2018-09-11
华文教育——2018海外华文教师陕西培训班圆满落幕 2018-07-12
暑期项目——2018俄罗斯高等经济技术大学暑期短期项目举行开班仪式暨入学教育 2018-07-03
华文教育——2018海外华文教师陕西培训班在我校开班 2018-07-03
国际汉学院成功举办第二十期青年学术沙龙 2018-07-02
“感知长安城”——2018香港恒生管理学院“普通话实践与中国传统文化体验项目”顺利进行 2018-06-14
美国博林格林州立大学2018年暑期项目顺利开班 2018-05-24
“让理想扎根 让青春飞扬”——“学习习近平总书记在北京大学师生座谈会上的讲话”主题教育活动 2018-05-24
中外学生感知中国新时代——国际汉学院组织中外学生集体观看《厉害了,我的国》纪录片 2018-05-24
心有猛虎,一路向阳——汉语国际教育2015级本科生举行心理健康教育主题班会 2018-05-24
秉信立行,诚信就业——汉语国际教育2014级本科生举行诚信就业宣誓仪式 2018-05-24
美国莱特州立大学短期汉语文化进修班顺利开班 2018-05-17
+ + + +
+
共436条  1/22 
首页上页  
+ + + + +
+ + + + + + +
+ + + + +
+ + + +

  地址:西安市长安南路199号  邮编:710062  电话:029-85308874 传真:029-85303653
院长邮箱:hxy_yuanzhang@163.com 版权:陕西师范大学国际汉学院

+ +回到顶部 + + + + + + + +无标题文档 + + + + + + + +
+ +
+
+
+
    + +
  • 在线客服
  • +
+ + +
+
+
+ + diff --git a/test/html/snnu_iscs_notice.html b/test/html/snnu_iscs_notice.html new file mode 100644 index 0000000..ca84f32 --- /dev/null +++ b/test/html/snnu_iscs_notice.html @@ -0,0 +1,968 @@ + + + + + + + +学院公告-陕西师范大学国际汉学院 + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + +
+ 设为首页 + | + 加入收藏 + |联系我们
+ +
+ + + + + + + +
+ + +
+ + + + + + + +
+ + +
+
+ + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + +
+ + + + + +
 
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
院长寄语 +
+ + + +
学院概况 +
+ + + +
学院领导 +
+ + + +
机构设置 +
+ + + +
师资队伍 +
+ + + +
管理制度 +
+ + + +
合作交流 +
+ + + + + + + + + + + +
+ + + + + +
 
+ + +
+ +地址:陕西省西安市长安南路199号 +
邮编:710062 +
网址:http://iscs.snnu.edu.cn +
传真:86-29-85303653 +
邮箱:hxyuan@snnu.edu.cn +
+ + + + +
+ + + +
+ + + + + + +
+ + + + +
  +
+
+ +
您现在的位置: + + 首页 + + >> + + 新闻动态 + + >> + + 学院公告 + +
+ + + + + + + + + + +
学院公告
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
国际汉学院2018年国庆节值班安排表 2018-09-27
陕西师范大学国际汉学院2019年推免复试时间安排 2018-09-20
2018年中秋节值班安排表 2018-09-19
陕西师范大学国际汉学院接收2019级推荐免试硕士研究生工作安排 2018-09-18
国际汉学院2018年暑假上班安排表 2018-07-12
国际汉学院2018年端午节值班安排表 2018-06-12
国际汉学院晋升八级职员名单公示 2018-05-15
国际汉学院2018年劳动节值班安排表 2018-04-23
国际汉学院2018年清明节值班安排表 2018-04-02
2018年陕西师范大学国际汉学院第一志愿复试时间安排 2018-03-23
2018年陕西师范大学国际汉学院优秀生源复试时间安排 2018-03-20
【招聘】美国国务院关键语言奖学金中文项目2018年暑期兼职对外汉语教师招聘启事 2018-03-16
国际汉学院2018年硕士研究生优秀生源调剂公告 2018-03-06
2018 Enrollment Brochure for the "Visiting Program for Young Sinologists" (Xi'an) 2018-02-14
2018“青年汉学家研修计划”(西安)招生简章 2018-02-14
国际汉学院2018年寒假值班安排 2018-01-27
陕西师范大学国际汉学院留学生管理办公室招聘启事 2017-12-28
2018年“元旦”值班安排 2017-12-27
国际汉学院2017年国庆节、中秋节值班安排表 2017-09-28
陕西师范大学国际汉学院推免研究生复试安排 2017-09-28
+ + + +
+
共181条  1/10 
首页上页  
+ + + + +
+ + + + + + +
+ + + + +
+ + + +

  地址:西安市长安南路199号  邮编:710062  电话:029-85308874 传真:029-85303653
院长邮箱:hxy_yuanzhang@163.com 版权:陕西师范大学国际汉学院

+ +回到顶部 + + + + + + + +无标题文档 + + + + + + + +
+ +
+
+
+
    + +
  • 在线客服
  • +
+ + +
+
+
+ + diff --git a/test/html/snnu_jwc_news.html b/test/html/snnu_jwc_news.html new file mode 100644 index 0000000..194e929 --- /dev/null +++ b/test/html/snnu_jwc_news.html @@ -0,0 +1,534 @@ + + + + +ʦѧ + + + + + + + +
+ + + + + + + + + +
ѧУҳ | ɰ | ղ
20181224 
+ + + + +
վ + + + +
+ + + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
վҳ| + + | + + | + + | + + | + + | + + || + +
+ + + + + +
+ + + + + + + +
+
+ + + + + +
+ + + + +
ַʡг620
绰029-85310332
+ + + + + +
+ + + + +
+
+
+
+ + + + + + + + + + + + +
λ>>Ŷ̬
+ + + + + + + +
Ŷ̬
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Ķ:139 +
(2018/11/13) +
+
+ Ķ:145 +
(2018/10/19) +
+
+ Ķ:145 +
(2018/9/29) +
+
+ Ķ:240 +
(2018/9/26) +
+
+ Ķ:164 +
(2018/9/21) +
+
+ Ķ:123 +
(2018/9/21) +
+
+ Ķ:92 +
(2018/9/21) +
+
+ Ķ:163 +
(2018/9/14) +
+
+ Ķ:132 +
(2018/9/12) +
+
+ Ķ:740 +
(2018/7/19) +
+
+ Ķ:589 +
(2018/7/17) +
+
+ Ķ:674 +
(2018/7/11) +
+
+ Ķ:813 +
(2018/7/6) +
+
+ Ķ:1267 +
(2018/6/22) +
+
+ Ķ:1048 +
(2018/6/6) +
+
+ Ķ:561 +
(2018/6/6) +
+
+ Ķ:1510 +
(2018/6/5) +
+
+ Ķ:1086 +
(2018/5/31) +
+
+ Ķ:541 +
(2018/5/16) +
+
+ Ķ:589 +
(2018/5/2) +
+
+
+ + һҳ βҳ + + 45ÿҳʾ201ҳ3ҳ + + + +
 
 
+ + + + +
+ + + + +
+ + + +
Copyright©2018ʦѧ
ַ:ʡг620
绰:029-85310332
+12314574 ֧֣Ļ
+ + + + + +
+
+ + + diff --git a/test/html/snnu_jwc_notice.html b/test/html/snnu_jwc_notice.html new file mode 100644 index 0000000..660d229 --- /dev/null +++ b/test/html/snnu_jwc_notice.html @@ -0,0 +1,994 @@ + + + + +ʦѧ + + + + + + + +
+ + + + + + + + + +
ѧУҳ | ɰ | ղ
20181224 
+ + + + +
վ + + + +
+ + + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
վҳ| + + | + + | + + | + + | + + | + + || + +
+ + + + + +
+ + + + + + + +
+
+ + + + + +
+ + + + +
ַʡг620
绰029-85310332
+ + + + + +
+ + + + +
+
+
+
+ + + + + + + + + + + + +
λ>>֪ͨ
+ + + + + + + +
֪ͨ
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Ķ:666 +
(2018/12/19) +
+
+ Ķ:348 +
(2018/12/19) +
+
+ Ķ:923 +
(2018/12/18) +
+
+ Ķ:255 +
(2018/12/17) +
+
+ Ķ:608 +
(2018/12/17) +
+
+ Ķ:484 +
(2018/12/17) +
+
+ Ķ:3570 +
(2018/12/14) +
+
+ Ķ:319 +
(2018/12/12) +
+
+ Ķ:193 +
(2018/12/12) +
+
+ Ķ:290 +
(2018/12/11) +
+
+ Ķ:412 +
(2018/12/12) +
+
+ Ķ:330 +
(2018/12/12) +
+
+ Ķ:978 +
(2018/12/11) +
+
+ Ķ:302 +
(2018/12/11) +
+
+ Ķ:199 +
(2018/12/11) +
+
+ Ķ:204 +
(2018/12/11) +
+
+ Ķ:609 +
(2018/12/7) +
+
+ Ķ:794 +
(2018/12/6) +
+
+ Ķ:761 +
(2018/12/5) +
+
+ Ķ:232 +
(2018/12/4) +
+
+
+ + һҳ βҳ + + 4646ÿҳʾ201ҳ233ҳ + + + +
 
 
+ + + + +
+ + + + +
+ + + +
Copyright©2018ʦѧ
ַ:ʡг620
绰:029-85310332
+12314573 ֧֣Ļ
+ + + + + +
+
+ + + diff --git a/test/html/snnu_lib_news.html b/test/html/snnu_lib_news.html new file mode 100644 index 0000000..c6ea39f --- /dev/null +++ b/test/html/snnu_lib_news.html @@ -0,0 +1,376 @@ + + + + + + + + + + + + +陕西师范大学图书馆 + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+
+
+ + +
+
+
+ + + +
+
+
+ +

馆内新闻

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+标题 + +时间 + +访问次数 +
+图书馆进入刷脸、扫码入馆时代 + +2018-12-21 + +98 +
+“笔墨传情,文脉相承”古籍函套题名书写活动圆满结束 + +2018-12-11 + +170 +
+我馆代表参加2018年陕西省高校图工委信息技术应用专题研讨会 + +2018-12-11 + +105 +
+图书馆荣获中国图书馆学会“2017年全民阅读优秀组织”称号 + +2018-12-05 + +125 +
+我馆代表参加2018年陕西高校图书馆员读者服务典型案例展示交流会 + +2018-11-23 + +234 +
+图书馆荣获2018年教职工乒乓球团体比赛第三名 + +2018-11-21 + +200 +
+图书馆同数学与信息科学学院联合举办学术报告 + +2018-11-21 + +153 +
+2018陕西师范大学读书节圆满闭幕 + +2018-11-16 + +202 +
+图书馆代表队在我校2018年教职工登山团体赛中摘得桂冠 + +2018-11-09 + +208 +
+异口同声,声动梁尘——“2018陕西师范大学读书节·经典晨读”圆满结束 + +2018-11-06 + +206 +
+图书馆2018读书节专家讲座:“我们为什么要研读希罗多德《历史》?” + +2018-11-05 + +145 +
+我馆馆员在“陕西省图书馆员知识竞赛”中荣获佳绩 + +2018-10-31 + +243 +
+李永明馆长率团调研大荔县图书馆并喜结帮扶对子 + +2018-10-31 + +273 +
+2018陕西师范大学读书节·寻书大赛成功举办 + +2018-10-31 + +225 +
+图书馆召开2018年馆内科研项目评审会 + +2018-10-25 + +228 +
+图书馆首次在 ILS 学科领域 SSCI 2 区期刊上发表研究成果 + +2018-10-22 + +420 +
+碑石遗韵 拓古传今:图书馆举办馆藏精品拓片展 + +2018-10-18 + +204 +
+南京邮电大学图书馆钱军馆长来馆作交流报告 + +2018-10-16 + +333 +
+清渠如许,活水为源 —— 2018陕西师范大学读书节隆重开幕 + +2018-10-11 + +334 +
+我馆首次在国际著名SCI期刊上发表图书情报类研究论文 + +2018-09-03 + +945 +
+ + + + + + + + + + + + + + +
+
+
+
+ +
+
+
+
+
+ 地址:西安市长安区西长安街620号邮编:710119 联系电话:029-85310113
+ Copyright© 2016 Shaanxi Normal University Library. All rights reserved. +
+

    图书馆微信
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/test/html/snnu_lib_notice.html b/test/html/snnu_lib_notice.html new file mode 100644 index 0000000..c351885 --- /dev/null +++ b/test/html/snnu_lib_notice.html @@ -0,0 +1,376 @@ + + + + + + + + + + + + +陕西师范大学图书馆 + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+
+
+ + +
+
+
+ + + +
+
+
+ +

馆内公告

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+标题 + +时间 + +访问次数 +
+听报告,趣答题——网上报告厅有奖竞赛活动获奖通知 + +2018-12-21 + +69 +
+2018 IEEE Xplore科技文献趣味检索达人挑战赛获奖通知 + +2018-12-07 + +253 +
+陕西师范大学文献QQ群开通公告 + +2018-12-03 + +1632 +
+关于“笔墨传情,文脉相承”古籍函套题名书写人招募的通知 + +2018-11-19 + +483 +
+听报告,趣答题——网上报告厅有奖竞赛活动通知 + +2018-11-19 + +453 +
+2018年专业技术职务任职资格评审初审通过人员名单公示 + +2018-11-16 + +597 +
+爱如生系列数据库升级为网络版使用通知 + +2018-11-12 + +580 +
+“聪明大脑”来答题—科学文库有奖问答获奖名单 + +2018-11-06 + +404 +
+2018年陕西师范大学读书节“真人图书馆”邀你来聆听分享 + +2018-11-05 + +267 +
+陕西师范大学图书馆中外文报刊使用情况调查表 + +2018-10-26 + +416 +
+IEEE Xplore科技文献趣味检索达人挑战赛 + +2018-10-23 + +364 +
+2018陕西师范大学读书节.寻书大赛比赛时间等事项的通知 + +2018-10-22 + +802 +
+写心得 赢Kindle(有奖征文) + +2018-10-17 + +763 +
+关于陕西师范大学图书馆精品拓片的通知 + +2018-10-11 + +502 +
+清渠如许,活水为源——2018陕西师范大学读书节 + +2018-10-08 + +657 +
+导航有北斗,寻书有你2018陕西师范大学读书节·寻书大赛 + +2018-10-08 + +343 +
+2018陕西师范大学读书节·经典晨读人员分组名单 + +2018-09-30 + +533 +
+关于开通“陕师大教师外文服务群”的试用通知 + +2018-09-30 + +456 +
+“聪明大脑”来答题——科学文库有奖问答活动 + +2018-09-30 + +576 +
+2018年国庆节图书馆值班安排表 + +2018-09-28 + +646 +
+ + + + + + + + + + + + + + +
+
+
+
+ +
+
+
+
+
+ 地址:西安市长安区西长安街620号邮编:710119 联系电话:029-85310113
+ Copyright© 2016 Shaanxi Normal University Library. All rights reserved. +
+

    图书馆微信
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/test/html/snnu_lifesci_news.html b/test/html/snnu_lifesci_news.html new file mode 100644 index 0000000..7c4a130 --- /dev/null +++ b/test/html/snnu_lifesci_news.html @@ -0,0 +1,257 @@ + + + + + + + 陕西师范大学生命科学学院 School Of Life Sciences,SNNU + + + + + + + + + + + + +
+ + + + + +
+
+
+ 现在是:2018/12/24 17:34:55,

+
+ + +
+
+ + + + +
+ +
+
+
+
+
+ 学院动态
+
+ 当前位置: + 网站首页> + 学院动态> + 所有新闻 +
+
+ + +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+
+ + +
+ +
+ +
+ + diff --git a/test/html/snnu_lifesci_notice.html b/test/html/snnu_lifesci_notice.html new file mode 100644 index 0000000..e4438bc --- /dev/null +++ b/test/html/snnu_lifesci_notice.html @@ -0,0 +1,257 @@ + + + + + + + 陕西师范大学生命科学学院 School Of Life Sciences,SNNU + + + + + + + + + + + + +
+ + + + + +
+
+
+ 现在是:2018/12/24 17:34:55,

+
+ + +
+
+ + + + +
+ +
+
+
+
+
+ 通知公告
+
+ 当前位置: + 网站首页> + 通知公告> + 所有通知公告 +
+
+ + +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+
+ + +
+ +
+ +
+ + diff --git a/test/html/snnu_lit_news.html b/test/html/snnu_lit_news.html new file mode 100644 index 0000000..8e36a5e --- /dev/null +++ b/test/html/snnu_lit_news.html @@ -0,0 +1,343 @@ + + + + + + + + 学院新闻 - 陕西师范大学文学院 + + + + + + + +
+
+ + +
+
+ + + + + + +
+
+ + +
+
+
+
+
+ 快速导航 +
+ +
+
+
+ 友情链接: + + + + + +
+ +
+ + +
+ +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/test/html/snnu_lit_notice.html b/test/html/snnu_lit_notice.html new file mode 100644 index 0000000..b0900de --- /dev/null +++ b/test/html/snnu_lit_notice.html @@ -0,0 +1,342 @@ + + + + + + + + 公告 - 陕西师范大学文学院 + + + + + + + +
+
+ + +
+
+ + + + + + +
+
+
+
+ 学院新闻 +
+ +
+ +
+
+
+
+
+ 快速导航 +
+ +
+
+
+ 友情链接: + + + + + +
+ +
+ + +
+ +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/test/html/snnu_marxism_news.html b/test/html/snnu_marxism_news.html new file mode 100644 index 0000000..c0d3910 --- /dev/null +++ b/test/html/snnu_marxism_news.html @@ -0,0 +1,568 @@ + + +学院新闻-马克思主义学院 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ +
+ +
+ + + + + + + + + + + + + + +
+ +
+
+ +
+
+
+ + +
+
+
+ +
+ + + +
+
    +
  • +
    +
    + +
    +
    +
    +

    我院青年团校初级培训班第五讲“庆祝改革开放四十周年学习会”顺利举办

    +

    2018-12-22

    +

    为深入学习贯彻习近平总书记在庆祝改革开放40周年大会上的重要讲话精神,弘扬并坚持以爱国主义为核心的民族精神和以改革创新为核心的时代精神,12月20日晚,“青年大学习,奋进新时代——庆祝改革开放40周年”主题学习交流会在学院四楼3423教师技能训练室成功举办。学生会成员及社团代表参加此次交流会,交流会由学院团委副书记、2016级本科生牛欣欣主持。会前,同学们观看了庆祝改革开放40周年讲话要点视频,回顾大会盛况,学...

    +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    我院“传经送宝,砥砺奋进,思政一家人”经验交流会、读书分享会成功举办

    +

    2018-12-20

    +

    为增强我院思想政治教育专业研究生的凝聚力与向心力、激发学生的学习热情、培养学生的研究能力。12月18日,我院思想政治教育学位点召开了以“传经送宝,砥砺奋进,思政一家人”为主题的思想政治教育专业经验交流会和读书分享会,参加活动的有朱尉副教授、博士研究生马喜宁以及思想政治教育专业全体硕士研究生,会议由张莹主持。首先,在经验交流会环节,优秀老生代表依次进行了经验分享。朱尉副教授强调在读研期间我们需要具...

    +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    我院在第八届“华文杯”教育硕士(学科教学·思政)教学技能展示活动中获佳绩

    +

    2018-12-20

    +

    ​12月15日至16日,中国教育协会2018微格教学·思想政治课程与教学论高峰论坛暨第八届“华文杯”教育硕士(学科教学·思政)教学技能展示活动在华中师范大学举行。本次活动由中国教育技术协会微格教学专业委员会主办,华中师范大学马克思主义学院承办。我院宋吉玲副教授带队赴华中师范大学参加比赛。来自全国各地四十余所院校一百多位选手分为五组进行了教学技能展示。经过激烈角逐,马克思主义学院2018级学科教学(思政)专业...

    +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    “四十回眸话改革,唱响青春最强音”——我院新时代大学生理论宣讲团赴西北工业大学理学院宣讲交流

    +

    2018-12-20

    +

    12月19日下午,我院新时代大学生理论宣讲团应邀前往西北工业大学理学院参加以“四十回眸话改革,建功立业新时代”为主题的宣讲交流会。参加本次宣讲交流会的有我院王东红副教授、辅导员朱瑜及西北工业大学理学院团委段利兵副书记与辅导员樊文迪。同时理学院部分学生代表也积极参与了本次交流活动。西工大理学院党委副书记段利兵对新时代大学生理论宣讲团的到来表示欢迎,并指出此次交流活动是文理交融,理论联系实践的优秀示...

    +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    研究生第一党支部接收预备党员大会暨组织生活会胜利召开

    +

    2018-12-20

    +

    12月18日晚,我院研究生第一党支部接收预备党员暨组织生活会在文澜楼C段四层学院会议室召开,会议主题为接收预备党员和学习纪念改革开放四十周年的相关材料和视频。研究生第一党支部全体党员参加本次会议,会议由研究生第一党支部书记张迪主持。会议首先进行接收预备党员的议程,四名同志对自己成为入党积极分子以来的思想、学习、工作等方面进行了汇报,并诚恳的请各位党员同志批评指正,这四位同志的入党培养联系人、党小组...

    +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    我院2018级本科生组织收看“庆祝改革开放40周年”大会视频

    +

    2018-12-19

    +

    为进一步加深同学们对改革开放的了解,更好传承和弘扬改革开放精神,在新时代促进改革开放精神深扎青年学生思想沃土。12月18日下午16:30,我院2018级本科生在雁塔校区教学五楼5101教室观看“庆祝改革开放40周年”大会。活动由2018级辅导员杨子熙主持。杨子熙就改革开放有关知识向同学们进行详细介绍并传达我院观看大会的会议精神。同学们全体起立跟唱国歌并认真观看大会讲话视频。大会指出,改革开放铸就的伟大改革开放精神,...

    +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    深刻的变革 伟大的成就——研究生第二党支部学习习近平总书记在庆祝改革开放40周年大会上的重要讲话

    +

    2018-12-19

    +

    12月18日晚19时,研究生第二党支部在学院教师技能训练室举行以学习贯彻习近平总书记在庆祝改革开放40周年大会上的重要讲话为主题的支部会议,会议由支部书记刘帅强主持。习近平同志的讲话从10个方面回顾了改革开放40年以来的辉煌成就,深刻总结了改革开放的宝贵经验,重点提出九个“必须坚持”。当日,支部组织全体党员和积极分子观看了庆祝改革开放40周年大会直播,党员同志们对改革开放的历史地位以及重要意义有了更加深刻...

    +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    我院2019年考研学生慰问座谈会成功举行

    +

    2018-12-19

    +

    12月18日上午,学院在综合学术研讨室举行2019年考研学生慰问座谈会,学院党委书记闫文浩、院长任晓伟出席会议,本科生毕业班辅导员崔林刚以及参加2019年研究生入学考试的全体学生参加了会议,会议由学院党委副书记屈桃主持。屈桃向参会学生介绍了座谈会的目的。她谈到,学院选在距离考试前三四天的日子举行座谈会,主要目的在于帮助同学们以更加积极的心态参加考试,学院还为参加考试的同学准备了考试文具,祝愿同学们取得优...

    +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    美国路易斯安那大学威廉·戴维教授做客我院正学论坛

    +

    2018-12-19

    +

    12月18日上午,我院“正学论坛”第三十五期在学院四楼会议室成功举办。美国传播学领域知名学者、路易斯安那大学教授威廉·戴维应邀作了题为“美国媒体眼中的中美贸易战”的学术报告。学院许晓春副教授及30余名研究生参加了报告会,报告会由副院长刘力波教授主持。报告会伊始,戴维教授首先从媒体传播如何影响政治的三个关键概念切入,向在座师生剖析了美国总统特朗普在中美贸易战中如何利用媒体传播规律,以异于常态的方式引起...

    +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    我院师生收看庆祝改革开放40周年大会

    +

    2018-12-18

    +

    12月18日上午10时,庆祝改革开放40周年大会在人民大会堂隆重举行。中共中央总书记、国家主席、中央军委主席习近平出席大会并发表重要讲话。为深入学习贯彻庆祝改革开放40周年大会精神,感知新时代的新发展和新变化,学院领导班子、各党支部、团支部共计三百余名师生代表在文澜楼B段一层报告厅集中收看大会直播。下午,2018级一百五十余名本科生在雁塔校区教学五楼5101教室集中观看了会议回顾。各团支部通过多种形式进行了同步收...

    +
    +
    +
  • +
+
+
+
共537条  1/54 
首页上页  
+
+
+
+
+
+
+ + + + + + + diff --git a/test/html/snnu_marxism_notice.html b/test/html/snnu_marxism_notice.html new file mode 100644 index 0000000..7f658aa --- /dev/null +++ b/test/html/snnu_marxism_notice.html @@ -0,0 +1,639 @@ + + +通知公告-马克思主义学院 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + +
+
+ + + + +
+ +
+ +
+ +
+ + + +
+ +
+
+ +
+
+ + + + +
+
+
+
+
+ +
+ + + +
+
共185条  1/13 
首页上页  
+
+
+
+
+
+
+ + + + + + + diff --git a/test/html/snnu_maths_news.html b/test/html/snnu_maths_news.html new file mode 100644 index 0000000..0387912 --- /dev/null +++ b/test/html/snnu_maths_news.html @@ -0,0 +1,821 @@ + + + + + +学院新闻-数学与信息科学学院 + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

欢迎光临数学与信息科学学院!   

+ + + + + + +
+ + 设为首页 + | + + 加入收藏 + | +联系我们 | 怀念旧版 + + +
+ +
+
+ + + + + + +
+ + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+ + + + + +
+ + + +
学院新闻
+ + + +
+ + + + +
    学院新闻
+ + +
+ + + + + + + + + + +
+ + + + + +
+ + + + +
推荐新闻 
+ + + +
+ + + + + +
游旭群副校长参加我院党委201...
+ + + + + +
我院年度学术报告会顺利召开
+ + + + + +
2016年度我院基金资助成绩喜...
+ + + + + +
我院2016年获12项国家自然科...
+ + + + + +
我院卓越教师实验班学生走进...
+ + + + + +
我院党委换届选举大会顺利举行
+ + + + + +
李三平老师在2015年全省基础...
+ + + +
+ + + + + + + + + +
+ + + + + +
+ 您现在的位置: + 首页 + > + 学院新闻 +
+ + + +
+ + + + + + + + +
+ + 我院举行王世全院士兼职教授聘任仪式
+ + + + + + +
+ + 【党建工作】校发展规划办公室党支部与我院教工第三党支部联合开展主题...
+ + + + + + +
+ + 我院党委书记田安政一行走访西安电子科技大学网络与信息安全学院党委
+ + + + + + +
+ + 【党建工作】我院党委召开2018年党支部书记述职评议工作会
+ + + + + + +
+ + 我院窦井波教授入选2019年度陕西省杰出青年科学基金资助计划
+ + + + + + +
+ + 【党建工作】我院党委组织收看庆祝改革开放40周年大会
+ + + + + + +
+ + 【党建工作】文学院、数学与信息科学学院学生工作交流座谈会
+ + + + + + +
+ + 我院举办“学习全国教育大会精神”的专题党课
+ + + + + + +
+ + 英国伯明翰大学Achim Jung教授和湖南大学李庆国教授来我院进行学术交流
+ + + + + + +
+ + 我院召开2015级本科生实习工作总结暨毕业论文开题动员大会
+ + + + + + +
+ + 我院召开学习贯彻全国教育大会精神系列交流会
+ + + + + + +
+ + 柴天佑院士来我校交流指导工作
+ + + + + + +
+ + 我院召开青年骨干教师学习贯彻全国教育大会精神研讨交流会
+ + + + + + +
+ + 我校2018年全国大学生数学建模竞赛成绩创历史新高
+ + + + + + +
+ + 我院召开2018年院友交流座谈会
+ + + + + + +
+ + Fuzzy Sets and Systems杂志主编De Baets教授来我院进行学术交流
+ + + + + + +
+ + 我院接受师范类专业国家认证专家现场考查
+
+
共193条  1/12 
首页上页  
+ +
+ + + + + +
+ + + + + +
+
地址:西安市长安区西长安街620号       邮编:710119 
邮箱:maths@snnu.edu.cn 电话:029-85310232 传真:029-85310277 
+ + + + + + +
+

陕西师范大学数学与信息科学学院

+ + diff --git a/test/html/snnu_maths_notice.html b/test/html/snnu_maths_notice.html new file mode 100644 index 0000000..2f120cd --- /dev/null +++ b/test/html/snnu_maths_notice.html @@ -0,0 +1,821 @@ + + + + + +公告通知-数学与信息科学学院 + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

欢迎光临数学与信息科学学院!   

+ + + + + + +
+ + 设为首页 + | + + 加入收藏 + | +联系我们 | 怀念旧版 + + +
+ +
+
+ + + + + + +
+ + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+ + + + + +
+ + + +
公告通知
+ + + +
+ + + + +
    公告通知
+ + +
+ + + + + + + + + + +
+ + + + + +
+ + + + +
推荐新闻 
+ + + +
+ + + + + +
游旭群副校长参加我院党委201...
+ + + + + +
我院年度学术报告会顺利召开
+ + + + + +
2016年度我院基金资助成绩喜...
+ + + + + +
我院2016年获12项国家自然科...
+ + + + + +
我院卓越教师实验班学生走进...
+ + + + + +
我院党委换届选举大会顺利举行
+ + + + + +
李三平老师在2015年全省基础...
+ + + +
+ + + + + + + + + +
+ + + + + +
+ 您现在的位置: + 首页 + > + 公告通知 +
+ + + +
+ + + + + + + + +
+ + 工作量表填写通知
+ + + + + + +
+ + 关于核对2018-2019学年本科春季课程清单的通知
+ + + + + + +
+ + 数学与信息科学学院2018年结题中央高校自由探索项目参评优秀推荐公示
+ + + + + + +
+ + 关于2019年度国家自然科学基金项目申请与结题等有关事项的通知
+ + + + + + +
+ + 关于核对2018-2019学年第二学期公共课必修课+专业基础课课表通知
+ + + + + + +
+ + AIMS电子期刊数据库(2019年-2020年)采购结果公告
+ + + + + + +
+ + EMS电子期刊(2019年-2021年)&电子图书数据库(2004年-2020年)采购结...
+ + + + + + +
+ + 关于开展2017级博士及硕士研究生中期考核及开题工作的通知
+ + + + + + +
+ + 关于征集2019年度中央高校基本科研业务费专项资金项目(理工类)的通知
+ + + + + + +
+ + 2018年博士研究生指导教师岗位首次上岗资格备案的公示
+ + + + + + +
+ + 我院2018年“创新科研训练”项目立项结果公示
+ + + + + + +
+ + 关于采集我校个税申报自然人信息的通知
+ + + + + + +
+ + 关于做好2018年年终财务报销工作的通知
+ + + + + + +
+ + 关于做好2018-2019学年春季通识教育选修课申报工作的通知
+ + + + + + +
+ + 2018年度专业技术职务任职资格学院初审结果公示
+ + + + + + +
+ + 2018年下半年博士研究生毕业论文答辩海报(二)
+ + + + + + +
+ + 2018年下半年博士研究生毕业论文答辩海报(一)
+
+
共660条  1/39 
首页上页  
+ +
+ + + + + +
+ + + + + +
+
地址:西安市长安区西长安街620号       邮编:710119 
邮箱:maths@snnu.edu.cn 电话:029-85310232 传真:029-85310277 
+ + + + + + +
+

陕西师范大学数学与信息科学学院

+ + diff --git a/test/html/snnu_meishuxy_news.html b/test/html/snnu_meishuxy_news.html new file mode 100644 index 0000000..c6f7ccd --- /dev/null +++ b/test/html/snnu_meishuxy_news.html @@ -0,0 +1,659 @@ + + + + + + +ѧԺ-ʦѧѧԺ,ʦѧԺ-վ֧֣ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + +
+ + + + +
+ + + + + + +
+ + + + +
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ҳѧԺſʦƽѧоѧѧоȺѧҵƶչ
+
+
+
+ +
+ + + + + +
+ + + + + +
+ + + + + + + +
+ + + + + + + + + + +
+
+ + + + +
+ + + + + + + + + + + +
+
+
+ + + + + + + + + +
+ + + + + +
   λãҳ > +  > + ѧԺ
+ + + + + + + +
+
+
+ + + + + + +
+ + + + + + + +
ǮڡԺ̳2018-12-24
+ + + + + + + +
ƶ·ϣԺٰ᰸ļʦд㱨չ2018-12-19
+ + + + + + + +
Ժٰ2015ѧο̸2018-12-19
+ + + + + + + +
ѧԺ֯ʦտףĸ↑ʮʢ2018-12-19
+ + + + + + + +
ѧԺٿ֧ǹ2018-12-19
+ + + + + + + +
ѧԺѧϰ᳹ȫᾫר⸨2018-12-18
+ + + + + + + +
ѧԺ12ʦƷѡȫửƷչ2018-12-18
+ + + + + + + +
Ժμӣȫ黭Эߵѧ2018̳2018-12-11
+ + + + + + + +
ԺʦμӡУʷ״ȫѧֻ2018-12-11
+ + + + + + + +
ѧԺٿ2018оѧѧ2018-12-10
+ + + + + + + +
Ժʦμӡʦ̳ɪȫʦչ2018-12-03
+ + + + + + + +
ѧԺ2018ꡰӭ ·ͬСӭɹ2018-11-28
+ + + + + + + +
Ժɹٰ조ϰ䡱鷨2018-11-20
+ + + + + + + +
ѧԺ֧ѧϰȫᾫ2018-11-12
+ + + + + + + +
ΪԺоڡѧһΡ2018-11-06
+ + + + + + + +
ѧѧԺѧԺ2018-11-06
+ + + + + + + +
ƶ·ϣԺ᰸ļչ ׼ƶBļд2018-11-05
+ + + + + + + +
ԺѧʦѧԴءǩԼʽ2018-11-05
+ + + + + + + +
ԺڽԴСרҵʵϰдءǩԼʽ2018-11-01
+ + + + + + + +
Ժ֧̹֯ԱӰѧϰ2018-10-30
+ + + + + + + +
ԺڽʡѧʦѧԴءǩԼʽ2018-10-30
+ + + + + + + +
Խ㡪Ժٿ2019ҵ߾ҵԱ2018-10-26
+ + + + + + + +
ѧԺửѧɹѼ2018-10-23
+ + + + + + + +
ͨ͡ʶοչʦԻѧ2018-10-19
+ + + + + + + +
ѧԺٿ2018оҽѧ2018-10-16
+ + + + + +
+ + + + +
+
 24ҳ ҳ 
+
+
+
+ + + + + +
+ + + + +
+ + + +
+ + + + + +
Copyright ©2015- +  ʦѧѧԺ,ʦѧԺ Ȩ
+ַг620 ʱࣺ710119
+ + + + + + + +
Design & Support ֧֣
עǣ   
+
+ + + \ No newline at end of file diff --git a/test/html/snnu_meishuxy_notice.html b/test/html/snnu_meishuxy_notice.html new file mode 100644 index 0000000..d60450d --- /dev/null +++ b/test/html/snnu_meishuxy_notice.html @@ -0,0 +1,659 @@ + + + + + + +֪ͨ-ʦѧѧԺ,ʦѧԺ-վ֧֣ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + +
+ + + + +
+ + + + + + +
+ + + + +
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ҳѧԺſʦƽѧоѧѧоȺѧҵƶչ
+
+
+
+ +
+ + + + + +
+ + + + + +
+ + + + + + + +
+ + + + + + + + + + +
+
+ + + + +
+ + + + + + + + + + + +
+
+
+ + + + + + + + + +
+ + + + + +
   λãҳ > +  > + ֪ͨ
+ + + + + + + +
+
+
+ + + + + + +
+ + + + + + + +
ڷʦƸڿ˵Ĺʾ2018-12-20
+ + + + + + + +
2018ѧԺμְԱزϵĹʾ2018-11-20
+ + + + + + + +
תѧϰġŦԼѧϰйУѧѧѧϰƻ 2019괺ѧڱ֪ͨ2018-10-29
+ + + + + + + +
ѧԤ棺ȫ˿·ڽѧֻ2018-10-06
+ + + + + + + +
2018ֵలű2018-09-30
+ + + + + + + +
2018ֵలű2018-09-21
+ + + + + + + +
ѧԺ2019о԰2018-09-19
+ + + + + + + +
Ԥ2018-09-13
+ + + + + + + +
ѧԺ2018ϰలű2018-07-13
+ + + + + + + +
ѧԺװڼע֪ͨ2018-07-04
+ + + + + + + +
2018-2019.1ҿααĩ԰ű2018-07-02
+ + + + + + + +
ѧԺ2018ֵల2018-06-15
+ + + + + + + +
ںƸڿ˽Ĺʾ2018-06-14
+ + + + + + + +
525ԹڽԤ2018-05-23
+ + + + + + + +
Ľʦѧʦչ̳뺯2018-05-11
+ + + + + + + +
Ԥ2018-05-11
+ + + + + + + +
ʮһѧλίԱίԱƼʾ2018-05-08
+ + + + + + + +
ѧԺ2018ֵలű2018-04-04
+ + + + + + + +
ڶٻƸڿ˽Ĺʾ2018-03-23
+ + + + + + + +
2017ѧԺֵల2018-01-26
+ + + + + + + +
ѧԺ2017Ƚְ˽ʾ2018-01-09
+ + + + + + + +
2018Ԫֵలű2017-12-27
+ + + + + + + +
У2018Ԫżٵ֪ͨ2017-12-26
+ + + + + + + +
2017Ƚְ˹İ2017-12-26
+ + + + + + + +
ʾ2017-11-14
+ + + + + +
+ + + + +
+
 12ҳ ҳ 
+
+
+
+ + + + + +
+ + + + +
+ + + +
+ + + + + +
Copyright ©2015- +  ʦѧѧԺ,ʦѧԺ Ȩ
+ַг620 ʱࣺ710119
+ + + + + + + +
Design & Support ֧֣
עǣ   
+
+ + + \ No newline at end of file diff --git a/test/html/snnu_music_news.html b/test/html/snnu_music_news.html new file mode 100644 index 0000000..12ff996 --- /dev/null +++ b/test/html/snnu_music_news.html @@ -0,0 +1,333 @@ + + + + + + + + + + + + 学院新闻-陕西师范大学音乐学院 + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + +
+
+ +
+
+ + + +
+ +
+ +
+ +
+ + + + +
+ +
+
+
+ +
+
+

学院新闻

+
+ 您所在的位置:学院新闻 +
+
+
+ + +
+ + +
+
+
共782条  1/40 
首页上页  
+
+
+
+
+ + +
+ + + + + + + diff --git a/test/html/snnu_music_notice.html b/test/html/snnu_music_notice.html new file mode 100644 index 0000000..4e003b5 --- /dev/null +++ b/test/html/snnu_music_notice.html @@ -0,0 +1,333 @@ + + + + + + + + + + + + 通知公告-陕西师范大学音乐学院 + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + +
+
+ +
+
+ + + +
+ +
+ +
+ +
+ + + + +
+ +
+
+
+ +
+
+

通知公告

+
+ 您所在的位置:通知公告 +
+
+
+ + + +
+
共328条  1/17 
首页上页  
+
+
+
+
+ + +
+ + + + + + + diff --git a/test/html/snnu_psych_news.html b/test/html/snnu_psych_news.html new file mode 100644 index 0000000..0dec994 --- /dev/null +++ b/test/html/snnu_psych_news.html @@ -0,0 +1,7362 @@ + + + + + 陕西师范大学心理学院 + + + + + + + + +
+
+ + +
+ +
+ 当前位置: 首页 > 学院新闻 +
+ +
+ 日期范围: + + 至 + + +      + + 标题: + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 类型 + + 标题 + + 发布人 + + 发布时间 +
+ 学院新闻 + + 我院举办2019届毕业研究生就业工作推进座谈会 + + + 段晓辉 + + 2018-12-24 12:20:24 +
+ 学院新闻 + + 第八期Seminar学术研讨会成功举办 + + + 段晓辉 + + 2018-12-24 10:04:13 +
+ 学院新闻 + + 我院举办“初心共向”第二期专家圆桌座谈会 + + + 2007042 + + 2018-12-24 08:52:10 +
+ 学院新闻 + + 我院成功举办2018年“逐梦新时代,共启心征程”迎新晚会暨综合表彰大会 + + + 2007042 + + 2018-12-21 10:51:54 +
+ 学院新闻 + + 我院召开2018年党支部书记抓基层党建述职评议考核工作会议 + + + 2007042 + + 2018-12-20 18:15:39 +
+ 学院新闻 + + 我院组织师生收看庆祝改革开放40周年大会 + + + 段晓辉 + + 2018-12-18 16:17:54 +
+ 学院新闻 + + 泽如心理学创新实验班系列讲座(十二)圆满结束 + + + 杜娟 + + 2018-12-03 14:48:21 +
+ 学院新闻 + + 我院举办2019届本科毕业生考研动员与慰问大会 + + + 段晓辉 + + 2018-11-28 11:58:54 +
+ 学院新闻 + + 心理学院2016级泽如心理学创新实验班项目中期答辩圆满结束 + + + 杜娟 + + 2018-11-28 11:41:35 +
+ 学院新闻 + + 泽如心理学创新实验班系列讲座(十一)圆满结束 + + + 杜娟 + + 2018-11-28 11:34:07 +
+ 学院新闻 + + 我院召开2018年人才引进与师资补充考核会议 + + + 董增云 + + 2018-11-22 10:29:14 +
+ 学院新闻 + + 庆阳市第六期中小学心理健康教育教师培训班圆满结束 + + + 李奕伯 + + 2018-11-22 09:42:34 +
+ 学院新闻 + + 我院举办研究生党支部委员培训会 + + + 段晓辉 + + 2018-11-12 22:21:35 +
+ 学院新闻 + + 王振宏院长一行赴新疆昌吉学院走访慰问援疆干部 + + + 李奕伯 + + 2018-11-09 16:34:40 +
+ 学院新闻 + + 我院党校2018年下半年党课培训第五讲顺利举行 + + + 2007042 + + 2018-11-09 11:20:01 +
+ 学院新闻 + + 我院党校2018年下半年党课培训第四讲顺利举行 + + + 2007042 + + 2018-11-09 10:57:37 +
+ 学院新闻 + + 我院举办2019届本科毕业生考研就业动员大会 + + + 董增云 + + 2018-11-05 15:50:40 +
+ 学院新闻 + + 我院召开2015级本科生实习总结大会 + + + 段晓辉 + + 2018-11-02 18:22:42 +
+ 学院新闻 + + 我院组织教师和学生党员赴铜川照金红色教育基地参观学习 + + + 2007042 + + 2018-11-02 08:57:10 +
+ 学院新闻 + + 我院党校2018年下半年党课培训第三讲顺利举行 + + + 2007042 + + 2018-11-01 15:50:07 +
+ 学院新闻 + + 我院党校2018年下半年党课培训第二讲顺利举行 + + + 2007042 + + 2018-10-31 11:16:51 +
+ 学院新闻 + + 我院党校举行2018年下半年党课培训开班仪式暨党课培训第一讲 + + + 2007042 + + 2018-10-31 09:33:39 +
+ 学院新闻 + + 第十一届青年教师教学基本功大赛学院预赛圆满举行 + + + 杜娟 + + 2018-10-30 10:46:39 +
+ 学院新闻 + + 我院领导慰问2015级本科实习生 + + + 杜娟 + + 2018-10-30 09:51:27 +
+ 学院新闻 + + 我院第二届“别具匠心”英文影视作品配音比赛成功举办 + + + 2007042 + + 2018-10-29 11:43:52 +
+ 学院新闻 + + 我院成功举办“新时代 新起点 新梦想 新青年”主题演讲比赛 + + + 2007042 + + 2018-10-29 11:33:45 +
+ 学院新闻 + + “心”启航|新生入学教育:新阶段 心开始——新生心理健康教育专题讲座 + + + + + 2018-10-28 19:47:00 +
+ 学院新闻 + + “心”启航|新生入学教育:做好大学生职业生涯规划 + + + + + 2018-10-28 18:40:42 +
+ 学院新闻 + + “心”研途 新起航|坚定理想信念 加强组织管理 + + + 段晓辉 + + 2018-10-28 18:22:32 +
+ 学院新闻 + + 我院召开本科生班主任工作座谈会 + + + 2007042 + + 2018-10-28 17:38:33 +
+ 学院新闻 + + 我院举办毕业研究生就业工作座谈会 + + + 段晓辉 + + 2018-10-25 22:39:24 +
+ 学院新闻 + + 中国心理学会心理服务机构工作委员会成立大会暨第一次工作委员会会议在我校举行 + + + 李奕伯 + + 2018-10-25 10:26:13 +
+ 学院新闻 + + 甘肃省庆阳市第六期中小学心理健康教育教师培训班在我院开班 + + + 李奕伯 + + 2018-10-23 15:43:59 +
+ 学院新闻 + + “心”启航||新生入学教育:优秀毕业生经验交流会 + + + + + 2018-10-17 17:58:04 +
+ 学院新闻 + + 我院2018年研究生国家奖学金评审会顺利召开 + + + 段晓辉 + + 2018-10-16 21:01:20 +
+ 学院新闻 + + 中国心理学会工程心理学专业委员会2018年学术年会在我校召开 + + + 杜娟 + + 2018-10-16 18:00:35 +
+ 学院新闻 + + 我院举办2018年下半年学生工作会议暨学生组织换届大会 + + + 2007042 + + 2018-10-14 13:57:35 +
+ 学院新闻 + + 任晓伟教授为我院全体师生党员做专题报告 + + + 段晓辉 + + 2018-10-10 21:45:09 +
+ 学院新闻 + + “心”研途 新起航|“院长一课”之求实创新 学以致用 + + + 段晓辉 + + 2018-09-30 21:53:54 +
+ 学院新闻 + + 我院成功举办第三届“曲江学者论坛”心理学分论坛 + + + 李奕伯 + + 2018-09-29 15:20:45 +
+ 学院新闻 + + 我院召开2019届毕业研究生就业动员大会 + + + 段晓辉 + + 2018-09-27 10:25:38 +
+ 学院新闻 + + “心”启航|新生入学教育:“院长一课”——志存高远,砥砺前行 + + + 2007042 + + 2018-09-25 15:13:18 +
+ 学院新闻 + + “心”启航|新生入学教育:青春逐梦,导师领航——新生班主任、本科生导师见面会 + + + 2007042 + + 2018-09-25 10:24:26 +
+ 学院新闻 + + “心”启航|新生入学教育:“发现 成长”——我眼中的大学生活 + + + 2007042 + + 2018-09-25 10:22:29 +
+ 学院新闻 + + 我院心理学大讲堂第118期学术报告圆满举行 + + + admin + + 2018-09-25 08:20:44 +
+ 学院新闻 + + “心”研途 新起航|励志勤学 做最好的自己 + + + 段晓辉 + + 2018-09-19 23:41:31 +
+ 学院新闻 + + "心"研途 新起航|2018级研究生新生见面会 + + + 段晓辉 + + 2018-09-19 22:09:13 +
+ 学院新闻 + + 我院2018年研究生迎新工作圆满完成 + + + 段晓辉 + + 2018-09-16 14:18:53 +
+ 学院新闻 + + 我院隆重举行2018级新生开学典礼 + + + 李奕伯 + + 2018-09-16 11:38:14 +
+ 学院新闻 + + 我院召开新学期工作部署会 + + + 李奕伯 + + 2018-09-14 09:43:08 +
+ 学院新闻 + + 学院党总支中心组召开《中国共产党纪律处分条例》专题学习会议 + + + + + 2018-09-12 18:06:13 +
+ 学院新闻 + + 军训中慰问,传递“心”关怀——学院领导慰问2018级军训新生 + + + 2007042 + + 2018-09-02 10:40:43 +
+ 学院新闻 + + 迎新纪实(五):合力育人,学院召开2018级新生家长见面会 + + + + + 2018-08-24 17:57:50 +
+ 学院新闻 + + 迎新纪实(四):最美不过初相见,开展新生首次点名活动 + + + + + 2018-08-24 17:20:59 +
+ 学院新闻 + + 迎新纪实(三):以生为本,学院领导深入宿舍看望本科新生 + + + + + 2018-08-24 16:26:45 +
+ 学院新闻 + + 迎新纪实(二):如火如荼,井然有序开展各项迎新工作 + + + 2007042 + + 2018-08-24 16:19:09 +
+ 学院新闻 + + 迎新纪实(一):蓄势待发,积极做好各项迎新生准备工作 + + + 2007042 + + 2018-08-22 18:24:32 +
+ 学院新闻 + + 热烈欢迎2018级新同学 + + + 2007042 + + 2018-08-21 08:11:54 +
+ 学院新闻 + + 我院举办2018年暑假研究生留校学生工作会议 + + + 2007042 + + 2018-07-08 10:34:58 +
+ 学院新闻 + + 我院心理学大讲堂第117期学术报告圆满举行 + + + 李奕伯 + + 2018-07-05 10:40:34 +
+ 学院新闻 + + 我院心理学大讲堂第116期学术报告圆满举行 + + + 李奕伯 + + 2018-07-03 10:17:18 +
+ 学院新闻 + + 我院与西安高新一中举行“心理学院实习实践基地” 签约授牌仪式 + + + 董增云 + + 2018-07-02 16:51:18 +
+ 学院新闻 + + 我院心理学大讲堂第115期学术报告圆满举行 + + + 李奕伯 + + 2018-06-25 09:47:38 +
+ 学院新闻 + + 我院召开新进教师首聘期考核会议 + + + 成爱军 + + 2018-06-21 08:58:56 +
+ 学院新闻 + + 我院硕士研究生郑婷婷荣获国家公派出国留学攻读博士学位 + + + 雷萍 + + 2018-06-19 18:06:10 +
+ 学院新闻 + + 我院心理学大讲堂第114期学术报告圆满举行 + + + 李奕伯 + + 2018-06-15 08:27:29 +
+ 学院新闻 + + 我院心理学大讲堂第113期学术报告圆满举行 + + + 李奕伯 + + 2018-06-11 10:37:50 +
+ 学院新闻 + + 陕西师范大学党校2018年第3期发展党员集中培训班成功举办 + + + 仉天聪 + + 2018-06-07 09:29:26 +
+ 学院新闻 + + 我院心理学大讲堂第112期学术报告圆满举行 + + + 李奕伯 + + 2018-06-07 08:03:55 +
+ 学院新闻 + + 美国密歇根大学Kai Cortina教授一行来访我院 + + + 杜娟 + + 2018-05-30 15:24:23 +
+ 学院新闻 + + 我院学位授权点自评估专家评审会顺利召开 + + + 李奕伯 + + 2018-05-28 08:29:10 +
+ 学院新闻 + + 我院心理学大讲堂第111期学术报告圆满举行 + + + 李奕伯 + + 2018-05-25 15:23:40 +
+ 学院新闻 + + 我院举行学生工作推进会暨学生会、心理学社成立大会 + + + 仉天聪 + + 2018-05-21 16:29:25 +
+ 学院新闻 + + 我院心理学大讲堂第110期学术报告圆满举行 + + + 李奕伯 + + 2018-05-21 09:55:18 +
+ 学院新闻 + + 我院心理学大讲堂第109期学术报告圆满举行 + + + 李奕伯 + + 2018-05-21 08:09:46 +
+ 学院新闻 + + 我院兰继军教授承担的2018-2019年度西安地铁运营分公司员工帮助计划项目顺... + + + 成爱军 + + 2018-05-15 16:29:17 +
+ 学院新闻 + + 心理学院召开党代表选举大会 + + + 仉天聪 + + 2018-05-14 17:37:19 +
+ 学院新闻 + + 我院心理学大讲堂第107期学术报告圆满举行 + + + 成爱军 + + 2018-05-14 11:15:10 +
+ 学院新闻 + + 我院心理学大讲堂第108期学术报告暨交流座谈会圆满举行 + + + admin + + 2018-05-12 23:10:53 +
+ 学院新闻 + + 我院心理学大讲堂第106期学术报告圆满举行 + + + admin + + 2018-05-12 14:42:53 +
+ 学院新闻 + + 我院心理学大讲堂第105期学术报告圆满举行 + + + admin + + 2018-05-11 08:45:52 +
+ 学院新闻 + + 我院王振宏教授参加中国心理学会人格心理学专业委员会2018年学术年会并做大会报告 + + + 成爱军 + + 2018-05-08 17:28:01 +
+ 学院新闻 + + 我院举办第二届“我与我的青春故事”优秀学子成长经验报告会 + + + 仉天聪 + + 2018-05-08 12:03:24 +
+ 学院新闻 + + 甘肃省庆阳市第五期中小学心理健康教育教师培训班圆满结束 + + + 李奕伯 + + 2018-05-07 11:10:24 +
+ 学院新闻 + + 我院举办高新国际学校专场招聘会 + + + + + 2018-05-02 10:20:49 +
+ 学院新闻 + + 我院举办铁一中专场招聘会 + + + 董增云 + + 2018-05-02 10:05:53 +
+ 学院新闻 + + 英国南安普顿大学Constantine Sedikides教授《人格与社会心理... + + + 成爱军 + + 2018-05-02 08:23:56 +
+ 学院新闻 + + 阳光拥抱青春梦想 拼搏助跑理想飞扬 + + + 仉天聪 + + 2018-04-28 18:16:25 +
+ 学院新闻 + + 教育部本科教学审核评估专家梁福成教授莅临我院走访座谈 + + + 成爱军 + + 2018-04-18 15:33:27 +
+ 学院新闻 + + 教育部本科教学审核评估专家董奇教授莅临我院走访考察 + + + 成爱军 + + 2018-04-18 14:32:50 +
+ 学院新闻 + + 我院举办校运会运动员慰问会 + + + 仉天聪 + + 2018-04-17 11:47:39 +
+ 学院新闻 + + 我院举行领导班子党风廉政建设责任书签署仪式 + + + 仉天聪 + + 2018-04-12 10:53:42 +
+ 学院新闻 + + 甘肃省庆阳市第五期中小学教师培训班在我校开班 + + + 李奕伯 + + 2018-04-11 11:02:33 +
+ 学院新闻 + + 我院师生赴美国密歇根大学访问活动圆满完成 + + + 成爱军 + + 2018-04-09 14:53:49 +
+ 学院新闻 + + 我院心理学大讲堂第104期学术报告圆满举行 + + + 成爱军 + + 2018-04-09 06:49:09 +
+ 学院新闻 + + 我院召开师资补充答辩报告会议 + + + 成爱军 + + 2018-03-22 11:27:12 +
+ 学院新闻 + + 我院举行教师岗位聘用合同书签订仪式 + + + 成爱军 + + 2018-03-22 11:26:09 +
+ 学院新闻 + + 我院心理学大讲堂第103期学术报告圆满举行 + + + 成爱军 + + 2018-03-20 15:54:20 +
+ 学院新闻 + + 我院开展2018届毕业生考研复试调剂、就业工作座谈会 + + + 董增云 + + 2018-03-20 11:19:17 +
+ 学院新闻 + + 我院召开2018年工作部署暨学科建设会议 + + + 李奕伯 + + 2018-03-14 18:25:11 +
+ 学院新闻 + + 研究生院一行到心理学院开展研究生教育管理座谈会 + + + 雷萍 + + 2018-03-09 15:37:15 +
+ 学院新闻 + + 我院组织师生收看学习十三届全国人大一次会议开幕会 + + + 仉天聪 + + 2018-03-05 18:50:08 +
+ 学院新闻 + + 我院寒假送温暖筑心桥 ——学工干部走... + + + 仉天聪 + + 2018-02-05 21:34:49 +
+ 学院新闻 + + 高新一中师生一行来我院参观学习 + + + 杜娟 + + 2018-01-31 10:19:31 +
+ 学院新闻 + + 我院召开2017年度教职工代表会议 + + + 成爱军 + + 2018-01-29 17:50:40 +
+ 学院新闻 + + 我院心理学大讲堂第102期学术报告圆满举行 + + + 成爱军 + + 2018-01-29 09:39:10 +
+ 学院新闻 + + 心理学院领导班子召开2017年度民主生活会 + + + + + 2018-01-26 10:26:43 +
+ 学院新闻 + + 我院基础心理学教职工党支部召开专题组织生活会与民主评议党员会议 + + + 李奕伯 + + 2018-01-24 10:32:34 +
+ 学院新闻 + + 我院举办2018年寒假留宿学生工作会议 + + + 仉天聪 + + 2018-01-23 23:16:15 +
+ 学院新闻 + + 我院行政党支部召开专题组织生活会与民主评议党员会议 + + + 仉天聪 + + 2018-01-18 16:34:18 +
+ 学院新闻 + + 心理学院举办党支部书记工作会议 + + + 仉天聪 + + 2018-01-15 17:26:32 +
+ 学院新闻 + + 我院召开2017-2018学年度第一学期期末考试暨本科教学审核评估工作动员会 + + + 杜娟 + + 2018-01-15 10:40:23 +
+ 学院新闻 + + 心理学院举行本科生期末考试动员会议 + + + 仉天聪 + + 2018-01-12 11:15:40 +
+ 学院新闻 + + 财务处处长刘继波一行来我院调研财务工作 + + + 李奕伯 + + 2018-01-05 11:29:06 +
+ 学院新闻 + + 我院第100期心理学大讲堂圆满结束 + + + 成老师 + + 2017-12-25 11:24:26 +
+ 学院新闻 + + 我院第101期心理学大讲堂圆满结束 + + + 成爱军 + + 2017-12-25 09:04:52 +
+ 学院新闻 + + 我院吕薇副教授在国际情绪、生理心理学顶级SSCI/SCI期刊发表系列高水平论文 + + + 成老师 + + 2017-12-22 17:27:29 +
+ 学院新闻 + + 泽如心理学创新实验班系列讲座(十)圆满结束 + + + 杜老师 + + 2017-12-22 11:55:49 +
+ 学院新闻 + + 我院与美国堪萨斯大学教育学院举行了合作交流研讨会议 + + + 成老师 + + 2017-12-21 11:35:44 +
+ 学院新闻 + + 心理学院青年师生学术沙龙第三十期顺利举办 + + + 雷老师 + + 2017-12-20 10:14:14 +
+ 学院新闻 + + 心理学院2017年迎新晚会隆重举行 + + + admin + + 2017-12-08 17:13:21 +
+ 学院新闻 + + 甘肃省庆阳市第四期中小学心理健康教育教师培训班圆满结束 + + + 成老师 + + 2017-12-08 15:45:23 +
+ 学院新闻 + + 泽如心理学创新实验班系列讲座(九)圆满结束 + + + 杜老师 + + 2017-12-07 11:57:34 +
+ 学院新闻 + + 心理学院青年师生学术沙龙第二十九期顺利举办 + + + 雷老师 + + 2017-12-05 16:07:33 +
+ 学院新闻 + + 心理学院青年师生学术沙龙第二十八期顺利举办 + + + 雷老师 + + 2017-11-27 15:04:05 +
+ 学院新闻 + + 我院在学校2017年“两学一做”支部风采展示活动中取得佳绩 + + + 2007042 + + 2017-11-27 11:33:55 +
+ 学院新闻 + + 心理学院举办学习党的十九大精神辅导报告会 + + + 2007042 + + 2017-11-23 20:24:18 +
+ 学院新闻 + + 我院李录志书记一行赴新疆昌吉学院看望援疆干部并签订合作协议 + + + 成老师 + + 2017-11-23 11:06:39 +
+ 学院新闻 + + 心理学院青年师生学术沙龙第二十七期顺利举办 + + + 雷老师 + + 2017-11-21 15:41:14 +
+ 学院新闻 + + 我院王勇慧教授团队成员李雅博士在Cerebral Cortex上发表研究成果 + + + 成老师 + + 2017-11-20 08:32:39 +
+ 学院新闻 + + “曲江学者论坛”之第99期心理学大讲堂学术讲座圆满结束 + + + 成老师 + + 2017-11-17 16:11:26 +
+ 学院新闻 + + 我院召开全院党支部书记工作会议 + + + 2007042 + + 2017-11-14 18:30:08 +
+ 学院新闻 + + 中国心理学会社区心理专业委员会第三届学术年会在我校召开 + + + 成老师 + + 2017-11-12 14:39:08 +
+ 学院新闻 + + 甘肃省庆阳市第四期中小学心理健康教育教师培训班在我院开班 + + + 杜老师 + + 2017-11-10 16:04:28 +
+ 学院新闻 + + 心理学院召开2014级本科生实习总结大会 + + + 2007042 + + 2017-11-09 15:49:53 +
+ 学院新闻 + + 心理学院2018届本科毕业生考研就业动员大会 + + + admin + + 2017-11-09 15:37:24 +
+ 学院新闻 + + 我院第98期心理学大讲堂圆满结束 + + + 成老师 + + 2017-11-09 10:34:32 +
+ 学院新闻 + + 英国斯旺西大学国际合作官员James Kerr来我院调研与座谈 + + + 成老师 + + 2017-11-08 09:33:59 +
+ 学院新闻 + + 乌兹别克斯坦国立大学国际交流处处长马萨姆.哈基莫夫来我院调研 + + + 成老师 + + 2017-11-03 17:13:18 +
+ 学院新闻 + + 俄罗斯精神病学和麻醉学联邦医学研究中心所长与我院师生座谈 + + + 成老师 + + 2017-11-03 16:04:17 +
+ 学院新闻 + + 我院第97期心理学大讲堂圆满结束 + + + admin + + 2017-11-01 16:23:27 +
+ 学院新闻 + + 第十届青年教师教学基本功大赛学院预赛圆满举行 + + + 杜老师 + + 2017-11-01 09:43:23 +
+ 学院新闻 + + 我院党校举行2017年下半年党课培训开班仪式暨党课培训第一讲 + + + 2007042 + + 2017-10-31 18:33:25 +
+ 学院新闻 + + 心理学院青年师生学术沙龙第二十六期顺利举办 + + + 雷老师 + + 2017-10-31 18:07:08 +
+ 学院新闻 + + 我院召开2017年职称评审工作安排会议 + + + 2010074 + + 2017-10-27 15:04:00 +
+ 学院新闻 + + 我院领导慰问2014级本科实习生 + + + 杜老师 + + 2017-10-24 11:02:06 +
+ 学院新闻 + + 我院举办毕业生就业面试指导与职场礼仪培训讲座 + + + 2007042 + + 2017-10-20 15:35:41 +
+ 学院新闻 + + 我院组织党员观看党的十九大开幕会 + + + admin + + 2017-10-18 22:03:57 +
+ 学院新闻 + + 我院“喜迎十九大 青春铸辉煌”演讲比赛圆满结束 + + + 2007042 + + 2017-10-18 20:29:13 +
+ 学院新闻 + + 用激情唱响党的赞歌——我院研究生在校合唱比赛中荣获三等奖 + + + 2007042 + + 2017-10-18 20:16:34 +
+ 学院新闻 + + 我院航空航天心理学与人因工程研究团队参加第二届中国人因工程高峰论坛 + + + 成老师 + + 2017-10-18 17:43:01 +
+ 学院新闻 + + 我院召开2017年下半年学生工作会议 + + + 2007042 + + 2017-10-13 11:22:22 +
+ 学院新闻 + + 我院召开2017年人才引进与师资补充考核会议 + + + 成老师 + + 2017-10-12 15:17:17 +
+ 学院新闻 + + 心理学院举办杨文汇同学入伍欢送会并组织学生观看新闻联播征兵入伍相关节目 + + + + + 2017-09-26 20:54:09 +
+ 学院新闻 + + 我院青年师生学术沙龙第二十五期圆满举办 + + + 雷老师 + + 2017-09-26 15:52:48 +
+ 学院新闻 + + 我院召开2018届硕士毕业生就业动员大会 + + + 2007042 + + 2017-09-22 18:41:47 +
+ 学院新闻 + + 我院举行2017级学术型硕士研究生政策解读与日常管理教育报告会 + + + 2007042 + + 2017-09-22 18:26:44 +
+ 学院新闻 + + 我院青年师生学术沙龙第二十四期圆满举办 + + + 雷老师 + + 2017-09-19 10:52:20 +
+ 学院新闻 + + 我院开展新学期班干部工作安排会议 + + + 2007042 + + 2017-09-17 15:39:53 +
+ 学院新闻 + + 规范组织生活,争做合格党员——我院开展2017级新生党员入学教育活动 + + + 2007042 + + 2017-09-15 10:24:25 +
+ 学院新闻 + + 我院召开2017年新学期工作部署会议 + + + 成老师 + + 2017-09-13 09:01:53 +
+ 学院新闻 + + 我院隆重举行2018级新生开学典礼 + + + 李奕伯 + + 2017-09-11 16:17:45 +
+ 学院新闻 + + 我院第96期心理学大讲堂圆满结束 + + + 成老师 + + 2017-09-06 08:37:51 +
+ 学院新闻 + + 慰问军训新生 传递真情关怀 + + + 2007042 + + 2017-09-05 18:36:22 +
+ 学院新闻 + + 迎新纪实(十一):新生入学教育之“爱国如家,励志兴邦”爱国主义教育讲座 + + + 2007042 + + 2017-09-05 16:03:39 +
+ 学院新闻 + + 我院第95期心理学大讲堂圆满结束 + + + 成老师 + + 2017-09-05 11:20:36 +
+ 学院新闻 + + 迎新纪实(十):新生入学教育之“遵纪守法,严于律己”新生校纪校规专题讲座 + + + 2007042 + + 2017-09-02 16:02:28 +
+ 学院新闻 + + 迎新纪实(九):新生入学教育之“律己修身,自立自强”新生日常管理教育讲座 + + + 2007042 + + 2017-09-02 15:55:23 +
+ 学院新闻 + + 迎新纪实(八):新生入学教育之“厚德积学,朴实力行”本科生培养讲座 + + + 2007042 + + 2017-08-29 12:42:19 +
+ 学院新闻 + + 迎新纪实(七):新生入学教育之“刚好遇见,一路有爱”新生适应性团体辅导 + + + admin + + 2017-08-28 10:47:25 +
+ 学院新闻 + + 迎新纪实(六):新生入学教育之“提早规划,励志成才”大学生职业生涯规划指导讲座 + + + 2007042 + + 2017-08-27 11:36:20 +
+ 学院新闻 + + 迎新纪实(五):家校合力,育人共当——我院举行2017级新生家长座谈会 + + + 2007042 + + 2017-08-26 14:50:45 +
+ 学院新闻 + + 迎新纪实(四):迎“新”+用“心”,志愿服务润物无声 + + + 2007042 + + 2017-08-25 13:45:57 +
+ 学院新闻 + + 迎新纪实(三):“第一时间”的关爱 ——学院领导深入宿舍看望慰问2017级新生 + + + 2007042 + + 2017-08-25 11:38:51 +
+ 学院新闻 + + 迎新纪实(二):全方位、多举措做好迎新准备 + + + 2007042 + + 2017-08-23 15:28:50 +
+ 学院新闻 + + 迎新纪实(一):启动“宿舍学长制”,守护新生成长,引领梦想起航 + + + 2007042 + + 2017-08-22 12:23:15 +
+ 学院新闻 + + 心理学院2017年暑期社会实践活动稳步推进 + + + 2007042 + + 2017-07-15 11:12:51 +
+ 学院新闻 + + 我院2017年本科生国际暑期学校开课 + + + 杜老师 + + 2017-07-14 18:37:03 +
+ 学院新闻 + + 华南师范大学心理学院院长张卫一行来我院调研 + + + 成老师 + + 2017-07-12 08:36:44 +
+ 学院新闻 + + 我院与铜川市王益区教育科技体育局签署教育战略合作协议 + + + 成老师 + + 2017-07-10 08:37:22 +
+ 学院新闻 + + 心理学院与北京双高国际人力资本集团举行“心理学专业实习实践基地”签约授牌仪式 + + + admin + + 2017-06-29 12:03:32 +
+ 学院新闻 + + 我院第94期心理学大讲堂圆满结束 + + + 成老师 + + 2017-06-28 17:07:15 +
+ 学院新闻 + + 我院召开2016-2017学年度第二学期期末考试工作会议 + + + 杜老师 + + 2017-06-23 12:15:00 +
+ 学院新闻 + + 我院首届航空航天心理学专业硕士论文答辩工作圆满结束 + + + 雷老师 + + 2017-06-09 17:55:29 +
+ 学院新闻 + + 我院2017年上半年博士论文答辩顺利举行 + + + 雷老师 + + 2017-05-27 17:52:22 +
+ 学院新闻 + + 心理学院“陕Star暖心阁”线上心理咨询平台上线了 + + + 2007042 + + 2017-05-25 16:34:07 +
+ 学院新闻 + + 密歇根大学师生来访学院并进行学术交流 + + + 杜老师 + + 2017-05-25 11:53:59 +
+ 学院新闻 + + 泽如实验班与密歇根大学师生项目报告交流会暨第八次系列讲座圆满结束 + + + 2007042 + + 2017-05-19 18:13:37 +
+ 学院新闻 + + 我院第93期心理学大讲堂圆满结束 + + + 成老师 + + 2017-05-18 11:27:32 +
+ 学院新闻 + + 我院召开关键三级及其以下教师岗位人员聘用工作部署会议 + + + 成老师 + + 2017-05-18 10:23:49 +
+ 学院新闻 + + 我院召开财务报销系统推介会议 + + + 成老师 + + 2017-05-18 10:20:17 +
+ 学院新闻 + + 陕西省教育厅网站:我院多举措助力新生入学教育成效好 + + + 2007042 + + 2017-05-17 17:07:44 +
+ 学院新闻 + + 我院召开2017年师资补充考核会议 + + + 成老师 + + 2017-05-16 17:13:54 +
+ 学院新闻 + + 第四届中国精神遗传学峰会在我校举行 + + + admin + + 2017-05-15 13:22:20 +
+ 学院新闻 + + 我院召开2018届毕业生实习动员会 + + + 2007042 + + 2017-05-12 17:38:34 +
+ 学院新闻 + + “大学第一年”:我院多管齐下扎实做好新生入学教育 + + + admin + + 2017-05-10 16:12:05 +
+ 学院新闻 + + 我院第92期心理学大讲堂圆满结束 + + + 成老师 + + 2017-05-10 09:52:07 +
+ 学院新闻 + + 泽如心理学创新实验班系列讲座(六)(七)圆满结束 + + + 杜老师 + + 2017-05-09 16:48:40 +
+ 学院新闻 + + 甘肃省庆阳市第三期中小学心理健康教育教师培训班圆满结束 + + + 成老师 + + 2017-05-07 10:59:09 +
+ 学院新闻 + + 我院学子在第二十届“外研社杯”全国英语辩论华西赛区喜夺冠 + + + 2007042 + + 2017-05-04 09:26:39 +
+ 学院新闻 + + 我院举办“我与我的青春故事”优秀学子成长经验报告会 + + + admin + + 2017-05-02 16:58:57 +
+ 学院新闻 + + 心理学院2015级泽如创新实验班参观第四军医大学实验室 + + + 杜老师 + + 2017-04-28 09:28:26 +
+ 学院新闻 + + 心理学院多措并举有效推进毕业生就业工作 + + + admin + + 2017-04-25 11:36:12 +
+ 学院新闻 + + “院长一课”之“如何查阅文献与撰写研究论文” + + + 2007042 + + 2017-04-24 09:32:46 +
+ 学院新闻 + + 我院师生赴美国密歇根大学访问活动顺利举行 + + + 成老师 + + 2017-04-10 14:37:19 +
+ 学院新闻 + + 甘肃省庆阳市第三期中小学心理健康教育教师培训班在我院开班 + + + 成老师 + + 2017-04-08 22:22:21 +
+ 学院新闻 + + 我院实习实践基地、儿童发展研究基地揭牌仪式在铭城小学举行 + + + 杜老师 + + 2017-04-05 10:22:28 +
+ 学院新闻 + + 我院承办学校第二十届“外研社杯”全国大学生英语辩论赛校园选拔赛活动 + + + 2007042 + + 2017-03-31 08:44:09 +
+ 学院新闻 + + 心理学院召开全体党支部委员会议 + + + 2007042 + + 2017-03-26 14:32:44 +
+ 学院新闻 + + 【学风建设】知之 好之 乐之——记心理学院举办“我与我的科研梦”系列科研指导活动 + + + 2007042 + + 2017-03-20 09:18:15 +
+ 学院新闻 + + 我院举办2017年国家大学生创新创业训练计划项目申报报告会 + + + admin + + 2017-03-17 09:08:17 +
+ 学院新闻 + + 我院召开2017年学生工作会议 + + + admin + + 2017-03-16 17:33:14 +
+ 学院新闻 + + 我院第91期心理学大讲堂圆满结束 + + + admin + + 2017-03-13 08:29:51 +
+ 学院新闻 + + 我院召开2017年新学期工作部署会议 + + + 成老师 + + 2017-03-02 10:06:29 +
+ 学院新闻 + + 杨祖培副校长一行莅临我院检查指导工作 + + + 成老师 + + 2017-02-20 16:03:04 +
+ 学院新闻 + + 我院开展教学秩序检查工作 + + + 成老师 + + 2017-02-20 16:00:26 +
+ 学院新闻 + + 我院召开2016年度教职工代表大会 + + + 成老师 + + 2017-01-22 20:15:23 +
+ 学院新闻 + + 心理学院领导班子召开2016年度民主生活会 + + + 成老师 + + 2017-01-12 10:19:33 +
+ 学院新闻 + + 教务处一行来我院进行调研座谈 + + + 杜老师 + + 2017-01-12 09:43:50 +
+ 学院新闻 + + 我院召开2016-2017学年度第一学期期末考试工作会议 + + + admin + + 2017-01-10 10:17:01 +
+ 学院新闻 + + 我院青年师生学术沙龙第二十三期圆满举行 + + + admin + + 2017-01-05 08:30:41 +
+ 学院新闻 + + 我院第90期心理学大讲堂圆满结束 + + + 成老师 + + 2016-12-30 10:11:28 +
+ 学院新闻 + + 我院召开2017届本科毕业生就业座谈会 + + + admin + + 2016-12-30 08:31:44 +
+ 学院新闻 + + 我院举办天成元心理集团招聘宣讲会 + + + admin + + 2016-12-29 14:53:59 +
+ 学院新闻 + + 心理学院举办2016级专业学习辅导讲座 + + + admin + + 2016-12-22 16:24:46 +
+ 学院新闻 + + 心理学院与西安高新逸翠园学校举行“心理学专业实习实践基地”签约授牌仪式 + + + 杜老师 + + 2016-12-21 09:17:00 +
+ 学院新闻 + + 我院青年师生学术沙龙第二十二期圆满举行 + + + 雷老师 + + 2016-12-20 09:11:11 +
+ 学院新闻 + + 我院第89期心理学大讲堂圆满结束 + + + 成老师 + + 2016-12-13 08:16:15 +
+ 学院新闻 + + 我院青年师生学术沙龙第二十一期圆满举行 + + + admin + + 2016-12-12 16:10:48 +
+ 学院新闻 + + 我院青年师生学术沙龙第二十期圆满举行 + + + admin + + 2016-12-05 17:36:23 +
+ 学院新闻 + + 甘肃省庆阳市第二期中小学心理健康教育教师培训班圆满结束 + + + admin + + 2016-12-02 17:15:10 +
+ 学院新闻 + + 我院泽如心理学创新实验班系列讲座(三)圆满结束 + + + admin + + 2016-12-02 15:39:19 +
+ 学院新闻 + + 泽如心理学创新实验班创新创业项目培育答辩会圆满结束 + + + admin + + 2016-12-01 17:06:22 +
+ 学院新闻 + + “构建庆阳市中小学心理健康教育体系”项目组赴庆阳市调研 + + + admin + + 2016-11-28 08:45:07 +
+ 学院新闻 + + 我院青年师生学术沙龙第十九期圆满举行 + + + admin + + 2016-11-21 15:24:53 +
+ 学院新闻 + + 我院青年师生学术沙龙第十八期圆满举行 + + + admin + + 2016-11-14 17:09:44 +
+ 学院新闻 + + 王振宏同志为心理学院发展与应用心理学教职工和博士生党支部讲授“两学一做”专题党课 + + + 赵老师 + + 2016-11-14 09:56:57 +
+ 学院新闻 + + 我院2017年研究生招生宣传工作圆满结束 + + + 成老师 + + 2016-11-08 16:24:11 +
+ 学院新闻 + + 第九届青年教师教学基本功大赛学院预赛圆满举行 + + + 杜老师 + + 2016-11-08 15:52:22 +
+ 学院新闻 + + 我院青年师生学术沙龙第十七期如期举行 + + + 雷老师 + + 2016-11-08 09:24:17 +
+ 学院新闻 + + 高子伟副校长参加心理学院2015级研究生第一党支部学习研讨 + + + 赵老师 + + 2016-11-07 15:59:39 +
+ 学院新闻 + + 心理学院举办第八期党校开学典礼 + + + admin + + 2016-11-03 15:31:03 +
+ 学院新闻 + + 基础心理学职工党支部举办“两学一做”第三专题学习讨论会 + + + 赵老师 + + 2016-11-03 13:14:50 +
+ 学院新闻 + + 甘肃省庆阳市第二期中小学心理健康教育教师培训班在我院开班 + + + 成老师 + + 2016-11-03 11:16:17 +
+ 学院新闻 + + 学校“两学一做”学习教育督导组莅临我院督导检查 + + + 赵老师 + + 2016-11-02 18:13:21 +
+ 学院新闻 + + 科技处陈新兵副处长莅临我院进行国家自然科学基金项目申报座谈 + + + 雷老师 + + 2016-11-02 10:53:36 +
+ 学院新闻 + + 心理学院首届球类运动会圆满结束 + + + 赵老师 + + 2016-11-01 14:08:27 +
+ 学院新闻 + + 我院召开2016年专业技术职务任职资格评审工作会议 + + + 成老师 + + 2016-10-28 16:15:12 +
+ 学院新闻 + + 心理学院召开2017届毕业生就业动员大会 + + + admin + + 2016-10-28 15:53:12 +
+ 学院新闻 + + 我院2016级研究生第一党支部观看《榜样》直播 + + + 赵老师 + + 2016-10-27 11:22:41 +
+ 学院新闻 + + 我院第88期心理学大讲堂圆满结束 + + + 成老师 + + 2016-10-27 10:45:19 +
+ 学院新闻 + + 我院泽如心理学创新实验班系列讲座(一)、(二)圆满结束 + + + 杜老师 + + 2016-10-25 15:06:28 +
+ 学院新闻 + + 心理学院党总支召开“两学一做”学习教育推进会 + + + 赵老师 + + 2016-10-24 10:00:37 +
+ 学院新闻 + + 我院第87期心理学大讲堂圆满结束 + + + 成老师 + + 2016-10-20 17:02:44 +
+ 学院新闻 + + 机关党委来我院调研 + + + 赵老师 + + 2016-10-19 09:47:48 +
+ 学院新闻 + + 我院领导看望并慰问实习学生 + + + 赵老师 + + 2016-10-12 15:56:47 +
+ 学院新闻 + + 我院第86期心理学大讲堂圆满结束 + + + 成老师 + + 2016-10-10 16:11:11 +
+ 学院新闻 + + 心理学院党总支举办“两学一做”第三专题讨论 + + + 赵老师 + + 2016-09-29 14:38:00 +
+ 学院新闻 + + 我院举行学生工作座谈会 + + + 赵老师 + + 2016-09-29 10:35:16 +
+ 学院新闻 + + 我院党总支举办学习总书记“七一”重要讲话中心组学习 + + + 赵老师 + + 2016-09-27 15:58:41 +
+ 学院新闻 + + 高子伟副校长莅临我院进行研究生招生工作调研 + + + 成老师 + + 2016-09-23 16:01:57 +
+ 学院新闻 + + 心理学院2015级泽如创新实验班开班典礼顺利举行 + + + admin + + 2016-09-22 11:21:49 +
+ 学院新闻 + + 我院召开新学期工作部署暨学术委员会选举会议 + + + 成老师 + + 2016-09-10 16:49:04 +
+ 学院新闻 + + 我院召开第十九届全国心理学学术大会筹备工作推进会议 + + + 成老师 + + 2016-09-05 08:46:50 +
+ 学院新闻 + + 我院获批6项国家自然科学基金项目与2项教育部人文社科项目 + + + 成老师 + + 2016-09-01 23:43:54 +
+ 学院新闻 + + 我院游旭群教授入选哲学社会科学领军人才 + + + admin + + 2016-09-01 23:21:29 +
+ 学院新闻 + + 我院隆重举行2016级新生开学典礼 + + + admin + + 2016-09-01 10:51:36 +
+ 学院新闻 + + 我院举行新生入学教育活动之三——心理学本科专业介绍 + + + 赵老师 + + 2016-08-26 09:39:39 +
+ 学院新闻 + + 我院举行新生入学教育活动之二——大学生职业生涯规划 + + + 赵老师 + + 2016-08-26 09:38:43 +
+ 学院新闻 + + 我院领导慰问军训师生 + + + 赵老师 + + 2016-08-21 17:11:31 +
+ 学院新闻 + + 我院举行新生入学教育系列活动之一—奋进中的陕西师范大学心理学院 + + + 赵老师 + + 2016-08-21 16:57:45 +
+ 学院新闻 + + 我院代表团精彩亮相第31届国际心理学大会 + + + 成老师 + + 2016-08-18 17:58:19 +
+ 学院新闻 + + 我院召开2016级新生家长座谈会 + + + 赵老师 + + 2016-08-18 11:57:48 +
+ 学院新闻 + + 北京市朝阳区校长后备干部高级研修项目培训班在我院举行 + + + admin + + 2016-07-21 09:34:18 +
+ 学院新闻 + + 我院2016年暑期学校课程教学圆满结束 + + + 杜老师 + + 2016-07-20 18:13:57 +
+ 学院新闻 + + 中科院心理研究所所长、中国心理学会秘书长傅小兰研究员一行来我院考察指导全国心理... + + + 成老师 + + 2016-07-17 08:06:49 +
+ 学院新闻 + + 我院召开学生管理工作推进会议 + + + 成老师 + + 2016-07-07 17:30:06 +
+ 学院新闻 + + 我院第85期心理学大讲堂圆满结束 + + + 成老师 + + 2016-07-05 11:50:42 +
+ 学院新闻 + + 我院第84期心理学大讲堂圆满结束 + + + 成老师 + + 2016-07-01 11:36:36 +
+ 学院新闻 + + 我院本科生何景怡获美国名校全奖博士录取 + + + 赵老师 + + 2016-06-30 10:42:54 +
+ 学院新闻 + + 我院召开2015-2016学年第二学期期末考试工作会议 + + + 杜老师 + + 2016-06-27 16:17:24 +
+ 学院新闻 + + 甘肃省庆阳市心理健康教育教师培训班圆满结束 + + + 成老师 + + 2016-06-23 16:28:45 +
+ 学院新闻 + + “‘丝绸之路经济带’建设背景下西部教育改革与创新”研讨会在我校圆满召开 + + + 成爱军 + + 2016-06-22 17:05:05 +
+ 学院新闻 + + “癌症患者心理护理需求及其变化模式”联合科研启动会在陕西省肿瘤医院举行 + + + 董老师 + + 2016-06-14 09:35:20 +
+ 学院新闻 + + 守纪律,讲规矩做合格的共产党员——我院举办两学一做专题党课 + + + 赵老师 + + 2016-06-14 08:56:26 +
+ 学院新闻 + + 我院学生参加第十九届“外研社杯”大学生英语辩论赛全国总决赛取得优异成绩 + + + 赵老师 + + 2016-06-07 09:23:04 +
+ 学院新闻 + + 我院发展与应用心理学、基础心理学教工党支部开展“两学一做”专题学习 + + + 赵老师 + + 2016-05-30 17:23:16 +
+ 学院新闻 + + 我院开展“两学一做”学习教育专题报告 + + + 赵老师 + + 2016-05-30 10:49:29 +
+ 学院新闻 + + 我院2015级研究生党支部开展“两学一做”第二专题学习 + + + 赵老师 + + 2016-05-27 09:16:55 +
+ 学院新闻 + + 甘肃省庆阳市心理健康教育教师培训班在我院开班 + + + 成老师 + + 2016-05-26 15:30:42 +
+ 学院新闻 + + 我院成功举办“学校情境中儿童心理发展跨文化研究”学术研讨会 + + + 杜老师 + + 2016-05-26 09:51:54 +
+ 学院新闻 + + 陕西省行为与认知神经科学重点实验室开展心理科普活动 + + + 成老师 + + 2016-05-25 14:59:38 +
+ 学院新闻 + + 我院党总支中心组开展“两学一做”专题学习 + + + 赵老师 + + 2016-05-24 17:11:26 +
+ 学院新闻 + + 我院第83期心理学大讲堂圆满结束 + + + 成老师 + + 2016-05-19 08:27:20 +
+ 学院新闻 + + 我院行政教职工党支部召开“两学一做”第一专题学习讨论会 + + + 赵老师 + + 2016-05-17 16:09:06 +
+ 学院新闻 + + 心理学博士后科研流动站4名博士后获得博士后科学基金第59批面上资助项目 + + + 成老师 + + 2016-05-14 16:49:35 +
+ 学院新闻 + + 我院第82期心理学大讲堂圆满结束 + + + 成老师 + + 2016-05-10 22:54:16 +
+ 学院新闻 + + 我院王勇慧教授一行参加第五届国际心理学应用及趋势会议 + + + 成老师 + + 2016-05-10 08:55:10 +
+ 学院新闻 + + 我院召开“两学一做”学习教育动员大会 + + + 赵老师 + + 2016-05-06 10:28:04 +
+ 学院新闻 + + 我院召开参加全全国第四轮学科评估工作部署会议 + + + 成老师 + + 2016-05-05 08:56:42 +
+ 学院新闻 + + 我院成功实现与国际知名大学远程同步课堂教学 + + + 杜老师 + + 2016-05-03 11:07:22 +
+ 学院新闻 + + 我院一门教师教育国家级精品资源共享课已上线“爱课程网” + + + 成老师 + + 2016-04-20 18:16:10 +
+ 学院新闻 + + 我院教职工积极参加2016年校运动会 + + + 成老师 + + 2016-04-20 17:28:55 +
+ 学院新闻 + + 我院第81期心理学大讲堂圆满结束 + + + 成老师 + + 2016-04-15 15:17:01 +
+ 学院新闻 + + 我院召开2016年第二次人才引进与师资补充考核会议 + + + 成老师 + + 2016-04-14 15:14:09 +
+ 学院新闻 + + 心理学院党总支召开换届选举大会选举产生新一届党总支委员 + + + 赵老师 + + 2016-03-24 16:03:44 +
+ 学院新闻 + + 我院召开师资补充答辩报告会议 + + + 成老师 + + 2016-03-11 11:37:05 +
+ 学院新闻 + + 我院召开优秀青年科学基金申报答辩会议 + + + 成老师 + + 2016-03-08 17:24:24 +
+ 学院新闻 + + 中国科学院心理研究所蒋毅研究员做客我院第80期心理学大讲堂 + + + admin + + 2016-03-08 16:21:37 +
+ 学院新闻 + + 党委组织部来我院调研基层党建工作 + + + 赵老师 + + 2016-03-07 15:23:37 +
+ 学院新闻 + + 教务处李贵安处长一行来我院走访调研 + + + 成老师 + + 2016-03-03 16:01:57 +
+ 学院新闻 + + 我院召开2016年工作部署会议 + + + 成老师 + + 2016-03-03 10:50:29 +
+ 学院新闻 + + 我校党委书记甘晖一行莅临我院检查指导工作 + + + 成老师 + + 2016-02-23 22:59:45 +
+ 学院新闻 + + 我院“心理学虚拟仿真实验教学中心”获批为国家级虚拟仿真实验教学中心 + + + 董老师 + + 2016-02-20 11:51:23 +
+ 学院新闻 + + 陕西省行为与认知神经科学重点实验室召开建设与学术研讨会 + + + 成老师 + + 2016-02-19 09:46:26 +
+ 学院新闻 + + 爱尔兰国立大学Brian Hughes教授做客我院第79期心理学大讲堂 + + + 成老师 + + 2016-02-01 14:48:43 +
+ 学院新闻 + + 我院青年师生学术沙龙第十六期圆满结束 + + + 成老师 + + 2016-01-13 09:34:58 +
+ 学院新闻 + + 我院党总支召开“三严三实”专题民主生活会 + + + 董老师 + + 2016-01-07 15:28:58 +
+ 学院新闻 + + 我院召开2015-2016学年第一学期期末考试工作会议 + + + admin + + 2015-12-29 11:01:48 +
+ 学院新闻 + + 我院青年师生学术沙龙第十五期圆满结束 + + + 董老师 + + 2015-12-24 16:21:21 +
+ 学院新闻 + + 我院青年师生学术沙龙第十四期圆满举行 + + + 董老师 + + 2015-12-21 17:15:06 +
+ 学院新闻 + + 陕西省2015年秋季“领导干部心理素质提升”专题培训班学员来我院参观座谈 + + + admin + + 2015-12-21 17:09:04 +
+ 学院新闻 + + 我院举办的“西安市雁塔区2015年心理健康教育教师培训班”圆满结束 + + + admin + + 2015-12-21 17:04:10 +
+ 学院新闻 + + 我院青年师生学术沙龙第十三期圆满结束 + + + admin + + 2015-12-21 17:02:43 +
+ 学院新闻 + + 中国东方航空股份有限公司与我校合作开展的飞行员心理援助项目启动 + + + admin + + 2015-12-21 17:00:55 +
+ 学院新闻 + + 我院青年师生学术沙龙第十二期圆满举行 + + + admin + + 2015-12-21 16:59:02 +
+ 学院新闻 + + 我院第78期心理学大讲堂圆满结束 + + + admin + + 2015-12-21 16:57:17 +
+ 学院新闻 + + 我院青年师生学术沙龙第十一期圆满举行 + + + admin + + 2015-12-21 16:55:17 +
+ 学院新闻 + + 中国心理学会教育心理学专业委员会2015年学术研讨及工作会议在我校召开 + + + admin + + 2015-11-19 19:28:44 +
+ 学院新闻 + + 我院青年师生学术沙龙第十期圆满举行 + + + admin + + 2015-11-11 09:00:44 +
+ 学院新闻 + + 我院王勇慧教授赴美国北佛罗里达大学进行学术交流 + + + admin + + 2015-11-09 09:19:28 +
+ 学院新闻 + + 第八届青年教师教学基本功大赛学院预赛圆满举行 + + + admin + + 2015-11-09 09:13:59 +
+ 学院新闻 + + 陕西师范大学心理学院第七期党课培训第二讲顺利进行 + + + + + 2015-11-07 17:26:50 +
+ 学院新闻 + + 我院举办第七期党校开学典礼 + + + admin + + 2015-11-04 15:37:06 +
+ 学院新闻 + + 心理学院举办2016届毕业生就业动员大会 + + + admin + + 2015-11-03 10:09:24 +
+ 学院新闻 + + 澳大利亚心理学会主席Michael Kyrios教授做客我院第77期心理学大讲堂 + + + admin + + 2015-11-02 14:40:51 +
+ 学院新闻 + + 社科处马瑞映处长莅临我院作关于国家社科基金申请的报告 + + + admin + + 2015-11-02 10:29:30 +
+ 学院新闻 + + 我院第76期心理学大讲堂圆满结束 + + + admin + + 2015-11-01 17:12:12 +
+ 学院新闻 + + 中科院心理所杨玉芳研究员做客我院第75期心理学大讲堂 + + + admin + + 2015-11-01 16:57:09 +
+ 学院新闻 + + 2013级应用心理学班召开学风建设主题班会 + + + admin + + 2015-10-26 11:45:57 +
+ 学院新闻 + + 我院领导看望并慰问实习学生 + + + admin + + 2015-10-26 08:49:17 +
+ 学院新闻 + + 2013级心理学一班召开“学风建设”主题班会 + + + admin + + 2015-10-26 08:42:56 +
+ 学院新闻 + + 我院举办北京市朝阳区2015年骨干教师高级研修项目培训班 + + + admin + + 2015-10-23 16:35:49 +
+ 学院新闻 + + 心理学院召开迎接陕西省高校巡视诊断动员大会 + + + admin + + 2015-10-23 14:24:44 +
+ 学院新闻 + + 心理学院党总支召开“三严三实”第二专题研讨会 + + + admin + + 2015-10-23 09:01:47 +
+ 学院新闻 + + 蓝月亮2016校园招聘简章 + + + admin + + 2015-10-21 16:19:24 +
+ 学院新闻 + + 唱响红色旋律,显我学子风范 + + + admin + + 2015-10-21 09:26:02 +
+ 学院新闻 + + 我院心理学大讲堂第74期学术报告圆满结束 + + + admin + + 2015-10-19 11:24:05 +
+ 学院新闻 + + 陕西秦盾爆破技术培训中心招聘启事 + + + admin + + 2015-10-09 11:39:18 +
+ 学院新闻 + + 我院召开迎接陕西高校巡视诊断工作动员部署会议 + + + admin + + 2015-09-30 14:31:38 +
+ 学院新闻 + + 我院院长王振宏教授应邀参加第十九届欧洲认知心理学大会 + + + admin + + 2015-09-24 15:16:08 +
+ 学院新闻 + + 我院多项科研成果近期在国际心理学SSCI/SCI顶级期刊发表 + + + admin + + 2015-09-17 15:30:18 +
+ 学院新闻 + + 我院召开2016年推荐免试攻读硕士研究生说明会 + + + admin + + 2015-09-17 08:45:02 +
+ 学院新闻 + + 我院召开2015年新学期工作部署会议 + + + admin + + 2015-09-10 09:47:47 +
+ 学院新闻 + + 心理学院举办2015级研究生新生见面会既入学教育 + + + admin + + 2015-09-02 10:58:13 +
+ 学院新闻 + + 我院赵晶晶博士获2015年国际精神疾病基因协会优秀青年科学研究者奖 + + + admin + + 2015-08-30 08:45:17 +
+ 学院新闻 + + 我院李彩娜副教授实验团队研究成果被国际著名期刊录用 + + + admin + + 2015-08-30 08:29:31 +
+ 学院新闻 + + 萧正洪副校长参加我院 “三严三实”专题研讨会 + + + admin + + 2015-07-15 14:54:19 +
+ 学院新闻 + + 我院游旭群教授主持的教育部哲学社会科学重大课题攻关项目取得突破性成果 + + + admin + + 2015-07-09 09:15:42 +
+ 学院新闻 + + 我院本科生党支部举行“三严三实”联系支部主题学习活动——人民日报“读报用报”学... + + + admin + + 2015-07-03 10:46:57 +
+ 学院新闻 + + 我院全面落实处级干部联系基层制度 + + + admin + + 2015-07-03 10:40:27 +
+ 学院新闻 + + 我院举行“三严三实”教育专题党课 + + + admin + + 2015-06-30 18:09:44 +
+ 学院新闻 + + 我院青年教师陈煦海副教授研究组揭示跨通道情绪变化的整合加工机制 + + + admin + + 2015-06-29 11:43:34 +
+ 学院新闻 + + 我院游旭群教授团队的研究成果被国际著名教师教育研究期刊录用 + + + admin + + 2015-06-26 10:06:24 +
+ 学院新闻 + + 我院首位留学生顺利通过博士论文答辩并获得理学博士学位 + + + admin + + 2015-06-19 16:54:37 +
+ 学院新闻 + + 我院青年师生学术沙龙第九期圆满结束 + + + admin + + 2015-06-10 08:58:51 +
+ 学院新闻 + + 我院心理学大讲堂第73期学术报告圆满结束 + + + admin + + 2015-06-01 14:57:57 +
+ 学院新闻 + + 密西根大学Cortina教授为我院师生做出国留学程序宣讲 + + + admin + + 2015-06-01 14:57:19 +
+ 学院新闻 + + 萧正洪副校长莅临我院与我院师生代表座谈 + + + admin + + 2015-06-01 11:52:23 +
+ 学院新闻 + + 我院心理学大讲堂第72期学术报告暨引进人才考核会议圆满结束 + + + admin + + 2015-06-01 11:33:17 +
+ 学院新闻 + + 我院心理学大讲堂第71期学术报告圆满结束 + + + admin + + 2015-05-29 08:49:19 +
+ 学院新闻 + + 我院青年师生学术沙龙第八期圆满举行 + + + admin + + 2015-05-28 10:33:44 +
+ 学院新闻 + + “领导干部心理素质提升”专题培训班学员来我院参观座谈 + + + admin + + 2015-05-25 14:46:07 +
+ 学院新闻 + + 我院举办第六届与美国密歇根大学交流活动 + + + admin + + 2015-05-22 11:04:49 +
+ 学院新闻 + + 心理学院召开毕业生相关工作说明会 + + + admin + + 2015-05-21 14:24:35 +
+ 学院新闻 + + 我院举办本科生就业工作推进会 + + + admin + + 2015-05-20 15:26:05 +
+ 学院新闻 + + 中国航天员科研训练中心吴斌主任一行访问我院 + + + admin + + 2015-05-18 20:52:58 +
+ 学院新闻 + + 我院心理学大讲堂第70期学术报告圆满结束 + + + admin + + 2015-05-15 15:44:40 +
+ 学院新闻 + + 我院荣获 “学院文化建设先进单位”称号 + + + admin + + 2015-05-14 16:56:51 +
+ 学院新闻 + + 《心理科学》第六次主编扩大会议暨2014—2017届编委会第二次会议在我校召开 + + + admin + + 2015-04-30 15:16:02 +
+ 学院新闻 + + 中科院心理所杨玉芳研究员做客我院第69期心理学大讲堂 + + + admin + + 2015-04-30 15:15:16 +
+ 学院新闻 + + 我院心理学大讲堂第68期学术报告圆满结束 + + + admin + + 2015-04-30 15:14:22 +
+ 学院新闻 + + 我院心理学大讲堂第67期学术报告圆满举行 + + + admin + + 2015-04-30 15:13:04 +
+ 学院新闻 + + 莫雷教授做客我院第66期心理学大讲堂 + + + admin + + 2015-04-30 15:10:16 +
+ 学院新闻 + + 我院心理学大讲堂第65期学术报告圆满举行 + + + admin + + 2015-04-30 15:08:27 +
+ 学院新闻 + + 我院青年师生学术沙龙第七期圆满举行 + + + admin + + 2015-04-29 11:21:55 +
+ 学院新闻 + + 我院召开2015年第二次教学科研人员补充考察会议 + + + admin + + 2015-04-28 16:11:49 +
+ 学院新闻 + + 校运会系列报道之三——努力创辉煌 + + + admin + + 2015-04-27 15:41:42 +
+ 学院新闻 + + 校运会系列报道之二——团结共奋进 + + + admin + + 2015-04-27 15:34:24 +
+ 学院新闻 + + 校运会系列报道之一——师生齐拼搏 + + + admin + + 2015-04-27 15:01:07 +
+ 学院新闻 + + 我院举办“诚信是否吃亏”主题辩论会 + + + admin + + 2015-04-27 14:58:09 +
+ 学院新闻 + + 齐心协力创比赛佳绩,团结拼搏展学子风采——记我院学子参加首届男子篮球联赛 + + + admin + + 2015-04-21 09:34:17 +
+ 学院新闻 + + [推荐]我院2011级学生孙鑫被评为陕西师范大学“优秀学生标兵” + + + admin + + 2015-04-21 09:30:16 +
+ 学院新闻 + + 我院举办未就业研究生座谈会 + + + admin + + 2015-04-16 08:47:18 +
+ 学院新闻 + + 我院举办本科生培养方案修订座谈会 + + + admin + + 2015-04-14 11:35:52 +
+ 学院新闻 + + 中国科学院心理所傅小兰研究员做客我院第64期心理学大讲堂 + + + admin + + 2015-04-14 08:53:52 +
+ 学院新闻 + + 我院举办未就业本科毕业生帮扶会议 + + + admin + + 2015-04-10 15:09:00 +
+ 学院新闻 + + 我院举办2015年运动会动员大会 + + + admin + + 2015-04-02 18:04:12 +
+ 学院新闻 + + 我院心理学大讲堂第63期学术报告圆满举行 + + + admin + + 2015-03-30 15:43:34 +
+ 学院新闻 + + 我院召开人才引进与师资补充考核会议 + + + admin + + 2015-03-27 13:31:13 +
+ 学院新闻 + + 我院召开2015年工作部署会议 + + + admin + + 2015-03-19 10:25:54 +
+ 学院新闻 + + 我院心理学大讲堂第62期学术报告圆满举行 + + + admin + + 2015-03-16 20:13:34 +
+ 学院新闻 + + 奕阳教育来我院招聘毕业生 + + + admin + + 2015-03-16 14:59:23 +
+ 学院新闻 + + 我院召开2015年国家社科基金项目初评会议 + + + admin + + 2015-02-02 16:55:42 +
+ 学院新闻 + + 德国洪堡大学Werner Sommer教授作客第61期心理学大讲堂 + + + admin + + 2015-02-02 16:53:17 +
+ 学院新闻 + + 陕西省心理学会第七次会员代表大会在我校召开 + + + admin + + 2015-02-02 16:32:44 +
+ 学院新闻 + + 我院举办中学教师教育能力促进培训班圆满结束 + + + admin + + 2015-01-25 22:04:55 +
+ 学院新闻 + + 我院召开二级教代会 + + + admin + + 2015-01-23 10:39:19 +
+ 学院新闻 + + 我院召开处级干部民主生活会 + + + admin + + 2015-01-21 18:40:43 +
+ 学院新闻 + + 萧正洪副校长一行来我院调研 + + + admin + + 2015-01-18 14:01:54 +
+ 学院新闻 + + 我院召开2014-2015学年第一学期期末考试工作会议 + + + admin + + 2015-01-17 11:08:45 +
+ 学院新闻 + + 郑州幼儿师范高等专科学校公开招聘心理健康教育教师 + + + admin + + 2015-01-05 11:15:09 +
+ 学院新闻 + + 党委副书记王涛为心理学院教职工做“新时期意识形态建设与挑战”专题报告 + + + admin + + 2014-12-26 08:49:03 +
+ 学院新闻 + + 火样的热情 飞扬的青春——我院学子参加纪念“12.9”运动暨“阳光体育”半程马... + + + admin + + 2014-12-11 11:13:06 +
+ 学院新闻 + + 长江大学外国语学院来我院招聘毕业生 + + + admin + + 2014-12-04 11:56:26 +
+ 学院新闻 + + 我院70周年校庆系列学术活动之名家讲坛(十)暨心理学大讲堂第60期学术报告圆满... + + + admin + + 2014-12-02 10:09:18 +
+ 学院新闻 + + 我院70周年校庆系列学术活动之青年师生学术沙龙第六期圆满举行 + + + admin + + 2014-12-01 14:46:57 +
+ 学院新闻 + + 苏宁云商1200营销管理培训生招聘简章 + + + admin + + 2014-11-25 14:48:27 +
+ 学院新闻 + + 我院70周年校庆系列学术活动之青年师生第五期学术沙龙圆满举行 + + + admin + + 2014-11-14 19:36:24 +
+ 学院新闻 + + 就业信息发布:陕西省房地产研究会招聘简介 + + + admin + + 2014-11-13 09:21:23 +
+ 学院新闻 + + 我院召开校内收入分配制度调整通报会议 + + + admin + + 2014-11-12 11:36:38 +
+ 学院新闻 + + 再勉学路,启立职场——心理学院2012级本科生学风建设系列活动之一保研考研交流会 + + + admin + + 2014-11-11 15:49:35 +
+ 学院新闻 + + “时代心理”来我院招聘毕业生 + + + admin + + 2014-11-11 09:47:57 +
+ 学院新闻 + + 改变自我 创造未来——心理学院2012级本科生学风建设主题班会 + + + admin + + 2014-11-07 14:50:03 +
+ 学院新闻 + + 心理学院70周年校庆系列学术活动之校友讲坛(五)暨心理学大讲堂第59期学术报告... + + + admin + + 2014-11-07 11:37:56 +
+ 学院新闻 + + 时代心理2014招聘计划 + + + admin + + 2014-11-07 10:52:27 +
+ 学院新闻 + + 陕西省科技厅副书记张书玲一行到心理学院进行立项考察 + + + admin + + 2014-11-03 15:47:12 +
+ 学院新闻 + + 心理学院召开学生党支部委员业务知识培训会议 + + + admin + + 2014-10-31 09:46:01 +
+ 学院新闻 + + 我院举办2015届本科毕业生实习总结暨就业动员大会 + + + admin + + 2014-10-30 18:39:10 +
+ 学院新闻 + + 心理学院举办2015届研究生毕业生就业动员大会 + + + admin + + 2014-10-28 10:37:24 +
+ 学院新闻 + + 我院70周年校庆系列学术活动之名家讲坛(九)暨心理学大讲堂第58期学术报告圆满... + + + admin + + 2014-10-27 17:32:50 +
+ 学院新闻 + + 我院70周年校庆系列学术活动之青年师生第四期学术沙龙圆满举行 + + + admin + + 2014-10-27 17:30:22 +
+ 学院新闻 + + 我院召开学生会成立暨工作方法研讨会 + + + admin + + 2014-10-24 15:41:16 +
+ 学院新闻 + + 心理学院70周年校庆系列学术活动之校友讲坛(四)暨第57期心理学大讲堂学术报告... + + + admin + + 2014-10-22 11:57:01 +
+ 学院新闻 + + 我院师生积极参加中国心理学会第十七届全国心理学学术大会 + + + admin + + 2014-10-20 11:43:17 +
+ 学院新闻 + + 心理学院70周年校庆系列学术活动之名家讲坛(八)暨第56期心理学大讲堂圆满成功 + + + admin + + 2014-10-20 09:37:08 +
+ 学院新闻 + + [图文]我院游旭群教授当选中国心理学会理事长 + + + admin + + 2014-10-15 09:04:12 +
+ 学院新闻 + + 我院举行庆祝建校七十周年学院与学科发展座谈会 + + + admin + + 2014-10-14 11:06:31 +
+ 学院新闻 + + 心理学院70周年校庆系列学术活动之名家讲坛(七)暨心理学大讲堂第55期学术报告... + + + admin + + 2014-09-25 18:07:50 +
+ 学院新闻 + + 我院70周年校庆系列学术活动之青年师生第三期学术沙龙圆满举行 + + + admin + + 2014-09-25 17:42:28 +
+ 学院新闻 + + 我院举行70周年校庆系列学术活动之名家讲坛(六)暨心理学大讲堂第54期学术报告... + + + admin + + 2014-09-25 16:10:42 +
+ 学院新闻 + + 我院举行70周年校庆系列学术活动之名家讲坛(五)暨心理学大讲堂第53期学术报告 + + + admin + + 2014-09-25 11:48:40 +
+ 学院新闻 + + 国家能源新材料技术研发中心中物功能材料研究院有限公司董事长一行访问心理学院 + + + admin + + 2014-09-22 11:14:34 +
+ 学院新闻 + + 我院举行70周年校庆系列学术活动之校友讲坛(三)暨心理学大讲堂第52期学术报告 + + + admin + + 2014-09-18 11:06:41 +
+ 学院新闻 + + 我院2012级应用心理班召开班委换届主题班会 + + + admin + + 2014-09-16 11:39:21 +
+ 学院新闻 + + 我院召开2014-2015学年第一学期工作部署会议 + + + admin + + 2014-09-16 07:58:09 +
+ 学院新闻 + + 我院召开2014级研究生迎新大会 + + + admin + + 2014-09-15 11:45:51 +
+ 学院新闻 + + 我院召开2015年本科生推免工作动员会 + + + admin + + 2014-09-09 17:44:34 +
+ 学院新闻 + + 2014年我院暑期学校课程教学圆满结束 + + + admin + + 2014-07-22 15:41:36 +
+ 学院新闻 + + 我院举行70周年校庆系列学术活动之名家讲坛(四)暨心理学大讲堂第51期学术报告 + + + admin + + 2014-07-08 17:37:28 +
+ 学院新闻 + + 我院举行70年校庆系列学术活动之第二期青年师生学术沙龙 + + + admin + + 2014-07-08 17:33:22 +
+ 学院新闻 + + 我院举行70周年校庆系列学术活动之青年师生学术沙龙第一期预告 + + + admin + + 2014-07-08 17:31:17 +
+ 学院新闻 + + 我院基层党建工作取得可喜成绩 + + + admin + + 2014-07-01 17:33:24 +
+ 学院新闻 + + 有梦,就能梦成真 + + + admin + + 2014-06-26 17:30:12 +
+ 学院新闻 + + 我院举行70周年校庆系列学术活动之校友讲坛(二)暨心理学大讲堂第50期学术报告 + + + admin + + 2014-06-23 08:21:38 +
+ 学院新闻 + + 我院举行70周年校庆系列学术活动之校友讲坛(一)暨心理学大讲堂第49期学术报告 + + + admin + + 2014-06-20 10:27:19 +
+ 学院新闻 + + 我院举行70周年校庆系列学术活动之教授讲坛(二) 暨心理学大讲堂第48期学术报告 + + + admin + + 2014-06-19 10:11:49 +
+ 学院新闻 + + 程光旭校长一行莅临我院调研与指导工作 + + + admin + + 2014-06-15 16:14:18 +
+ 学院新闻 + + 学院举行70周年校庆系列学术活动之教授讲坛(一)暨心理学大讲堂第47期学术报告 + + + admin + + 2014-06-12 16:54:55 +
+ 学院新闻 + + 我院博士、硕士研究生学位毕业论文答辩圆满结束 + + + admin + + 2014-06-12 16:49:30 +
+ 学院新闻 + + 我院举行70周年校庆之本科教学学术交流活动 + + + admin + + 2014-06-11 20:15:42 +
+ 学院新闻 + + 我院举办2011级本科生考研就业经验交流会 + + + admin + + 2014-06-09 09:18:32 +
+ 学院新闻 + + 七十周年校庆心理学院系列学术活动开幕式隆重举行 + + + admin + + 2014-05-30 16:50:09 +
+ 学院新闻 + + 我校教育学院师生参观我院心理学实验室 + + + admin + + 2014-05-27 10:34:48 +
+ 学院新闻 + + 美国密西根大学Miller教授为我院本科生讲授 “教育心理学” + + + admin + + 2014-05-19 10:44:50 +
+ 学院新闻 + + 我院召开诚信教育主题班会 + + + admin + + 2014-05-08 15:47:35 +
+ 学院新闻 + + 杜鹏教授做客第43期心理学大讲堂 + + + admin + + 2014-04-30 10:45:32 +
+ 学院新闻 + + 我院王勇慧教授及博士生赵亮赴欧洲进行学术交流 + + + admin + + 2014-04-22 11:50:15 +
+ 学院新闻 + + 我院教职员工积极参加学校春季运动会 + + + admin + + 2014-04-21 10:58:57 +
+ 学院新闻 + + 心理学院研究生国家奖学金评选程序及评选细则 + + + admin + + 2014-04-14 15:17:38 +
+ 学院新闻 + + 心理学院研究生奖学金评选实施办法 + + + admin + + 2014-04-14 15:14:40 +
+ 学院新闻 + + 西安市第三中学来我院招聘毕业生 + + + admin + + 2014-04-11 14:58:53 +
+ 学院新闻 + + 余嘉元教授作客第42期心理学大讲堂 + + + admin + + 2014-04-01 15:42:05 +
+ 学院新闻 + + 我院召开党的群众路线教育实践活动总结大会 + + + admin + + 2014-03-25 09:06:06 +
+ 学院新闻 + + 我院2014年工作部署会议召开 + + + admin + + 2014-02-24 11:17:13 +
+ 学院新闻 + + 校党委书记甘晖一行到我院检查、调研开学各项工作运行情况 + + + admin + + 2014-02-18 11:24:30 +
+ 学院新闻 + + 我院王振宏教授团队的研究成果被国际顶级心理学期刊录用 + + + admin + + 2014-02-16 21:21:01 +
+ 学院新闻 + + 我院举行国家自然科学基金、国家社会科学基金项目申报交流研讨会 + + + admin + + 2014-02-09 10:58:06 +
+ 学院新闻 + + 游旭群教授主持的教育部哲学社会科学重大招标课题研究进展研讨会如期举行 + + + admin + + 2014-01-24 10:54:16 +
+ 学院新闻 + + 我院游旭群教授被聘为《心理学报》副主编 + + + admin + + 2014-01-22 18:05:58 +
+ 学院新闻 + + 心理学大讲堂第41期学术报告圆满结束 + + + admin + + 2014-01-13 08:55:27 +
+
+ + +
+ + + + + + + + + +
+
+ + + diff --git a/test/html/snnu_psych_notice.html b/test/html/snnu_psych_notice.html new file mode 100644 index 0000000..31070bd --- /dev/null +++ b/test/html/snnu_psych_notice.html @@ -0,0 +1,6237 @@ + + + + + 陕西师范大学心理学院 + + + + + + + + +
+
+ + +
+ +
+ 当前位置: 首页 > 通知公告 +
+ +
+ 日期范围: + + 至 + + +      + + 标题: + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 类型 + + 标题 + + 发布人 + + 发布时间 +
+ 通知公告 + + 泽如心理学创新实验班系列讲座(十二)预告 + + + 杜娟 + + 2018-11-28 11:48:39 +
+ 通知公告 + + 心理学院 2018年专业技术职务任职资格初审结果公示 + + + 董增云 + + 2018-11-20 17:35:27 +
+ 通知公告 + + 泽如心理学创新实验班系列讲座(十一)预告 + + + 杜娟 + + 2018-11-07 11:34:31 +
+ 通知公告 + + 心理学院2018年国庆节值班安排表 + + + 成爱军 + + 2018-09-28 11:06:55 +
+ 通知公告 + + 陕西师范大学第三届“曲江学者论坛”之“青年学者论坛”分论坛预告 + + + 雷萍 + + 2018-09-21 21:06:15 +
+ 通知公告 + + 心理学院2019年接收优秀应届生 推荐免试攻读硕士生招生办法 + + + 雷萍 + + 2018-09-20 15:39:32 +
+ 通知公告 + + 2018年中秋节值班安排表 + + + 成爱军 + + 2018-09-18 10:36:46 +
+ 通知公告 + + 心理学院2019年免试攻读硕士学位研究生拟推荐名单公示 + + + 董增云 + + 2018-09-14 07:51:59 +
+ 通知公告 + + 关于举行我院2018级新生开学典礼的通知 + + + 李奕伯 + + 2018-09-13 09:14:59 +
+ 通知公告 + + 心理学大讲堂第118期学术报告预告 + + + admin + + 2018-09-12 08:55:48 +
+ 通知公告 + + 64导脑电记录系统(XX180065)采购结果公告 + + + + + 2018-07-30 17:22:58 +
+ 通知公告 + + 行为数据集成采集与分析系统(XX180063)采购结果公告 + + + 成爱军 + + 2018-07-30 16:38:59 +
+ 通知公告 + + 公 示 + + + 成爱军 + + 2018-07-29 16:39:14 +
+ 通知公告 + + 2018年中芬联合学习创新研究院“未来学习创新人才”论坛通知 + + + 成爱军 + + 2018-07-29 16:36:49 +
+ 通知公告 + + 2018年第二届全国工程心理学学术年会会议通知(第二轮) + + + 成爱军 + + 2018-07-26 15:55:30 +
+ 通知公告 + + 关于举办第三届“曲江学者论坛”暨陕西省“丝绸之路青年学者论坛”分论坛的通知 + + + 董增云 + + 2018-07-13 17:07:55 +
+ 通知公告 + + 64导脑电记录系统(XX180065)采购公告 + + + 成爱军 + + 2018-07-13 11:26:58 +
+ 通知公告 + + 行为数据集成采集与分析系统(XX180063)采购公告 + + + 成爱军 + + 2018-07-12 17:27:06 +
+ 通知公告 + + 关于2018年心理学院研究生创新项目中期考核及结项工作结果公布 + + + 雷萍 + + 2018-07-12 11:38:00 +
+ 通知公告 + + 关于2018年心理学院研究生创新项目评选结果的公示 + + + 雷萍 + + 2018-07-12 11:15:42 +
+ 通知公告 + + FMS无创血流动力学系统(XX180055)采购结果公告 + + + 成爱军 + + 2018-07-11 17:18:44 +
+ 通知公告 + + 关于首届“陕西师范大学教书育人奖”拟推荐人选的公示 + + + 2007042 + + 2018-07-11 16:19:18 +
+ 通知公告 + + 心理学大讲堂第117期学术报告预告 + + + 李奕伯 + + 2018-06-28 09:52:05 +
+ 通知公告 + + 心理学大讲堂第116期学术报告预告 + + + 成爱军 + + 2018-06-23 20:14:20 +
+ 通知公告 + + 公 示 + + + 成爱军 + + 2018-06-21 10:32:32 +
+ 通知公告 + + FMS无创血流动力学系统采购(XX180055)公告 + + + 成爱军 + + 2018-06-20 21:16:39 +
+ 通知公告 + + 心理学大讲堂第115期学术报告预告 + + + 李奕伯 + + 2018-06-20 08:27:55 +
+ 通知公告 + + 2018年端午节值班安排表 + + + 成爱军 + + 2018-06-15 11:30:53 +
+ 通知公告 + + 心理学院关于评选2017-2018学年度优秀研究生、 优秀毕业研究生、优秀研究... + + + 2007042 + + 2018-06-14 10:00:33 +
+ 通知公告 + + 关于对2018年度宝钢教育奖候选人(优秀研究生)评选结果公示的通知 + + + 2007042 + + 2018-06-14 09:56:23 +
+ 通知公告 + + 眼动追踪系统(XX180047)采购结果公告 + + + 成爱军 + + 2018-06-13 16:41:29 +
+ 通知公告 + + 心理学大讲堂第114期学术报告预告 + + + 李奕伯 + + 2018-06-11 10:17:41 +
+ 通知公告 + + 眼动追踪系统(XX180040)采购结果公告 + + + 成爱军 + + 2018-06-06 17:18:48 +
+ 通知公告 + + 心理学大讲堂第113期学术报告预告 + + + 李奕伯 + + 2018-06-06 09:05:15 +
+ 通知公告 + + 心理学大讲堂第112期学术报告预告 + + + 李奕伯 + + 2018-06-01 10:53:55 +
+ 通知公告 + + 陕西师范大学眼动追踪系统(XX180047)采购公告 + + + 成爱军 + + 2018-05-29 16:11:08 +
+ 通知公告 + + 陕西师范大学眼动追踪系统(XX180040)采购公告(二次) + + + 成爱军 + + 2018-05-17 15:31:42 +
+ 通知公告 + + 眼动追踪系统采购项目(XX180040)流标公告 + + + 成爱军 + + 2018-05-17 15:25:04 +
+ 通知公告 + + 心理学大讲堂第111期学术报告预告 + + + 李奕伯 + + 2018-05-17 08:56:54 +
+ 通知公告 + + 心理学大讲堂第110期学术报告预告 + + + 成爱军 + + 2018-05-10 08:30:13 +
+ 通知公告 + + 心理学大讲堂第109期学术报告预告 + + + 成爱军 + + 2018-05-08 09:12:41 +
+ 通知公告 + + 心理学大讲堂第108期学术报告预告 + + + admin + + 2018-05-08 09:10:48 +
+ 通知公告 + + 心理学大讲堂第107期学术报告预告 + + + 成爱军 + + 2018-05-04 18:11:11 +
+ 通知公告 + + 心理学大讲堂第106期学术报告预告 + + + admin + + 2018-05-04 18:10:32 +
+ 通知公告 + + 心理学大讲堂第105期学术报告预告 + + + admin + + 2018-05-04 18:09:43 +
+ 通知公告 + + 关于2018年心理学院研究生创新项目中期检查及结题工作的通知 + + + 雷萍 + + 2018-04-28 17:34:52 +
+ 通知公告 + + 关于申报2018年心理学院研究生创新项目的通知 + + + 雷萍 + + 2018-04-28 17:19:05 +
+ 通知公告 + + 陕西师范大学眼动追踪系统(XX180040)采购公告 + + + 成爱军 + + 2018-04-25 15:42:58 +
+ 通知公告 + + 2018年劳动节值班安排表 + + + 成爱军 + + 2018-04-24 16:15:03 +
+ 通知公告 + + 人格与社会心理学课程系列讲座预告 + + + 成爱军 + + 2018-04-16 21:29:23 +
+ 通知公告 + + 2018年清明节值班安排表 + + + 成爱军 + + 2018-04-04 15:08:43 +
+ 通知公告 + + 心理学大讲堂第104期学术报告预告 + + + 成爱军 + + 2018-04-02 14:57:46 +
+ 通知公告 + + 心理学院2018年接收非全日制专业学位心理健康教育专业 硕士研究生调剂公告 + + + 雷萍 + + 2018-03-27 11:30:06 +
+ 通知公告 + + 2018年硕士研究生招生考试复试计划 + + + 雷萍 + + 2018-03-24 18:30:11 +
+ 通知公告 + + 陕西师范大学心理学院2018年教师岗位招聘公告 + + + 董增云 + + 2018-03-08 16:34:07 +
+ 通知公告 + + 心理学大讲堂第103期学术报告预告 + + + 成爱军 + + 2018-03-08 09:17:45 +
+ 通知公告 + + 心理学院2018年接收硕士研究生优秀生源调剂公告 + + + 雷萍 + + 2018-03-06 08:51:36 +
+ 通知公告 + + 心理学大讲堂第102期学术报告预告 + + + admin + + 2018-01-18 15:20:45 +
+ 通知公告 + + 心理学院2017年度教职工考核拟定优秀人员公示 + + + 成老师 + + 2018-01-03 16:03:39 +
+ 通知公告 + + 2018年元旦值班安排表 + + + 成老师 + + 2017-12-29 15:32:44 +
+ 通知公告 + + 心理学大讲堂第101期学术报告预告 + + + 成爱军 + + 2017-12-19 16:46:48 +
+ 通知公告 + + 心理学大讲堂第100期学术报告预告 + + + 成老师 + + 2017-12-14 19:21:29 +
+ 通知公告 + + 心理学院青年学术沙龙第三十期预告 + + + 雷老师 + + 2017-12-13 11:39:13 +
+ 通知公告 + + 2017年职称评审心理学科评议组评审结果公示 + + + 成老师 + + 2017-12-07 09:00:36 +
+ 通知公告 + + 泽如心理学创新实验班系列讲座(十)预告 + + + 杜老师 + + 2017-12-01 09:37:37 +
+ 通知公告 + + 泽如心理学创新实验班系列讲座(九)预告 + + + 杜老师 + + 2017-12-01 09:36:38 +
+ 通知公告 + + 心理学院青年学术沙龙第二十九期预告 + + + 雷老师 + + 2017-11-29 16:42:35 +
+ 通知公告 + + 心理学院青年师生学术沙龙第二十八期预告 + + + 雷老师 + + 2017-11-23 10:58:26 +
+ 通知公告 + + 陕西师范大学第二届“曲江学者论坛”之心理学大讲堂第99期学术报告预告 + + + 成老师 + + 2017-11-15 09:20:36 +
+ 通知公告 + + 心理学院青年师生学术沙龙第二十七期预告 + + + 雷老师 + + 2017-11-14 09:27:04 +
+ 通知公告 + + 心理学院 2017年专业技术职务任职资格初审结果公示 + + + 成老师 + + 2017-11-13 15:46:46 +
+ 通知公告 + + 心理学大讲堂第98期学术报告预告 + + + 成老师 + + 2017-11-03 10:39:11 +
+ 通知公告 + + 心理学院青年师生学术沙龙第二十六期预告 + + + 雷老师 + + 2017-10-26 17:11:35 +
+ 通知公告 + + 关于对2017年研究生国家奖学金评选结果公示的通知 + + + 2007042 + + 2017-10-19 16:09:11 +
+ 通知公告 + + 关于对2017年优秀青年学术骨干资助计划拟推荐人选公示的通知 + + + 成老师 + + 2017-10-19 15:35:54 +
+ 通知公告 + + 关于对新进教师聘期考核结果公示的通知 + + + admin + + 2017-10-19 14:48:39 +
+ 通知公告 + + 心理学大讲堂第97期学术报告预告 + + + 成老师 + + 2017-10-09 11:15:58 +
+ 通知公告 + + 2017年国庆节、中秋节值班安排 + + + 成老师 + + 2017-09-27 08:57:30 +
+ 通知公告 + + 心理学院青年师生学术沙龙第二十五期预告 + + + 雷老师 + + 2017-09-19 10:54:57 +
+ 通知公告 + + 心理学院关于推荐2018年免试硕士研究生候选人的公示 + + + 2007042 + + 2017-09-15 11:06:06 +
+ 通知公告 + + 心理学院青年师生学术沙龙第二十四期预告 + + + 雷老师 + + 2017-09-13 15:35:04 +
+ 通知公告 + + 心理学大讲堂第96期学术报告预告 + + + 成老师 + + 2017-08-29 10:55:36 +
+ 通知公告 + + 心理学大讲堂第95期学术报告预告 + + + 成老师 + + 2017-08-26 10:36:55 +
+ 通知公告 + + 关于2017年心理学院研究生创新项目评选结果的公示 + + + 雷老师 + + 2017-07-10 19:23:58 +
+ 通知公告 + + 关于2017年心理学院研究生创新项目中期考核及结项工作结果公布 + + + 雷老师 + + 2017-07-10 19:17:25 +
+ 通知公告 + + 心理学院七级及以下职员职级晋升具有申报资格人员名单公示 + + + 成老师 + + 2017-07-05 10:20:18 +
+ 通知公告 + + 心理学院职员职级晋升具有申报资格人员名单公示 + + + 成老师 + + 2017-07-01 09:27:11 +
+ 通知公告 + + 心理学大讲堂第94期学术报告预告 + + + 成老师 + + 2017-06-22 08:57:36 +
+ 通知公告 + + 心理学院教师关键三级及其以下岗位拟聘人员名单公示 + + + 成老师 + + 2017-06-09 11:34:04 +
+ 通知公告 + + 心理学院教师关键三级及其以下岗位聘用具有参评资格人员名单公示 + + + 成老师 + + 2017-06-05 10:32:10 +
+ 通知公告 + + 心理学院2017年端午节值班安排表 + + + 成老师 + + 2017-05-27 23:17:16 +
+ 通知公告 + + 关于2017年心理学院研究生创新项目中期检查及结题工作的通知 + + + 雷老师 + + 2017-05-27 18:45:06 +
+ 通知公告 + + 关于申报2017年心理学院研究生创新项目的通知 + + + 雷老师 + + 2017-05-27 18:26:13 +
+ 通知公告 + + 泽如心理学创新实验班系列讲座(八)预告 + + + 杜老师 + + 2017-05-15 10:23:26 +
+ 通知公告 + + 心理学大讲堂第93期学术报告预告 + + + 成老师 + + 2017-05-12 17:16:22 +
+ 通知公告 + + 学术报告预告:The 4th Summit on Chinese Psychi... + + + 成老师 + + 2017-05-05 22:28:02 +
+ 通知公告 + + 泽如心理学创新实验班系列讲座(七)预告 + + + 杜老师 + + 2017-05-04 19:15:17 +
+ 通知公告 + + 泽如心理学创新实验班系列讲座(六)预告 + + + 杜老师 + + 2017-05-04 19:14:04 +
+ 通知公告 + + 学术讲座预告 + + + 成老师 + + 2017-05-04 15:19:47 +
+ 通知公告 + + 心理学大讲堂第92期学术报告预告 + + + 成老师 + + 2017-05-01 08:47:04 +
+ 通知公告 + + 中国心理学会普通心理学与实验心理学专业委员会 2017年学术年会志愿者名单公示 + + + 2007042 + + 2017-04-17 11:30:20 +
+ 通知公告 + + 2017年心理学院硕士复试安排 + + + 雷老师 + + 2017-03-19 17:49:37 +
+ 通知公告 + + 心理学大讲堂第91期学术报告预告 + + + admin + + 2017-03-08 15:40:25 +
+ 通知公告 + + 关于举办2017年春季陕西高校心理健康教育与咨询人才招聘会的通知 + + + admin + + 2017-03-08 09:26:00 +
+ 通知公告 + + 心理学院2017年上半年学位论文答辩工作安排 + + + 雷老师 + + 2017-03-03 23:38:47 +
+ 通知公告 + + 心理学院2017年接收硕士研究生优秀生源调剂公告 + + + 雷老师 + + 2017-03-03 17:04:39 +
+ 通知公告 + + 心理学院教师关键二级岗位推荐人选公示 + + + 成老师 + + 2017-03-02 09:59:46 +
+ 通知公告 + + 心理学院2017年教师岗位招聘公告 + + + 成老师 + + 2017-02-23 08:13:02 +
+ 通知公告 + + 公示 + + + 成老师 + + 2017-01-15 10:13:34 +
+ 通知公告 + + 心理学院2017年寒假值班安排 + + + 成老师 + + 2017-01-13 17:40:51 +
+ 通知公告 + + 心理学院2016年度教职工考核拟定优秀人员公示 + + + admin + + 2017-01-04 10:28:03 +
+ 通知公告 + + 心理学大讲堂第90期学术报告预告 + + + 成老师 + + 2016-12-26 15:36:31 +
+ 通知公告 + + 心理学院青年师生学术沙龙第二十三期预告 + + + 雷老师 + + 2016-12-22 10:28:08 +
+ 通知公告 + + 心理学院关于2016年度教职工考核工作的安排意见 + + + 成老师 + + 2016-12-21 14:53:08 +
+ 通知公告 + + 泽如心理学创新实验班系列讲座(五)预告 + + + 杜老师 + + 2016-12-20 17:19:22 +
+ 通知公告 + + 泽如心理学创新实验班系列讲座(四)预告 + + + 杜老师 + + 2016-12-19 09:08:41 +
+ 通知公告 + + 心理学院青年师生学术沙龙第二十二期预告 + + + 雷老师 + + 2016-12-15 11:18:56 +
+ 通知公告 + + 心理学科评议组评审结果公示 + + + admin + + 2016-12-10 17:24:53 +
+ 通知公告 + + 心理学大讲堂第89期学术报告预告 + + + 成老师 + + 2016-12-09 15:05:39 +
+ 通知公告 + + 心理学院青年师生学术沙龙第二十一期预告 + + + 雷老师 + + 2016-12-07 14:47:39 +
+ 通知公告 + + 关于举行2016年迎新晚会的通知 + + + admin + + 2016-12-06 16:23:47 +
+ 通知公告 + + 心理学院2015-2016学年度“优秀奖学金”获奖名单公示 + + + 赵老师 + + 2016-12-06 15:45:40 +
+ 通知公告 + + 心理学院青年师生学术沙龙第二十期预告 + + + 雷老师 + + 2016-11-28 16:50:19 +
+ 通知公告 + + 泽如心理学创新实验班系列讲座(三)预告 + + + 杜老师 + + 2016-11-23 09:59:26 +
+ 通知公告 + + 2017年密歇根大学安娜堡分校游学项目公告 + + + 杜老师 + + 2016-11-21 11:59:45 +
+ 通知公告 + + 心理学院青年师生学术沙龙第十九期预告 + + + 雷老师 + + 2016-11-16 09:29:40 +
+ 通知公告 + + 心理学院 2016年专业技术职务任职资格初审结果公示 + + + 董老师 + + 2016-11-11 10:37:30 +
+ 通知公告 + + 心理学院青年师生学术沙龙第十八期预告 + + + 雷老师 + + 2016-11-08 09:10:40 +
+ 通知公告 + + 心理学院青年师生学术沙龙第十七期预告 + + + 雷老师 + + 2016-11-03 14:22:42 +
+ 通知公告 + + 心理学大讲堂第88期学术报告预告 + + + 成老师 + + 2016-10-19 11:10:39 +
+ 通知公告 + + 心理学大讲堂第87期学术报告预告 + + + 成老师 + + 2016-10-18 10:32:49 +
+ 通知公告 + + 泽如心理学创新实验班系列讲座(一)、(二)预告 + + + 杜老师 + + 2016-10-12 17:33:49 +
+ 通知公告 + + 心理学院2017年接收推荐免试硕士生部分名额的公告 + + + 雷老师 + + 2016-10-09 15:12:37 +
+ 通知公告 + + 心理学大讲堂第86期学术报告预告 + + + 成老师 + + 2016-10-07 16:17:16 +
+ 通知公告 + + 心理学院关于推荐2017年“补偿名额”免试硕士研究生候选人的公示 + + + admin + + 2016-09-14 17:57:22 +
+ 通知公告 + + 心理学院关于推荐2017年免试硕士研究生候选人的公示 + + + admin + + 2016-09-14 17:55:45 +
+ 通知公告 + + 关于招募第十九届全国心理学学术会议志愿者的通知 + + + 赵老师 + + 2016-09-05 09:34:55 +
+ 通知公告 + + 2015级 “泽如心理学创新实验班”开班通知 + + + 杜老师 + + 2016-07-17 15:06:44 +
+ 通知公告 + + 心理学院2016年暑假值班安排 + + + 成老师 + + 2016-07-11 09:54:42 +
+ 通知公告 + + 关于2016年心理学院研究生创新项目评选结果的公示 + + + 雷老师 + + 2016-07-07 13:06:31 +
+ 通知公告 + + 心理学大讲堂第85期学术报告预告 + + + 成老师 + + 2016-06-28 16:31:11 +
+ 通知公告 + + 心理学大讲堂第84期学术报告预告 + + + 成老师 + + 2016-06-24 10:16:30 +
+ 通知公告 + + “”两学一做“学习教育”讲座预告 + + + 赵老师 + + 2016-05-25 08:02:58 +
+ 通知公告 + + 心理学大讲堂第83期学术报告预告 + + + 成老师 + + 2016-05-10 09:00:06 +
+ 通知公告 + + 心理学大讲堂第82期学术报告预告 + + + admin + + 2016-04-25 10:05:25 +
+ 通知公告 + + 关于2016年心理学院资助研究生出国学习评选结果的公示 + + + 雷老师 + + 2016-04-18 12:16:27 +
+ 通知公告 + + 心理学院2016年第二批师资补充答辩报告会预告 + + + 董老师 + + 2016-04-13 09:54:59 +
+ 通知公告 + + 心理学大讲堂第81期学术报告预告 + + + 成老师 + + 2016-04-11 08:23:46 +
+ 通知公告 + + 关于申报2016年心理学院资助研究生出国学习的通知 + + + 雷老师 + + 2016-03-30 14:18:02 +
+ 通知公告 + + 关于申报2016年心理学院研究生创新项目的通知 + + + 雷老师 + + 2016-03-29 17:20:53 +
+ 通知公告 + + 2016年心理学院优秀生源调剂复试工作安排 + + + 雷老师 + + 2016-03-21 18:23:41 +
+ 通知公告 + + 2016年心理学院缺额专业普通调剂复试工作安排 + + + 雷老师 + + 2016-03-21 14:33:05 +
+ 通知公告 + + 2016年硕士研究生招生考试复试计划(一志愿及少干) + + + 雷老师 + + 2016-03-18 11:34:04 +
+ 通知公告 + + 2016年硕士研究生招生考试复试计划(调剂) + + + 雷老师 + + 2016-03-18 10:44:41 +
+ 通知公告 + + 2016年心理学院硕士研究生复试工作安排 + + + 雷老师 + + 2016-03-17 10:00:42 +
+ 通知公告 + + 心理学院2016年接收部分缺额专业硕士研究生调剂公告 + + + 雷老师 + + 2016-03-17 09:58:44 +
+ 通知公告 + + 心理学院2016年接收优秀生源硕士研究生调剂公告 + + + 雷老师 + + 2016-03-17 09:56:09 +
+ 通知公告 + + 心理学院党总支委员会换届会议通知 + + + 成老师 + + 2016-03-15 17:16:01 +
+ 通知公告 + + 心理学院2016年工作要点 + + + 成老师 + + 2016-03-14 11:26:22 +
+ 通知公告 + + 心理学院2016年师资补充答辩报告会预告 + + + 董老师 + + 2016-03-10 08:46:35 +
+ 通知公告 + + “十三五”改革发展院长谈--我院王振宏院长接受校电视台专访 + + + 董老师 + + 2016-03-09 17:21:50 +
+ 通知公告 + + 心理学大讲堂第80期学术报告预告 + + + admin + + 2016-03-04 10:11:15 +
+ 通知公告 + + 心理学大讲堂第79期学术报告预告 + + + 成老师 + + 2016-01-25 10:37:50 +
+ 通知公告 + + 心理学院2016年寒假值班安排 + + + 成老师 + + 2016-01-16 11:36:07 +
+ 通知公告 + + 心理学院青年师生学术沙龙第十六期预告 + + + admin + + 2015-12-30 15:19:27 +
+ 通知公告 + + 心理学院2015年度教职工考核拟定优秀人员公示 + + + admin + + 2015-12-28 15:18:04 +
+ 通知公告 + + 关于2015年度教职工考核工作的安排意见 + + + admin + + 2015-12-23 17:31:03 +
+ 通知公告 + + 心理学院2016年教师岗位招聘公告 + + + admin + + 2015-12-22 08:57:36 +
+ 通知公告 + + 心理学院青年师生学术沙龙第十五期预告 + + + admin + + 2015-12-21 18:34:38 +
+ 通知公告 + + 心理学院青年师生学术沙龙第十四期预告 + + + admin + + 2015-12-21 18:34:03 +
+ 通知公告 + + 心理学院心理学科评议组评审结果公示 + + + admin + + 2015-12-21 18:32:52 +
+ 通知公告 + + 心理学院青年师生学术沙龙第十三期预告 + + + admin + + 2015-12-21 18:32:11 +
+ 通知公告 + + 心理学院青年师生学术沙龙第十二期预告 + + + admin + + 2015-12-21 18:19:30 +
+ 通知公告 + + 心理学大讲堂第78期学术报告预告 + + + admin + + 2015-12-21 18:16:04 +
+ 通知公告 + + 心理学院工作简报[总第3期] + + + admin + + 2015-12-21 18:08:45 +
+ 通知公告 + + 心理学院青年师生学术沙龙第十一期预告 + + + admin + + 2015-12-21 18:00:49 +
+ 通知公告 + + 心理学院研究生国家奖学金评选结果公示 + + + admin + + 2015-12-21 17:22:01 +
+ 通知公告 + + 关于心理学院2015-2016学年研究生评奖、评优工作的通知 + + + admin + + 2015-11-06 14:46:47 +
+ 通知公告 + + 2015年职称申报材料复核结果公示 + + + admin + + 2015-11-05 16:51:34 +
+ 通知公告 + + 心理学院青年师生学术沙龙第十期 + + + admin + + 2015-11-04 16:23:53 +
+ 通知公告 + + 我院举办第七期党校开学典礼 + + + admin + + 2015-11-04 15:37:06 +
+ 通知公告 + + 澳大利亚心理学会主席Michael Kyrios教授做客我院第77期心理学大讲堂 + + + admin + + 2015-11-02 14:40:51 +
+ 通知公告 + + 社科处马瑞映处长莅临我院作关于国家社科基金申请的报告 + + + admin + + 2015-11-02 10:29:30 +
+ 通知公告 + + 我院第76期心理学大讲堂圆满结束 + + + admin + + 2015-11-01 17:12:12 +
+ 通知公告 + + 中科院心理所杨玉芳研究员做客我院第75期心理学大讲堂 + + + admin + + 2015-11-01 16:57:09 +
+ 通知公告 + + 2015年职称申报材料公示 + + + admin + + 2015-10-31 09:12:35 +
+ 通知公告 + + 心理学大讲堂第77期学术报告预告 + + + admin + + 2015-10-29 15:27:55 +
+ 通知公告 + + 2013级应用心理学班召开学风建设主题班会 + + + admin + + 2015-10-26 11:45:57 +
+ 通知公告 + + 我院领导看望并慰问实习学生 + + + admin + + 2015-10-26 08:49:17 +
+ 通知公告 + + 2013级心理学一班召开“学风建设”主题班会 + + + admin + + 2015-10-26 08:42:56 +
+ 通知公告 + + 心理学大讲堂第76期学术报告预告 + + + admin + + 2015-10-23 16:59:04 +
+ 通知公告 + + 心理学大讲堂第75期学术报告预告 + + + admin + + 2015-10-23 16:58:19 +
+ 通知公告 + + 我院举办北京市朝阳区2015年骨干教师高级研修项目培训班 + + + admin + + 2015-10-23 16:35:49 +
+ 通知公告 + + 心理学院召开迎接陕西省高校巡视诊断动员大会 + + + admin + + 2015-10-23 14:24:44 +
+ 通知公告 + + 心理学院党总支召开“三严三实”第二专题研讨会 + + + admin + + 2015-10-23 09:01:47 +
+ 通知公告 + + 蓝月亮2016校园招聘简章 + + + admin + + 2015-10-21 16:19:24 +
+ 通知公告 + + 唱响红色旋律,显我学子风范 + + + admin + + 2015-10-21 09:26:02 +
+ 通知公告 + + 我院心理学大讲堂第74期学术报告圆满结束 + + + admin + + 2015-10-19 11:24:05 +
+ 通知公告 + + 陕西秦盾爆破技术培训中心招聘启事 + + + admin + + 2015-10-09 11:39:18 +
+ 通知公告 + + 心理学大讲堂第74期学术报告预告 + + + admin + + 2015-10-09 10:04:49 +
+ 通知公告 + + 我院召开迎接陕西高校巡视诊断工作动员部署会议 + + + admin + + 2015-09-30 14:31:38 +
+ 通知公告 + + 我院院长王振宏教授应邀参加第十九届欧洲认知心理学大会 + + + admin + + 2015-09-24 15:16:08 +
+ 通知公告 + + 我院多项科研成果近期在国际心理学SSCI/SCI顶级期刊发表 + + + admin + + 2015-09-17 15:30:18 +
+ 通知公告 + + 我院召开2016年推荐免试攻读硕士研究生说明会 + + + admin + + 2015-09-17 08:45:02 +
+ 通知公告 + + 我院召开2015年新学期工作部署会议 + + + admin + + 2015-09-10 09:47:47 +
+ 通知公告 + + 心理学院举办2015级研究生新生见面会既入学教育 + + + admin + + 2015-09-02 10:58:13 +
+ 通知公告 + + 我院赵晶晶博士获2015年国际精神疾病基因协会优秀青年科学研究者奖 + + + admin + + 2015-08-30 08:45:17 +
+ 通知公告 + + 我院李彩娜副教授实验团队研究成果被国际著名期刊录用 + + + admin + + 2015-08-30 08:29:31 +
+ 通知公告 + + 萧正洪副校长参加我院 “三严三实”专题研讨会 + + + admin + + 2015-07-15 14:54:19 +
+ 通知公告 + + 心理学院工作简报[总第2期] + + + admin + + 2015-07-09 11:55:28 +
+ 通知公告 + + 我院游旭群教授主持的教育部哲学社会科学重大课题攻关项目取得突破性成果 + + + admin + + 2015-07-09 09:15:42 +
+ 通知公告 + + 我院本科生党支部举行“三严三实”联系支部主题学习活动——人民日报“读报用报”学... + + + admin + + 2015-07-03 10:46:57 +
+ 通知公告 + + 我院全面落实处级干部联系基层制度 + + + admin + + 2015-07-03 10:40:27 +
+ 通知公告 + + 我院举行“三严三实”教育专题党课 + + + admin + + 2015-06-30 18:09:44 +
+ 通知公告 + + 我院青年教师陈煦海副教授研究组揭示跨通道情绪变化的整合加工机制 + + + admin + + 2015-06-29 11:43:34 +
+ 通知公告 + + 我院游旭群教授团队的研究成果被国际著名教师教育研究期刊录用 + + + admin + + 2015-06-26 10:06:24 +
+ 通知公告 + + 我院首位留学生顺利通过博士论文答辩并获得理学博士学位 + + + admin + + 2015-06-19 16:54:37 +
+ 通知公告 + + 2015年心理学院聘用第二批教学科研人员名单公示 + + + admin + + 2015-06-11 15:05:44 +
+ 通知公告 + + 我院青年师生学术沙龙第九期圆满结束 + + + admin + + 2015-06-10 08:58:51 +
+ 通知公告 + + 心理学院70年校庆系列学术活动之青年师生学术沙龙第九期 + + + admin + + 2015-06-03 16:16:03 +
+ 通知公告 + + 我院心理学大讲堂第73期学术报告圆满结束 + + + admin + + 2015-06-01 14:57:57 +
+ 通知公告 + + 密西根大学Cortina教授为我院师生做出国留学程序宣讲 + + + admin + + 2015-06-01 14:57:19 +
+ 通知公告 + + 萧正洪副校长莅临我院与我院师生代表座谈 + + + admin + + 2015-06-01 11:52:23 +
+ 通知公告 + + 我院心理学大讲堂第72期学术报告暨引进人才考核会议圆满结束 + + + admin + + 2015-06-01 11:33:17 +
+ 通知公告 + + 我院心理学大讲堂第71期学术报告圆满结束 + + + admin + + 2015-05-29 08:49:19 +
+ 通知公告 + + 我院青年师生学术沙龙第八期圆满举行 + + + admin + + 2015-05-28 10:33:44 +
+ 通知公告 + + 心理学大讲堂第73期学术报告预告 + + + admin + + 2015-05-26 08:16:31 +
+ 通知公告 + + 心理学大讲堂第72期学术报告预告 + + + admin + + 2015-05-26 08:15:46 +
+ 通知公告 + + “对分课堂”讲座及其研讨会 + + + admin + + 2015-05-25 15:13:42 +
+ 通知公告 + + “领导干部心理素质提升”专题培训班学员来我院参观座谈 + + + admin + + 2015-05-25 14:46:07 +
+ 通知公告 + + 我院举办第六届与美国密歇根大学交流活动 + + + admin + + 2015-05-22 11:04:49 +
+ 通知公告 + + 心理学院召开毕业生相关工作说明会 + + + admin + + 2015-05-21 14:24:35 +
+ 通知公告 + + 我院举办本科生就业工作推进会 + + + admin + + 2015-05-20 15:26:05 +
+ 通知公告 + + 中国航天员科研训练中心吴斌主任一行访问我院 + + + admin + + 2015-05-18 20:52:58 +
+ 通知公告 + + 2015年心理学院聘用教学科研人员名单公示 + + + admin + + 2015-05-18 16:42:25 +
+ 通知公告 + + 心理学大讲堂第71期学术报告预告 + + + admin + + 2015-05-18 10:33:57 +
+ 通知公告 + + 我院心理学大讲堂第70期学术报告圆满结束 + + + admin + + 2015-05-15 15:44:40 +
+ 通知公告 + + 心理学院工作简报[总第1期] + + + admin + + 2015-05-15 15:10:30 +
+ 通知公告 + + 心理学院70年校庆系列学术活动之青年师生学术沙龙第八期 + + + admin + + 2015-05-15 14:44:39 +
+ 通知公告 + + 我院荣获 “学院文化建设先进单位”称号 + + + admin + + 2015-05-14 16:56:51 +
+ 通知公告 + + 心理学大讲堂第70期学术报告预告 + + + admin + + 2015-05-12 09:32:15 +
+ 通知公告 + + 心理学院党员发展公示 + + + admin + + 2015-05-04 12:02:14 +
+ 通知公告 + + 心理学院党员发展公示 + + + admin + + 2015-05-04 12:02:14 +
+ 通知公告 + + 《心理科学》第六次主编扩大会议暨2014—2017届编委会第二次会议在我校召开 + + + admin + + 2015-04-30 15:16:02 +
+ 通知公告 + + 中科院心理所杨玉芳研究员做客我院第69期心理学大讲堂 + + + admin + + 2015-04-30 15:15:16 +
+ 通知公告 + + 我院心理学大讲堂第68期学术报告圆满结束 + + + admin + + 2015-04-30 15:14:22 +
+ 通知公告 + + 莫雷教授做客我院第66期心理学大讲堂 + + + admin + + 2015-04-30 15:10:16 +
+ 通知公告 + + 我院心理学大讲堂第65期学术报告圆满举行 + + + admin + + 2015-04-30 15:08:27 +
+ 通知公告 + + 我院青年师生学术沙龙第七期圆满举行 + + + admin + + 2015-04-29 11:21:55 +
+ 通知公告 + + 我院召开2015年第二次教学科研人员补充考察会议 + + + admin + + 2015-04-28 16:11:49 +
+ 通知公告 + + 校运会系列报道之三——努力创辉煌 + + + admin + + 2015-04-27 15:41:42 +
+ 通知公告 + + 校运会系列报道之二——团结共奋进 + + + admin + + 2015-04-27 15:34:24 +
+ 通知公告 + + 校运会系列报道之一——师生齐拼搏 + + + admin + + 2015-04-27 15:01:07 +
+ 通知公告 + + 我院举办“诚信是否吃亏”主题辩论会 + + + admin + + 2015-04-27 14:58:09 +
+ 通知公告 + + 心理学大讲堂第69期学术报告预告 + + + admin + + 2015-04-24 13:50:21 +
+ 通知公告 + + 心理学大讲堂第67期学术报告预告 + + + 成爱军 + + 2015-04-22 15:23:41 +
+ 通知公告 + + 齐心协力创比赛佳绩,团结拼搏展学子风采——记我院学子参加首届男子篮球联赛 + + + admin + + 2015-04-21 09:34:17 +
+ 通知公告 + + [推荐]我院2011级学生孙鑫被评为陕西师范大学“优秀学生标兵” + + + admin + + 2015-04-21 09:30:16 +
+ 通知公告 + + 心理学大讲堂第66期学术报告预告 + + + admin + + 2015-04-21 08:01:52 +
+ 通知公告 + + 心理学大讲堂第65期学术报告预告 + + + admin + + 2015-04-21 08:00:53 +
+ 通知公告 + + 我院举办未就业研究生座谈会 + + + admin + + 2015-04-16 08:47:18 +
+ 通知公告 + + 我院举办本科生培养方案修订座谈会 + + + admin + + 2015-04-14 11:35:52 +
+ 通知公告 + + 我院举办未就业本科毕业生帮扶会议 + + + admin + + 2015-04-10 15:09:00 +
+ 通知公告 + + 我院举办2015年运动会动员大会 + + + admin + + 2015-04-02 18:04:12 +
+ 通知公告 + + 心理学大讲堂第64期学术报告预告 + + + admin + + 2015-04-02 15:03:26 +
+ 通知公告 + + 我院心理学大讲堂第63期学术报告圆满举行 + + + admin + + 2015-03-30 15:43:34 +
+ 通知公告 + + 我院召开人才引进与师资补充考核会议 + + + admin + + 2015-03-27 13:31:13 +
+ 通知公告 + + 心理学大讲堂第63期学术报告预告 + + + admin + + 2015-03-24 09:26:48 +
+ 通知公告 + + 心理学院2015年上半年学位论文答辩工作安排 + + + admin + + 2015-03-19 11:01:35 +
+ 通知公告 + + 我院召开2015年工作部署会议 + + + admin + + 2015-03-19 10:25:54 +
+ 通知公告 + + 2015年心理学院硕士研究生复试工作安排 + + + admin + + 2015-03-17 15:06:38 +
+ 通知公告 + + 奕阳教育来我院招聘毕业生 + + + admin + + 2015-03-16 14:59:23 +
+ 通知公告 + + 心理学院2015年接收优秀生源硕士研究生调剂公告 + + + admin + + 2015-03-13 12:39:05 +
+ 通知公告 + + 心理学院2015年接收部分缺额专业硕士研究生调剂公告 + + + admin + + 2015-03-13 12:31:12 +
+ 通知公告 + + 心理学大讲堂第62期学术报告预告 + + + admin + + 2015-03-11 10:18:16 +
+ 通知公告 + + 关于我校2015届本科毕业生进行图像信息校对的通知 + + + admin + + 2015-03-09 10:50:21 +
+ 通知公告 + + 讣 告 + + + admin + + 2015-02-20 18:49:58 +
+ 通知公告 + + 我院召开2015年国家社科基金项目初评会议 + + + admin + + 2015-02-02 16:55:42 +
+ 通知公告 + + 陕西省心理学会第七次会员代表大会在我校召开 + + + admin + + 2015-02-02 16:32:44 +
+ 通知公告 + + 我院举办中学教师教育能力促进培训班圆满结束 + + + admin + + 2015-01-25 22:04:55 +
+ 通知公告 + + 我院召开二级教代会 + + + admin + + 2015-01-23 10:39:19 +
+ 通知公告 + + 我院召开处级干部民主生活会 + + + admin + + 2015-01-21 18:40:43 +
+ 通知公告 + + 心理学大讲堂第61期学术报告预告 + + + admin + + 2015-01-18 16:26:52 +
+ 通知公告 + + 萧正洪副校长一行来我院调研 + + + admin + + 2015-01-18 14:01:54 +
+ 通知公告 + + 我院召开2014-2015学年第一学期期末考试工作会议 + + + admin + + 2015-01-17 11:08:45 +
+ 通知公告 + + 心理学院2014年度教职工考核拟定优秀人员公示 + + + admin + + 2015-01-15 17:17:11 +
+ 通知公告 + + 心理学院关于2014年度教职工考核工作的安排意见 + + + admin + + 2015-01-09 17:01:08 +
+ 通知公告 + + 心理学院2014年在职联考教育硕士复试工作安排 + + + admin + + 2015-01-05 11:41:42 +
+ 通知公告 + + 郑州幼儿师范高等专科学校公开招聘心理健康教育教师 + + + admin + + 2015-01-05 11:15:09 +
+ 通知公告 + + 党委副书记王涛为心理学院教职工做“新时期意识形态建设与挑战”专题报告 + + + admin + + 2014-12-26 08:49:03 +
+ 通知公告 + + 转发:国有资产管理处“关于我校调整公积金的说明” + + + admin + + 2014-12-16 16:48:13 +
+ 通知公告 + + 火样的热情 飞扬的青春——我院学子参加纪念“12.9”运动暨“阳光体育”半程马... + + + admin + + 2014-12-11 11:13:06 +
+ 通知公告 + + 长江大学外国语学院来我院招聘毕业生 + + + admin + + 2014-12-04 11:56:26 +
+ 通知公告 + + 我院70周年校庆系列学术活动之名家讲坛(十)暨心理学大讲堂第60期学术报告圆满... + + + 成爱军 + + 2014-12-02 10:09:18 +
+ 通知公告 + + 我院70周年校庆系列学术活动之青年师生学术沙龙第六期圆满举行 + + + admin + + 2014-12-01 14:46:57 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之青年师生学术沙龙第六期预告 + + + admin + + 2014-11-27 11:08:57 +
+ 通知公告 + + 苏宁云商1200营销管理培训生招聘简章 + + + admin + + 2014-11-25 14:48:27 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之名家讲坛(十)暨心理学大讲堂第60期 + + + 成爱军 + + 2014-11-24 09:59:13 +
+ 通知公告 + + 我院70周年校庆系列学术活动之青年师生第五期学术沙龙圆满举行 + + + admin + + 2014-11-14 19:36:24 +
+ 通知公告 + + 就业信息发布:陕西省房地产研究会招聘简介 + + + admin + + 2014-11-13 09:21:23 +
+ 通知公告 + + 我院召开校内收入分配制度调整通报会议 + + + admin + + 2014-11-12 11:36:38 +
+ 通知公告 + + 再勉学路,启立职场——心理学院2012级本科生学风建设系列活动之一保研考研交流会 + + + admin + + 2014-11-11 15:49:35 +
+ 通知公告 + + “时代心理”来我院招聘毕业生 + + + admin + + 2014-11-11 09:47:57 +
+ 通知公告 + + 改变自我 创造未来——心理学院2012级本科生学风建设主题班会 + + + admin + + 2014-11-07 14:50:03 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之校友讲坛(五)暨心理学大讲堂第59期学术报告... + + + admin + + 2014-11-07 11:37:56 +
+ 通知公告 + + 时代心理2014招聘计划 + + + admin + + 2014-11-07 10:52:27 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之青年师生学术沙龙第五期预告 + + + admin + + 2014-11-06 15:41:50 +
+ 通知公告 + + 陕西省科技厅副书记张书玲一行到心理学院进行立项考察 + + + admin + + 2014-11-03 15:47:12 +
+ 通知公告 + + 心理学院召开学生党支部委员业务知识培训会议 + + + admin + + 2014-10-31 09:46:01 +
+ 通知公告 + + 我院举办2015届本科毕业生实习总结暨就业动员大会 + + + admin + + 2014-10-30 18:39:10 +
+ 通知公告 + + 理学院70周年校庆系列学术活动之校友讲坛(五)暨心理学大讲堂第59期学术报告预告 + + + admin + + 2014-10-29 16:52:16 +
+ 通知公告 + + 心理学院2014年拟晋升专业技术职务人员申报材料公示 + + + admin + + 2014-10-28 15:22:10 +
+ 通知公告 + + 心理学院举办2015届研究生毕业生就业动员大会 + + + admin + + 2014-10-28 10:37:24 +
+ 通知公告 + + 我院70周年校庆系列学术活动之名家讲坛(九)暨心理学大讲堂第58期学术报告圆满... + + + admin + + 2014-10-27 17:32:50 +
+ 通知公告 + + 我院70周年校庆系列学术活动之青年师生第四期学术沙龙圆满举行 + + + admin + + 2014-10-27 17:30:22 +
+ 通知公告 + + 我院召开学生会成立暨工作方法研讨会 + + + admin + + 2014-10-24 15:41:16 +
+ 通知公告 + + 关于派普(PEP)被试中心运营的通知 + + + admin + + 2014-10-23 17:10:33 +
+ 通知公告 + + 关于派普(PEP)被试中心运营的通知 + + + admin + + 2014-10-23 17:10:33 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之校友讲坛(四)暨第57期心理学大讲堂学术报告... + + + admin + + 2014-10-22 11:57:01 +
+ 通知公告 + + 心理学院2015年招收“申请-审核”制博士研究生办法 + + + admin + + 2014-10-22 11:51:34 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之名家讲坛(九)暨心理学大讲堂第58期学术报告... + + + admin + + 2014-10-20 15:29:37 +
+ 通知公告 + + 我院师生积极参加中国心理学会第十七届全国心理学学术大会 + + + admin + + 2014-10-20 11:43:17 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之名家讲坛(八)暨第56期心理学大讲堂圆满成功 + + + admin + + 2014-10-20 09:37:08 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之校友讲坛(四)暨心理学大讲堂第57期学术报告... + + + admin + + 2014-10-19 16:10:07 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之青年师生学术沙龙第四期预告 + + + admin + + 2014-10-16 15:59:46 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之名家讲坛(八)暨心理学大讲堂第56期学术报告... + + + admin + + 2014-10-15 15:35:14 +
+ 通知公告 + + [图文]我院游旭群教授当选中国心理学会理事长 + + + admin + + 2014-10-15 09:04:12 +
+ 通知公告 + + 我院举行庆祝建校七十周年学院与学科发展座谈会 + + + admin + + 2014-10-14 11:06:31 +
+ 通知公告 + + 心理学院关于评定2013级、2012级研究生厚德奖学金的通知 + + + admin + + 2014-09-28 15:29:49 +
+ 通知公告 + + 心理学院关于评定2013级、2012级研究生厚德奖学金的通知 + + + admin + + 2014-09-28 15:29:49 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之名家讲坛(七)暨心理学大讲堂第55期学术报告... + + + admin + + 2014-09-25 18:07:50 +
+ 通知公告 + + 我院70周年校庆系列学术活动之青年师生第三期学术沙龙圆满举行 + + + admin + + 2014-09-25 17:42:28 +
+ 通知公告 + + 我院举行70周年校庆系列学术活动之名家讲坛(六)暨心理学大讲堂第54期学术报告... + + + admin + + 2014-09-25 16:10:42 +
+ 通知公告 + + 我院举行70周年校庆系列学术活动之名家讲坛(五)暨心理学大讲堂第53期学术报告 + + + admin + + 2014-09-25 11:48:40 +
+ 通知公告 + + 国家能源新材料技术研发中心中物功能材料研究院有限公司董事长一行访问心理学院 + + + admin + + 2014-09-22 11:14:34 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之名家讲坛(七)暨心理学大讲堂第55期学术报告... + + + admin + + 2014-09-21 09:53:32 +
+ 通知公告 + + 心理学院70年校庆系列学术活动之青年师生学术沙龙第三期预告 + + + admin + + 2014-09-21 09:51:42 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之名家讲坛(六)暨心理学大讲堂第54期学术报告... + + + admin + + 2014-09-18 14:31:12 +
+ 通知公告 + + 我院举行70周年校庆系列学术活动之校友讲坛(三)暨心理学大讲堂第52期学术报告 + + + admin + + 2014-09-18 11:06:41 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之名家讲坛(五)暨心理学大讲堂第53期学术报告... + + + admin + + 2014-09-17 09:54:31 +
+ 通知公告 + + 我院2012级应用心理班召开班委换届主题班会 + + + admin + + 2014-09-16 11:39:21 +
+ 通知公告 + + 我院召开2014-2015学年第一学期工作部署会议 + + + admin + + 2014-09-16 07:58:09 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之校友讲坛(三)暨心理学大讲堂第52期学术报告... + + + admin + + 2014-09-15 14:27:56 +
+ 通知公告 + + 我院召开2014级研究生迎新大会 + + + admin + + 2014-09-15 11:45:51 +
+ 通知公告 + + 我院召开2015年本科生推免工作动员会 + + + admin + + 2014-09-09 17:44:34 +
+ 通知公告 + + 2014年我院暑期学校课程教学圆满结束 + + + admin + + 2014-07-22 15:41:36 +
+ 通知公告 + + 我院举行70周年校庆系列学术活动之名家讲坛(四)暨心理学大讲堂第51期学术报告 + + + admin + + 2014-07-08 17:37:28 +
+ 通知公告 + + 我院举行70年校庆系列学术活动之第二期青年师生学术沙龙 + + + admin + + 2014-07-08 17:33:22 +
+ 通知公告 + + 我院举行70周年校庆系列学术活动之青年师生学术沙龙第一期预告 + + + admin + + 2014-07-08 17:31:17 +
+ 通知公告 + + 我院基层党建工作取得可喜成绩 + + + admin + + 2014-07-01 17:33:24 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之名家讲坛(四)暨心理学大讲堂第51期学术报告... + + + admin + + 2014-06-30 08:34:15 +
+ 通知公告 + + 有梦,就能梦成真 + + + admin + + 2014-06-26 17:30:12 +
+ 通知公告 + + 我院举行70周年校庆系列学术活动之校友讲坛(二)暨心理学大讲堂第50期学术报告 + + + admin + + 2014-06-23 08:21:38 +
+ 通知公告 + + 我院举行70周年校庆系列学术活动之校友讲坛(一)暨心理学大讲堂第49期学术报告 + + + admin + + 2014-06-20 10:27:19 +
+ 通知公告 + + 我院举行70周年校庆系列学术活动之教授讲坛(二) 暨心理学大讲堂第48期学术报告 + + + admin + + 2014-06-19 10:11:49 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之校友讲坛(二)暨心理学大讲堂第50期学术报告... + + + admin + + 2014-06-17 08:28:22 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之校友讲坛(一)暨心理学大讲堂第49期学术报告... + + + admin + + 2014-06-16 18:01:02 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之教授讲坛(二)暨心理学大讲堂第48期学术报告... + + + admin + + 2014-06-16 14:53:04 +
+ 通知公告 + + 程光旭校长一行莅临我院调研与指导工作 + + + admin + + 2014-06-15 16:14:18 +
+ 通知公告 + + 学院举行70周年校庆系列学术活动之教授讲坛(一)暨心理学大讲堂第47期学术报告 + + + admin + + 2014-06-12 16:54:55 +
+ 通知公告 + + 我院博士、硕士研究生学位毕业论文答辩圆满结束 + + + admin + + 2014-06-12 16:49:30 +
+ 通知公告 + + 我院举行70周年校庆之本科教学学术交流活动 + + + admin + + 2014-06-11 20:15:42 +
+ 通知公告 + + 心理学院70周年校庆之本科教学学术交流活动预告 + + + admin + + 2014-06-09 16:53:53 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之教授讲坛(一)暨心理学大讲堂第47期学术报告... + + + admin + + 2014-06-09 11:06:21 +
+ 通知公告 + + 我院举办2011级本科生考研就业经验交流会 + + + admin + + 2014-06-09 09:18:32 +
+ 通知公告 + + 心理学院70周年校庆系列学术活动之青年师生学术沙龙第一期预告 + + + admin + + 2014-06-05 08:33:19 +
+ 通知公告 + + 七十周年校庆心理学院系列学术活动开幕式隆重举行 + + + admin + + 2014-05-30 16:50:09 +
+ 通知公告 + + 2014年拟录取博士研究生办理相关手续注意事项 + + + admin + + 2014-05-27 16:35:39 +
+ 通知公告 + + 我校教育学院师生参观我院心理学实验室 + + + admin + + 2014-05-27 10:34:48 +
+ 通知公告 + + 陕西师范大学七十周年校庆心理学院系列学术活动安排 + + + admin + + 2014-05-20 08:40:41 +
+ 通知公告 + + 美国密西根大学Miller教授为我院本科生讲授 “教育心理学” + + + admin + + 2014-05-19 10:44:50 +
+ 通知公告 + + 美国密西根大学师生交流访问活动通知 + + + admin + + 2014-05-13 10:21:02 +
+ 通知公告 + + 我院召开诚信教育主题班会 + + + admin + + 2014-05-08 15:47:35 +
+ 通知公告 + + 心理学院党员发展公示 + + + admin + + 2014-05-08 15:45:29 +
+ 通知公告 + + 心理学院党员发展公示 + + + admin + + 2014-05-08 15:45:29 +
+ 通知公告 + + 杜鹏教授做客第43期心理学大讲堂 + + + admin + + 2014-04-30 10:45:32 +
+ 通知公告 + + 数据处理中心试运营的通知 + + + admin + + 2014-04-28 17:29:27 +
+ 通知公告 + + 数据处理中心试运营的通知 + + + admin + + 2014-04-28 17:29:27 +
+ 通知公告 + + 心理学大讲堂第43期学术报告预告 + + + admin + + 2014-04-25 15:51:07 +
+ 通知公告 + + 我院王勇慧教授及博士生赵亮赴欧洲进行学术交流 + + + admin + + 2014-04-22 11:50:15 +
+ 通知公告 + + 我院教职员工积极参加学校春季运动会 + + + admin + + 2014-04-21 10:58:57 +
+ 通知公告 + + 心理学院研究生国家奖学金评选程序及评选细则 + + + admin + + 2014-04-14 15:17:38 +
+ 通知公告 + + 心理学院研究生奖学金评选实施办法 + + + admin + + 2014-04-14 15:14:40 +
+ 通知公告 + + 西安市第三中学来我院招聘毕业生 + + + admin + + 2014-04-11 14:58:53 +
+ 通知公告 + + 心理学院2014年师资补充答辩会预告 + + + admin + + 2014-04-10 08:19:02 +
+ 通知公告 + + 2014年教育实验经济研究所硕士研究生复试 + + + admin + + 2014-04-02 08:16:31 +
+ 通知公告 + + 教育实验经济研究所2014年硕士研究生调剂信息 + + + admin + + 2014-04-02 08:08:31 +
+ 通知公告 + + 心理学院2014年接收优秀调剂硕士研究生公告 + + + admin + + 2014-04-01 16:03:26 +
+ 通知公告 + + 心理学院2014年接收普通调剂硕士研究生公告 + + + admin + + 2014-04-01 15:59:00 +
+ 通知公告 + + 余嘉元教授作客第42期心理学大讲堂 + + + admin + + 2014-04-01 15:42:05 +
+ 通知公告 + + 我院召开党的群众路线教育实践活动总结大会 + + + admin + + 2014-03-25 09:06:06 +
+ 通知公告 + + 心理学大讲堂第42期学术报告预告 + + + admin + + 2014-03-21 08:06:38 +
+ 通知公告 + + 心理学院2014年教师岗位招聘公告 + + + admin + + 2014-03-11 16:24:47 +
+ 通知公告 + + 关于派普(PEP)被试中心公开运营的通知 + + + admin + + 2014-02-27 09:35:53 +
+ 通知公告 + + 关于派普(PEP)被试中心公开运营的通知 + + + admin + + 2014-02-27 09:35:53 +
+ 通知公告 + + 我院2014年工作部署会议召开 + + + admin + + 2014-02-24 11:17:13 +
+ 通知公告 + + 心理学院2013-2014学年第二学期研究生各类奖学金评选通知 + + + admin + + 2014-02-21 11:33:12 +
+ 通知公告 + + 心理学院2013-2014学年第二学期研究生各类奖学金评选通知 + + + admin + + 2014-02-21 11:33:12 +
+ 通知公告 + + 校党委书记甘晖一行到我院检查、调研开学各项工作运行情况 + + + admin + + 2014-02-18 11:24:30 +
+ 通知公告 + + 我院王振宏教授团队的研究成果被国际顶级心理学期刊录用 + + + admin + + 2014-02-16 21:21:01 +
+ 通知公告 + + 我院举行国家自然科学基金、国家社会科学基金项目申报交流研讨会 + + + admin + + 2014-02-09 10:58:06 +
+ 通知公告 + + 游旭群教授主持的教育部哲学社会科学重大招标课题研究进展研讨会如期举行 + + + admin + + 2014-01-24 10:54:16 +
+ 通知公告 + + 我院游旭群教授被聘为《心理学报》副主编 + + + admin + + 2014-01-22 18:05:58 +
+ 通知公告 + + 心理学大讲堂第41期学术报告圆满结束 + + + admin + + 2014-01-13 08:55:27 +
+ 通知公告 + + 心理学大讲堂第41期学术报告预告 + + + admin + + 2014-01-07 15:40:22 +
+ 通知公告 + + 2014年博士生招生“申请-审核”制工作方案 + + + admin + + 2014-01-07 11:32:23 +
+
+ + +
+ + + + + + + + + +
+
+ + + diff --git a/test/html/snnu_se_news.html b/test/html/snnu_se_news.html new file mode 100644 index 0000000..33d9ff8 --- /dev/null +++ b/test/html/snnu_se_news.html @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + +  + + 陕西师范大学教育学院-陕西师范大学教育学院 + + + + + + + + +
+
+ + + + + + +
+
+
+ + 新闻动态
+
+ 您现在所在的位置:首页 > 学院新闻 +
+
+
+ + +
+ +
总共5页 当前第
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/test/html/snnu_se_notice.html b/test/html/snnu_se_notice.html new file mode 100644 index 0000000..bb43732 --- /dev/null +++ b/test/html/snnu_se_notice.html @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + +  + + 陕西师范大学教育学院-陕西师范大学教育学院 + + + + + + + + +
+
+ + + + + + +
+
+
+ + 新闻动态
+
+ 您现在所在的位置:首页 > 通知公告 +
+
+
+ + +
+ +
总共7页 当前第
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/test/html/snnu_spg_news.html b/test/html/snnu_spg_news.html new file mode 100644 index 0000000..cbe20a3 --- /dev/null +++ b/test/html/snnu_spg_news.html @@ -0,0 +1,646 @@ + + + + + + +ѧԺ-ʦѧѧѧԺ,վ֧֣ + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + +
+ +
+
+ +
+ + + + +
+ + + + + +
+ +
+ + + + + +
+ + + + + +
+ + + +
+ +
+ + + + + +
+ + + + + + + +
+ +
+ + + + +
+ + + + + + +
+ + + + + + + + +
+ + + ѧԺ
+ + + + + + + + +
+ + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
ѧԺλãҳ > ѧԺ
+
+ + + + + + +
+ + + + +
+ + + + + + + + +
Ժ2018ֿչϰ2018-12-19
+ + + + + + + +
Ժ֯ʦۿѧϰףĸ↑402018-12-18
+ + + + + + + +
ԺϵΡְ֧˹˳2018-12-17
+ + + + + + + +
Ժơѻдѧְ㽱2018-12-17
+ + + + + + + +
Ժ2018оѧѧ2018-12-17
+ + + + + + + +
Ժٿ2018о̸2018-12-17
+ + + + + + + +
ְӢ ĪУ칫Աȫģ⿼ԴԲĻ2018-12-15
+ + + + + + + +
Ժѧϵ2017о繤˳2018-12-14
+ + + + + + + +
ϽҫԺ12·9˶ɽ2018-12-13
+ + + + + + + +
Ժٿ2019ҵҵƽ2018-12-13
+ + + + + + + +
ԬΪ۲Աμ㲥̨ʱ̡2018-12-10
+ + + + + + + +
ʡѧᷨĻо2018ߡʱйɫ巨ĻɫĻСѧֻɹ2018-12-08
+ + + + + + + +
Ժѧϵչҡܷܡ2018-12-07
+ + + + + + + +
Ժ2019쿼ѧο̸2018-12-07
+ + + + + + + +
Ժίȫᾫѧϰ2018-12-07
+ + + + + + + +
Ժѧϵչ2018-12-07
+ + + + + + + +
ƪϵʦδ Ժ2018оĿѧһ족2018-12-05
+ + + + + + + +
ѧӻμУϰ䡱ϵл2018-12-05
+ + + + + + + +
ԺСҹ2018-12-05
+ + + + + + + +
ʱഺáԺ2018оչջ2018-12-05
+ + + + + + + +
ѧϰ᳹ȫᾫ һѧԺԺٿίѧϰ󣩻2018-12-03
+ + + + + + + +
ܽع ̡Ժ2017ٿΰŽ蹤2018-12-03
+ + + + + + + +
ѧϵ֯ʦʡ߼ԺĦͥ2018-11-30
+ + + + + + + +
ҵĴѧһ족Ժ2018չϵ2018-11-30
+ + + + + + + +
Ժѧٻ2018-11-29
+ + + + + +
+ + + + +
+
 49ҳ ҳ 
+
+ +
+
+
+ +
+
+ + + + + +
+ + + + +
+ + + + +
Design & Support ֧֣
+
+ + + \ No newline at end of file diff --git a/test/html/snnu_spg_notice.html b/test/html/snnu_spg_notice.html new file mode 100644 index 0000000..7ba7fd9 --- /dev/null +++ b/test/html/snnu_spg_notice.html @@ -0,0 +1,646 @@ + + + + + + +֪ͨ-ʦѧѧѧԺ,վ֧֣ + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + +
+ +
+
+ +
+ + + + +
+ + + + + +
+ +
+ + + + + +
+ + + + + +
+ + + +
+ +
+ + + + + +
+ + + + + + + +
+ +
+ + + + +
+ + + + + + +
+ + + + + + + + +
+ + + ֪ͨ
+ + + + + + + + +
+ + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
֪ͨλãҳ > ֪ͨ
+
+ + + + + + +
+ + + + +
+ + + + + + + + +
[Ƽ]ѧѧԺڶ조ۡѧ֮ѧ12ڣѧҾڹ͵ķʶܵġѧڹΪ ˣ2018-12-24
+ + + + + + + +
[Ƽ]ѧѧԺڶ조ۡѧ֮ѧ11ڣѧѧϵоĹ۲뷴˼ ˣӰ2018-12-24
+ + + + + + + +
[Ƽ]ʦѧɳ20187ڣеġʧ黰 ˣ֣2018-12-24
+ + + + + + + +
[Ƽ]ѧѧԺڶ조ۡѧ̳֮203ڣҹչеļì ˣ쾰2018-12-20
+ + + + + + + +
[Ƽ]ѧѧԺڶ조ۡѧ֮ѧ10ڣȻû漣𣿡Ȼ漣ļ ˣ2018-12-19
+ + + + + + + +
֯տףĸ↑40֪ͨ2018-12-17
+ + + + + + + +
Ժ2018оѧѧѡĹʾ2018-12-11
+ + + + + + + +
У조ְӢ ĪԱȫģ⿼Դŵ֪ͨ2018-12-11
+ + + + + + + +
[Ƽ]ѧѧԺڶ조ۡѧ̳֮202ڣ϶׼͹˲ƶ ˣ2018-12-07
+ + + + + + + +
[Ƽ]ѧѧԺڶ조ۡѧ̳֮201ڣ˷Ľ ˣ2018-12-07
+ + + + + + + +
[Ƽ]ѧѧԺڶ조ۡѧ̳֮200ڣִıѧ䳬Խ ˣ2018-12-06
+ + + + + + + +
[Ƽ]ʦѧɳ20185ڣҹʲȫķɱ ˣ԰2018-12-05
+ + + + + + + +
[Ƽ]ʦѧɳ20186ڣְ缰ЧӦȽо ˣФ2018-11-30
+ + + + + + + +
ڿչȫᾫѧϰ֪ͨ2018-11-30
+ + + + + + + +
ѧѧԺڶ조ۡѧ¡Իѧʷоѧ2018-11-29
+ + + + + + + +
[Ƽ]ѧѧԺڶ조ۡѧ̳֮199ڣʱĵ۹ ˣν2018-11-28
+ + + + + + + +
[Ƽ]ѧѧԺڶ조ۡѧ֮ѧ9ڣִѧеĹ ˣ2018-11-28
+ + + + + + + +
[Ƽ]ѧѧԺڶ조ۡѧ̳֮198ڣʵѧеĵ¹ ˣ2018-11-28
+ + + + + + + +
[Ƽ]ѧѧԺڶ조ۡѧ֮ѧ82018-11-28
+ + + + + + + +
ڸϵ칫/֧õ֪ͨ2018-11-27
+ + + + + + + +
[Ƽ]ʦѧɳ20184ڣṹϸתͣйũزȨƶȱǨ߼ ˣΰ2018-11-26
+ + + + + + + +
[Ƽ]ʦѧɳ20183ڣ˾ʵн蹤̼ۿܳȨΪЧ϶ ˣ2018-11-25
+ + + + + + + +
ڿչѧѧԺ2019ӭﱸ֪ͨ2018-11-21
+ + + + + + + +
У조ְӢ ĪԱģ⿼Դŵ֪ͨ2018-11-21
+ + + + + + + +
ѧѧԺ2019ӭ⣨ƪ£֪ͨ2018-11-21
+ + + + + +
+ + + + +
+
 24ҳ ҳ 
+
+ +
+
+
+ +
+
+ + + + + +
+ + + + +
+ + + + +
Design & Support ֧֣
+
+ + + \ No newline at end of file diff --git a/test/html/snnu_spgcx_news.html b/test/html/snnu_spgcx_news.html new file mode 100644 index 0000000..5b4385a --- /dev/null +++ b/test/html/snnu_spgcx_news.html @@ -0,0 +1,484 @@ + + +学院新闻-陕西师范大学食品学院 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ +
+ +
+ + +
+ + + +
+
+ +
+
+

学院新闻

+
+
+ + +
+ +
+
共557条  1/38 
首页上页  
+
+
+
+
+
+
+ + + + + + + diff --git a/test/html/snnu_spgcx_notice.html b/test/html/snnu_spgcx_notice.html new file mode 100644 index 0000000..81496f7 --- /dev/null +++ b/test/html/snnu_spgcx_notice.html @@ -0,0 +1,484 @@ + + +通知公告-陕西师范大学食品学院 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ +
+ +
+ + +
+ + + +
+
+ +
+
+

通知公告

+
+
+ + +
+ +
+
共259条  1/18 
首页上页  
+
+
+
+
+
+
+ + + + + + + diff --git a/test/html/snnu_tyxy_news.html b/test/html/snnu_tyxy_news.html new file mode 100644 index 0000000..79a7521 --- /dev/null +++ b/test/html/snnu_tyxy_news.html @@ -0,0 +1,753 @@ + + + + + + + + + + +ѧԺ-ʦѧѧԺ,վ֧֣ + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + +
+
+ + + + + + +
+
+
+ +
+ + + + +
+ + + + + +
+ + + + + +
+ +
+ + +
+
+ + + + + + + +
+ + + + + + +
+ + + + + + + + +
+ + + ѧԺ
+ + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + +
ҳ > ѧԺ > ѧԺ
+ ѧԺ +
+ + + + + + +
2018-12-21 /    +ѧԺٿ2018ȵ֧ץְ鿼˴ +
+ + + + + +
2018-12-20 /    +ѧѧԺ2017뿪չѧҵʾѧ һһ԰רж +
+ + + + + +
2018-12-19 /    +ѧԺѧչĦʱͬСףĸ↑40ʦѧѧɹչջ +
+ + + + + +
2018-12-18 /    +ĸ↑ʱԺʦܽ +
+ + + + + +
2018-12-14 /    +ѧԺٿ2019챾Ʊҵҵ̸ +
+ + + + + +
2018-12-14 /    +ʦѧѧԺʦƸ +
+ + + + + +
2018-12-14 /    +ѧdzɡѧԺٰڽ +
+ + + + + +
2018-12-14 /    +ѧԺн̸̹֧ +
+ + + + + +
2018-12-13 /    +ѧѧԺ2017ļģ⿼ +
+ + + + + +
2018-12-10 /    +ѧѧԺٿ2017ί +
+ + + + + +
2018-12-08 /    +ѧԺٿ2019칫ʦҵٽ +
+ + + + + +
2018-12-04 /    +ԺλʦѡйѧѧӰѧ +
+ + + + + +
2018-12-03 /    +Ժٰ׽˶ʿƽѧʵϰؽ̸ +
+ + + + + +
2018-12-01 /    +2018ѧԺоѧ̳ɹٰ +
+ + + + + +
2018-11-23 /    +Ժ2016ѧμӡ119רҽ +
+ + + + + +
2018-11-22 /    +Ժٿоѧλijרѧϰ +
+ + + + + +
2018-11-22 /    +У2018оӭ±߱ĻʽԲ +
+ + + + + +
2018-11-22 /    +ѧһ֧ٿ֧ +
+ + + + + +
2018-11-15 /    +ѧԺ36뵳ӵѵ˳ +
+ + + + + +
2018-11-15 /    +Dale A. Ulrichڱ潻˳ +
+ + + + + +
2018-11-14 /    +ѧԺ2019챾ʦרҵҵҵԱ +
+ + + + + +
2018-11-14 /    +ѧԺѶʡУ· ѧѵϳʵ +
+ + + + + +
2018-11-13 /    +ѧԺ2018걾ʴ +
+ + + + + +
2018-11-10 /    +ѧͬ۹·һ·|ѧԺ˳չ +
+ + + + + +
2018-11-10 /    +ѧѧԺٿ2017೤ +
+ + + + + +
+ + + + +
+ +
+ + + + + + + + + + + + +
ҳһҳһҳĩҳ     [ 17 ] ҳ   ǵ [ 1 ] ҳ   + ת + ҳ +
+
+ + +
+ +
+ +
+
+ + + + + +
+ + + + +
+ + + + +
Design & Support ֧֣
+
+ + + \ No newline at end of file diff --git a/test/html/snnu_tyxy_notice.html b/test/html/snnu_tyxy_notice.html new file mode 100644 index 0000000..cf5ebab --- /dev/null +++ b/test/html/snnu_tyxy_notice.html @@ -0,0 +1,735 @@ + + + + + + + + + + +֪ͨ-ʦѧѧԺ,վ֧֣ + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + +
+
+ + + + + + +
+
+
+ +
+ + + + +
+ + + + + +
+ + + + + +
+ +
+ + +
+
+ + + + + + + +
+ + + + + + +
+ + + + + + + + +
+ + + ֪ͨ
+ + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + +
ҳ > ֪ͨ > ֪ͨ
+ ֪ͨ +
+ + + + + + +
2018-12-14 /    +ڡԴѧƼĹʾ +
+ + + + + +
2018-12-14 /    +ʦѧѧԺʦƸ +
+ + + + + +
2018-12-12 /    +Ժ2018оѧѧѡĹʾ +
+ + + + + +
2018-12-08 /    +ѧԺʴ겹֪ͨ +
+ + + + + +
2018-12-05 /    +Ժ2018оѧѧѡ취Ĺʾ +
+ + + + + +
2018-11-18 /    +2018ѧԺμְԱزϵĹʾ +
+ + + + + +
2018-10-26 /    +ڲμʡӶμѵ֪ͨ +
+ + + + + +
2018-10-23 /    +ٿȫԺְ֪ͨ +
+ + + + + +
2018-10-17 /    +Ժ2018оҽѧѡĹʾ +
+ + + + + +
2018-10-09 /    +ڶ2018רҵְְʸ׵֪ͨ +
+ + + + + +
2018-09-26 /    +2018ѧԺڡֵలű +
+ + + + + +
2018-09-18 /    +2018ѧԺֵల +
+ + + + + +
2018-09-14 /    +ѧԺ-2018°о2018-2019ѧ^α +
+ + + + + +
2018-09-14 /    +ѧԺ2019ƼӦ챾ƱҵԹ˶ʿѧλоʾ +
+ + + + + +
2018-09-07 /    +ڿչѡγ̵֪ͨת֪ͨ +
+ + + + + +
2018-09-07 /    +ӡ2018-2019ѧ^ѧСα֪ͨת֪ͨ +
+ + + + + +
2018-09-07 /    +֯ڶ조ѧɾͽѧͻ׽ѡ֪ͨת֪ͨ +
+ + + + + +
2018-09-07 /    +֯ڶ조ѧŶӽѡ֪ͨת֪ͨ +
+ + + + + +
2018-08-31 /    +ٿѧԺѧڹ֪ͨ +
+ + + + + +
2018-08-18 /    +ʦѧѧԺʦƸ棨 +
+ + + + + +
2018-07-30 /    +2018ѧԺֵ +
+ + + + + +
2018-07-22 /    +ڵһȫߵʦԺУѧëʾ֪ͨ +
+ + + + + +
2018-07-17 /    +ʦѧ齨ʡӣU20 +
+ + + + + +
2018-07-13 /    +ʦѧѧԺƸʦƸ +
+ + + + + +
2018-07-11 /    +Ƽ׽조ʦѧ˽ʦѡĹʾ +
+ + + + + +
+ + + + +
+ +
+ + + + + + + + + + + + +
ҳһҳһҳĩҳ     [ 8 ] ҳ   ǵ [ 1 ] ҳ   + ת + ҳ +
+
+ + +
+ +
+ +
+
+ + + + + +
+ + + + +
+ + + + +
Design & Support ֧֣
+
+ + + \ No newline at end of file diff --git a/test/html/snnu_wuli_news.html b/test/html/snnu_wuli_news.html new file mode 100644 index 0000000..8a4cc60 --- /dev/null +++ b/test/html/snnu_wuli_news.html @@ -0,0 +1,344 @@ + + + + + + 陕西师范大学物理学与信息技术学院-学院新闻 + + + + + + + + + +
+ +
+ + +
+
+ 您的当前位置:首页 + > 学院新闻 +
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ + + +
+
+
+
+
+ 版权所有:陕西师范大学物理学与信息技术学院|地址:陕西师范大学长安校区致知楼|邮编:710119|电话:029-81530750|Email:wlbg@snnu.edu.cn +
+
+ copyright © 2013 wuli.snnu.edu.cn Inc. + All right Reserved. +
+
+ + + + +
+ +
+
+
+ + diff --git a/test/html/snnu_wuli_notice.html b/test/html/snnu_wuli_notice.html new file mode 100644 index 0000000..dc007fc --- /dev/null +++ b/test/html/snnu_wuli_notice.html @@ -0,0 +1,344 @@ + + + + + + 陕西师范大学物理学与信息技术学院-通知公告 + + + + + + + + + +
+ +
+ + +
+
+ 您的当前位置:首页 + > 通知公告 +
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ + + +
+
+
+
+
+ 版权所有:陕西师范大学物理学与信息技术学院|地址:陕西师范大学长安校区致知楼|邮编:710119|电话:029-81530750|Email:wlbg@snnu.edu.cn +
+
+ copyright © 2013 wuli.snnu.edu.cn Inc. + All right Reserved. +
+
+ + + + +
+ +
+
+
+ + diff --git a/test/html/snnu_wyxy_news.html b/test/html/snnu_wyxy_news.html new file mode 100644 index 0000000..84ad345 --- /dev/null +++ b/test/html/snnu_wyxy_news.html @@ -0,0 +1,296 @@ + + + + +院内新闻-外国语学院网站 + + + + + + + + + + + + + +
+
+ +
+
+ +
+ + + + + + + + + +院内新闻 + + + + +
+ +
 
+
    +
  • +
  • +
  • +
  • +
+ + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + +
+
+
+ 院内新闻 + 您所在的位置: + + +首页 +> + + + +院内新闻 + +> + +
+
+
  • +《中国社会科学报》专版介绍我校国别与区域研究新进展2018-12-19
  • + + +
  • +外国语学院举办2018年外籍教师座谈会2018-12-21
  • + + +
  • +我院开展本科新生入学教育第七场报告会2018-12-14
  • + + +
  • +我校2018年外语活动月成功落下帷幕2018-12-12
  • + + +
  • +我院四位学生在“师范院校英语专业学生教学素质风采展示活动”中取得佳绩2018-12-12
  • + + +
  • +我院开展学生冬季心理排查及宿舍走访2018-12-06
  • + + +
  • +唯实求新,青春激昂2018-12-03
  • + + +
  • +呼和浩特民族学院外语系肖查娜主任一行来我院交流2018-11-29
  • + + +
  • +我校荣获“华北华中区优秀UKVI雅思考点”称号2018-11-29
  • + + +
  • +“博学术经纬,议思想纵横”2018-11-28
  • + + +
  • +西北农林科技大学外语系来我院调研2018-11-23
  • + + +
  • +厦门大学外文学院来我院调研2018-11-22
  • + + +
  • +优秀校友系列之:1983届杨晓云2018-11-19
  • + + +
  • +外国语学院白靖宇教授受邀在我校外语活动月之学术论坛作专题报告2018-11-18
  • + + +
  • +张韧教授受邀参加全国首届认知语法专题论坛2018-11-14
  • + + +
    +
    +
    共210条  1/14 
    上页123456..14
    +
    +
    +
+
+
+
+
+
+
+ + + + diff --git a/test/html/snnu_wyxy_notice.html b/test/html/snnu_wyxy_notice.html new file mode 100644 index 0000000..157a8af --- /dev/null +++ b/test/html/snnu_wyxy_notice.html @@ -0,0 +1,296 @@ + + + + +公告通知-外国语学院网站 + + + + + + + + + + + + + +
+
+ +
+
+ +
+ + + + + + + + + + +公告通知 + + + +
+ +
 
+
    +
  • +
  • +
  • +
  • +
+ + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + +
+
+
+ 公告通知 + 您所在的位置: + + +首页 +> + + + +公告通知 + +> + +
+
+ +
+
+
+
+
+
+ + + + diff --git a/test/html/snnu_xsc_news.html b/test/html/snnu_xsc_news.html new file mode 100644 index 0000000..c036561 --- /dev/null +++ b/test/html/snnu_xsc_news.html @@ -0,0 +1,747 @@ + + + + + + +
+ +
+ + + + + + + + +Ѷ-ʦѧѧվ-֧֣ + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + +
ѧУҳ   Ϊҳ   ղ
+ + + + + + +
+
+
+ + + + + + + +
+
+
+
+ + + + +
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+
+ + + + + +
+ + + + + + + + + + +
+ + + + +
+ + + + + + + +
Ѷ
+ + + + + + + + + + + +
+
+ + + + +
+ + + + +
+
+ + + + +
+ + + + + + + + + + +
+ + + + + +
Ѷλãҳ > + Ѷ +
+ + + + +
+ + + + +
+ + + + + + +
/ 2018-12-24 /  ʮһڡ´á
+ + + + + + +
/ 2018-12-21 /  Ҳع¸ѧ˹
+ + + + + + +
/ 2018-12-20 /  УٿѧԺǹ
+ + + + + + +
/ 2018-12-19 /  Ӧ ʵ ůУ벢2018ѧ
+ + + + + + +
/ 2018-12-18 /  ѧ֯ѧտףĸ↑40
+ + + + + + +
/ 2018-12-18 /  ѧ֧֯տףĸ↑40
+ + + + + + +
/ 2018-12-17 /  У2018ʵĿ
+ + + + + + +
/ 2018-12-14 /  Уٿ2018ꡰҶʥսѧ𡱰䷢ʽ
+ + + + + + +
/ 2018-12-13 /  ίѧ(ѧ)ٿ2018-2019ѧȵһѧڵ5δ
+ + + + + + +
/ 2018-12-13 /  Уٿ2018ȡѧ𡱰䷢ʽ
+ + + + + + +
/ 2018-12-10 /  ŹҸԱŶӿչѧ罨輰ѧҵʾר
+ + + + + + +
/ 2018-12-09 /  УС΢·ԶС־׶Сѧ
+ + + + + + +
/ 2018-12-06 /  2018ꡰůͬСУ»У
+ + + + + + +
/ 2018-12-05 /  ѧѯָٿѧר
+ + + + + + +
/ 2018-12-03 /  У2018ꡰüѧ𡱰䷢ʽ
+ + + + + + +
/ 2018-12-03 /  У֯չ2018д»Ŀ ڴ
+ + + + + + +
/ 2018-12-03 /  ְҵʦѧѧͬУѧ
+ + + + + + +
/ 2018-11-30 /  ȫᾫ Ϊѧ֧
+ + + + + + +
/ 2018-11-30 /  ϲƾѧѧͬʵУѧ
+ + + + + + +
/ 2018-11-29 /  Ҳٿڹѧ취2018޶ѧ
+ + + + + + +
/ 2018-11-29 /  ½У½ѧ
+ + + + + + +
/ 2018-11-29 /  Ҳٿѧϰ᳹ȫᾫֻ
+ + + + + + +
/ 2018-11-27 /  У¡ؾ2017-2018ѧѧϵͳô
+ + + + + + +
/ 2018-11-26 /  ίѧѧٿѧڵ4δ
+ + + + + + +
/ 2018-11-26 /  ѧٿѧԺվ걨
+ + + + + +
+ + + + +
+ +
+ + + + + + + + + + + + +
ҳһҳһҳĩҳ     [ 70 ] ҳ   ǵ [ 1 ] ҳ   + ת + ҳ +
+
+ +
+
+
+
+
+ + + + + + +
+ + + + + + + + \ No newline at end of file diff --git a/test/html/snnu_xsc_notice.html b/test/html/snnu_xsc_notice.html new file mode 100644 index 0000000..7eefe4a --- /dev/null +++ b/test/html/snnu_xsc_notice.html @@ -0,0 +1,691 @@ + + + + + + +
+ +
+ + + + + + + + +֪ͨ-ʦѧѧվ-֧֣ + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + +
ѧУҳ   Ϊҳ   ղ
+ + + + + + +
+
+
+ + + + + + + +
+
+
+
+ + + + +
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + +
+ + + + +
+ + + + + +
+
+ + + + + +
+ + + + + + + + + + +
+ + + + +
+ + + + + + + +
֪ͨ
+ + + + + + + + + +
+
+ + + + +
+ + + + +
+
+ + + + +
+ + + + + + + + + + +
+ + + + + +
֪ͨλãҳ > + ֪ͨ +
+ + + + +
+ + + + +
+ + + + + + +
/ 2018-12-24 /  ֯Ա걨ʮڸԱڸУ֪ͨ
+ + + + + + +
/ 2018-12-19 /  ´õʮһ¿θĿôʵ
+ + + + + + +
/ 2018-12-19 /  2018ʵĿ֪ͨ
+ + + + + + +
/ 2018-12-19 /  ڱ2018ҽѧѧ¼ϵ֪ͨ
+ + + + + + +
/ 2018-12-17 /  Уѧȫ֪ͨ
+ + + + + + +
/ 2018-12-17 /  ֯ѧտѧϰףĸ↑40֪ͨ
+ + + + + + +
/ 2018-12-17 /  1216ѧͨ
+ + + + + + +
/ 2018-12-14 /  ȫУѧ뿪չĽһѡ ֪ͨ
+ + + + + + +
/ 2018-12-13 /  ڿչԼڶ˵ջ֪ͨ
+ + + + + + +
/ 2018-12-12 /  ڶ2017ʵĿн֪ͨ
+ + + + + + +
/ 2018-12-11 /  ٿ2018ꡰҶʥսѧ𡱰䷢ʽ֪ͨ
+ + + + + + +
/ 2018-12-11 /  ٿѧ𡱰䷢ʽ֪ͨ
+ + + + + + +
/ 2018-12-10 /  129ѧͨ
+ + + + + + +
/ 2018-12-07 /  ѧϵͳѧϰ᳹ȫᾫ֪ͨ
+ + + + + + +
/ 2018-12-05 /  2018д»Ŀڴʾ֪ͨ
+ + + + + + +
/ 2018-12-03 /  122ѧͨ
+ + + + + + +
/ 2018-12-02 /  ڿչ2018ꡰůͬ У»֪ͨ
+ + + + + + +
/ 2018-11-27 /  ѧԺվĹʾ
+ + + + + + +
/ 2018-11-26 /  2017-2018ѧѧԺѧЧͨ
+ + + + + + +
/ 2018-11-26 /  ڱУʮ조Ž¡֯λȽ˼Ʒľ
+ + + + + + +
/ 2018-11-26 /  ھ20172018ѧѧϵͳô֪ͨ
+ + + + + + +
/ 2018-11-26 /  ڿչ2018궬ѧΣŲ͸Ԥ֪ͨ
+ + + + + + +
/ 2018-11-26 /  1125ѧͨ
+ + + + + + +
/ 2018-11-25 /  ڶ֪ͨͨ
+ + + + + + +
/ 2018-11-21 /  ڵڡ롷¼֪ͨ
+ + + + + +
+ + + + +
+ +
+ + + + + + + + + + + + +
ҳһҳһҳĩҳ     [ 48 ] ҳ   ǵ [ 1 ] ҳ   + ת + ҳ +
+
+ +
+
+
+
+
+ + + + + + +
+ + + + + + + + \ No newline at end of file diff --git a/test/test_configs.py b/test/test_configs.py deleted file mode 100644 index d8e17e6..0000000 --- a/test/test_configs.py +++ /dev/null @@ -1,75 +0,0 @@ -''' -Created on Oct 8, 2018 - -@author: QiZhao -''' -# show config -SCHOOL_NAME = '陕师大' -VERSION = 'v0.2.0' -AUTHOR_NAME = 'QiZhao' -AUTHOR_EMAIL = 'zhaoqi99@outlook.com' - -# twillo config -ACCOUNT_ID = '' -AUTH_TOKEN = '' -TWILIO_NUMBER = '' - -# send_email config -FROM_ADDR = "" -PASSWORD = "" -EMAIL_PORT = 0 -EMAIL_SERVER = '' - -# Log Config -LOG_ENABLED = True - -# spider config -SPIDER_CONFIG = [ - { - 'subject_EN': 'snnu_index', - 'subject_CN': '师大主页', - 'url': 'http://www.snnu.edu.cn/tzgg.htm', - 'url_main': 'http://www.snnu.edu.cn/info/1085/', - 'rule': 'info/1085/(?P\d+\.htm)" target="_blank">(?P[\s\S]{5,100})((?P<date>\d*-\d*-\d*))', - 'coding': 'utf-8' - }, - { - 'subject_EN': 'snnu_css', - 'subject_CN': '计科院主页', - 'url': 'http://ccs.snnu.edu.cn/tzgg.htm', 'url_main': 'http://ccs.snnu.edu.cn/', - 'rule': '<a target="_blank" href="(?P<link>[^"]*)">(?P<title>[^( </)]*)[^"]*"[^>]*>(?P<date>\d*-\d*-\d*)', - 'coding': 'utf-8' - }, - { - 'subject_EN': 'snnu_jwc', - 'subject_CN': '教务处主页', - 'url': 'http://jwc.snnu.edu.cn/news_more.xhm?lm=2', - 'url_main': 'http://jwc.snnu.edu.cn/html/news_view.xhm?newsid=', - 'rule': 'newsid=(?P<link>\d*)" [^ ]* title="(?P<title>[^(">)]*)[^<]*[^(]*\((?P<date>\d*/\d*/\d*)', - 'coding': 'gbk' - }, - { - 'subject_EN': 'snnu_xsc', - 'subject_CN': '学生处主页', - 'url': 'http://www.xsc.snnu.edu.cn/Announcements.asp', - 'url_main': 'http://www.xsc.snnu.edu.cn/Announcements.asp?id=144&bh=', - 'rule': 'gk3">(?P<date>\d*-\d*-\d*)[^;]*;[^;]*;[^;]*;[^;]*;bh=(?P<link>\d*)[^>]*>(?P<title>[^</]*)', - 'coding': 'gbk' - }, - { - 'subject_EN': 'snnu_lib', - 'subject_CN': '图书馆主页', - 'url': 'http://www.lib.snnu.edu.cn/action.do?webid=w-d-bggg-l', - 'url_main': 'http://www.lib.snnu.edu.cn/action.do?webid=w-l-showmsg>ype=a&pid=', - 'rule': 'pid=(?P<link>\d*)[\s\S]{20,57}>(?P<title>[^<]*)</[af][\S\s]{18,70}(?P<date>\d{4}-\d*-\d*)', - 'coding': 'utf-8' - }, - { - 'subject_EN': 'snnu_clxy', - 'subject_CN': '材料院', - 'url': 'http://clxy.snnu.edu.cn/home/list/?bh=008', - 'url_main': 'http://clxy.snnu.edu.cn/Home/show/', - 'rule': 'show[/](?P<link>\d*)"[\s\S]{1,}?"(?P<title>[\s\S]{1,}?)"[^<]{1,}?</a>[\S\s]{1,200}<td align="center">[^\d]*(?P<date>\d*-\d*-\d*)', - 'coding': 'utf-8' - } -] diff --git a/test/test_single_spider.py b/test/test_single_spider.py deleted file mode 100644 index 49f9e98..0000000 --- a/test/test_single_spider.py +++ /dev/null @@ -1,99 +0,0 @@ -''' -Created on Oct 15, 2018 - -@author: QiZhao -''' -from spider import Spider - - -def test(dic): - try: - status, data = Spider(dic['url'], dic['url_main'], dic['rule'], dic['subject_CN'], - dic['subject_EN'], dic['coding']) - print(status) - print(data) - except Exception as e: - print(e) - - -def test_index(): - dic = { - 'subject_EN': 'snnu_index', - 'subject_CN': '师大主页', - 'url': 'http://www.snnu.edu.cn/tzgg.htm', - 'url_main': 'http://www.snnu.edu.cn/info/1085/', - 'rule': 'info/1085/(?P<link>\d+\.htm)" target="_blank">(?P<title>[\s\S]{5,100})((?P<date>\d*-\d*-\d*))', - 'coding': 'utf-8' - } - test(dic) - - -def test_css(): - dic = { - 'subject_EN': 'snnu_css', - 'subject_CN': '计科院主页', - 'url': 'http://ccs.snnu.edu.cn/tzgg.htm', 'url_main': 'http://ccs.snnu.edu.cn/', - 'rule': '<a target="_blank" href="(?P<link>[^"]*)">(?P<title>[^( </)]*)[^"]*"[^>]*>(?P<date>\d*-\d*-\d*)', - 'coding': 'utf-8' - } - test(dic) - - -def test_jwc(): - dic = { - 'subject_EN': 'snnu_jwc', - 'subject_CN': '教务处主页', - 'url': 'http://jwc.snnu.edu.cn/news_more.xhm?lm=2', - 'url_main': 'http://jwc.snnu.edu.cn/html/news_view.xhm?newsid=', - 'rule': 'newsid=(?P<link>\d*)" [^ ]* title="(?P<title>[^(">)]*)[^<]*[^(]*\((?P<date>\d*/\d*/\d*)', - 'coding': 'gbk' - } - test(dic) - - -def test_xsc(): - dic = { - 'subject_EN': 'snnu_xsc', - 'subject_CN': '学生处主页', - 'url': 'http://www.xsc.snnu.edu.cn/Announcements.asp', - 'url_main': 'http://www.xsc.snnu.edu.cn/Announcements.asp?id=144&bh=', - 'rule': 'gk3">(?P<date>\d*-\d*-\d*)[^;]*;[^;]*;[^;]*;[^;]*;bh=(?P<link>\d*)[^>]*>(?P<title>[^</]*)', - 'coding': 'gbk' - } - test(dic) - - -def test_lib(): - dic = { - 'subject_EN': 'snnu_lib', - 'subject_CN': '图书馆主页', - 'url': 'http://www.lib.snnu.edu.cn/action.do?webid=w-d-bggg-l', - 'url_main': 'http://www.lib.snnu.edu.cn/action.do?webid=w-l-showmsg>ype=a&pid=', - 'rule': 'pid=(?P<link>\d*)[\s\S]{20,57}>(?P<title>[^<]*)</[af][\S\s]{18,70}(?P<date>\d{4}-\d*-\d*)', - 'coding': 'utf-8' - } - test(dic) - - -def test_clxy(): - dic = { - 'subject_EN': 'snnu_clxy', - 'subject_CN': '材料院', - 'url': 'http://clxy.snnu.edu.cn/home/list/?bh=008', - 'url_main': 'http://clxy.snnu.edu.cn/Home/show/', - 'rule': 'show[/](?P<link>\d*)"[\s\S]{1,}?"(?P<title>[\s\S]{1,}?)"[^<]{1,}?</a>[\S\s]{1,200}<td align="center">[^\d]*(?P<date>\d*-\d*-\d*)', - 'coding': 'utf-8' - } - test(dic) - - -def main(): - test_index() - test_css() - test_jwc() - test_xsc() - test_lib() - test_clxy() - -if __name__ == '__main__': - main() diff --git a/test/test_spider.py b/test/test_spider.py index 4bd7711..d5ecc58 100644 --- a/test/test_spider.py +++ b/test/test_spider.py @@ -1,95 +1,24 @@ ''' -Created on Oct 8, 2018 +Created on Oct 10, 2018 @author: QiZhao ''' -from spider import * -from traceback import format_exc from tool import * -from test_configs import * -from configs import LOG_ENABLED - - -def test_re_group(): - url = 'http://www.lib.snnu.edu.cn/action.do?webid=w-d-bggg-l' - response = urllib.request.urlopen(url) - data = response.read().decode('utf-8') - rule = 'pid=(?P<link>\d*)[\s\S]{20,57}>(?P<title>[^<]*)</[af][\S\s]{18,70}(?P<date>\d{4}-\d*-\d*)' - pattern = re.compile(rule, re.S) - m = pattern.finditer(data) - for mm in m: - print(mm.groupdict()) - - -def test_Spider_data_1(): - url = 'http://www.lib.snnu.edu.cn/action.do?webid=w-d-bggg-l' - rule = 'pid=(?P<link>\d*)[\s\S]{20,57}>(?P<title>[^<]*)</[af][\S\s]{18,70}(?P<date>\d{4}-\d*-\d*)' - data_use = Spider_data(url, rule) - print(data_use) - - -def test_Spider_data_2(): - url = 'http://www.xsc.snnu.edu.cn/Announcements.asp' - rule = 'gk3">(?P<date>\d*-\d*-\d*)[^;]*;[^;]*;[^;]*;[^;]*;bh=(?P<link>\d*)[^>]*>(?P<title>[^</]*)' - data_use = Spider_data(url, rule, 'gbk') - print(data_use) - - -def test_dict_oper(): - url = 'http://www.xsc.snnu.edu.cn/Announcements.asp' - rule = 'gk3">(?P<date>\d*-\d*-\d*)[^;]*;[^;]*;[^;]*;[^;]*;bh=(?P<link>\d*)[^>]*>(?P<title>[^</]*)' - data_use = Spider_data(url, rule, 'gbk') - for item_dict in data_use: - item_dict['link'] += 'test' - print(data_use) - - -def test_Data_processing(): - url = 'http://www.xsc.snnu.edu.cn/Announcements.asp' - rule = 'gk3">(?P<date>\d*-\d*-\d*)[^;]*;[^;]*;[^;]*;[^;]*;bh=(?P<link>\d*)[^>]*>(?P<title>[^</]*)' - data = Spider_data(url, rule, 'gbk') - status, new_data = Data_processing('test', data, "Main") - print(status) - print(new_data) - - -def test_spider_config(): - print(SPIDER_CONFIG) - for dic in SPIDER_CONFIG: - print(dic) - for key in dic: - print(key + ':' + dic[key] + ',', end='') - - -def test_Spider(): - spider_list = SPIDER_CONFIG - for dic in spider_list: - try: - status, data = Spider(dic['url'], dic['url_main'], dic['rule'], dic['subject_CN'], - dic['subject_EN'], dic['coding'], LOG_ENABLED) - print(status) - print(data) - except Exception as e: - print('Exception: ', e) - Error_log = '异常信息如下:\n' + format_exc() + '-' * 70 + '\n' - Log_Write('Exception', Error_log, 0) - finally: - print('-' * 51) - - -def main(): - Mkdir('Log') - Mkdir('Data') - Mkfile('Log/' + 'Exception_log.log') - sqlhelper.CreateDatabase('database') - test_re_group() - test_Spider_data_1() - test_Spider_data_2() - test_dict_oper() - test_Data_processing() - test_spider_config() - test_Spider() - - -if __name__ == '__main__': - main() +import unittest +from spider import * +import configs_sample1 + +class TestSpider(unittest.TestCase): + "Test tool.py" + + def test_spider_date(self): + for dic in configs_sample1.SPIDER_CONFIG: + try: + ret=spider(dic['url'],dic['rule'], dic['coding']) + self.assertTrue(len(ret)>0) + except Exception: + pass + +if __name__ == "__main__": + #import sys;sys.argv = ['', 'Test.testName'] + unittest.main() \ No newline at end of file diff --git a/test/test_tool.py b/test/test_tool.py deleted file mode 100644 index db99b97..0000000 --- a/test/test_tool.py +++ /dev/null @@ -1,30 +0,0 @@ -''' -Created on Oct 10, 2018 - -@author: QiZhao -''' -from tool import * - - -def main(): - Mkdir('Log') - Mkdir('Log') - - Mkfile('Log/' + 'Exception_log.log') - - Mkfile('Data/test.md', 1) - Mkfile('Data/test.md', 0) - - Mkfile('Data/test2.md', 1) - Mkfile('Data/test2.md', 1) - - Log_Write('test_str', 'test_str\n') - test_list = [['test1_1', 'test1_2', 'test1_3'], - ['test2_1', 'test2_2', 'test2_3']] - Log_Write('test_list', test_list) - - print(time_text()) - - -if __name__ == '__main__': - main() diff --git a/twilio/__init__.py b/twilio/__init__.py deleted file mode 100644 index 028fbd3..0000000 --- a/twilio/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ - -__version_info__ = ('6', '10', '4') -__version__ = '.'.join(__version_info__) diff --git a/twilio/__pycache__/__init__.cpython-36.pyc b/twilio/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 74a70bf..0000000 Binary files a/twilio/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/__pycache__/compat.cpython-36.pyc b/twilio/__pycache__/compat.cpython-36.pyc deleted file mode 100644 index 6e25413..0000000 Binary files a/twilio/__pycache__/compat.cpython-36.pyc and /dev/null differ diff --git a/twilio/__pycache__/request_validator.cpython-36.pyc b/twilio/__pycache__/request_validator.cpython-36.pyc deleted file mode 100644 index 9b1db22..0000000 Binary files a/twilio/__pycache__/request_validator.cpython-36.pyc and /dev/null differ diff --git a/twilio/base/__init__.py b/twilio/base/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/twilio/base/__pycache__/__init__.cpython-36.pyc b/twilio/base/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index b83f3a3..0000000 Binary files a/twilio/base/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/base/__pycache__/deserialize.cpython-36.pyc b/twilio/base/__pycache__/deserialize.cpython-36.pyc deleted file mode 100644 index 676d34d..0000000 Binary files a/twilio/base/__pycache__/deserialize.cpython-36.pyc and /dev/null differ diff --git a/twilio/base/__pycache__/domain.cpython-36.pyc b/twilio/base/__pycache__/domain.cpython-36.pyc deleted file mode 100644 index 0c44172..0000000 Binary files a/twilio/base/__pycache__/domain.cpython-36.pyc and /dev/null differ diff --git a/twilio/base/__pycache__/exceptions.cpython-36.pyc b/twilio/base/__pycache__/exceptions.cpython-36.pyc deleted file mode 100644 index dbb361e..0000000 Binary files a/twilio/base/__pycache__/exceptions.cpython-36.pyc and /dev/null differ diff --git a/twilio/base/__pycache__/instance_context.cpython-36.pyc b/twilio/base/__pycache__/instance_context.cpython-36.pyc deleted file mode 100644 index dba265f..0000000 Binary files a/twilio/base/__pycache__/instance_context.cpython-36.pyc and /dev/null differ diff --git a/twilio/base/__pycache__/instance_resource.cpython-36.pyc b/twilio/base/__pycache__/instance_resource.cpython-36.pyc deleted file mode 100644 index 65dcca5..0000000 Binary files a/twilio/base/__pycache__/instance_resource.cpython-36.pyc and /dev/null differ diff --git a/twilio/base/__pycache__/list_resource.cpython-36.pyc b/twilio/base/__pycache__/list_resource.cpython-36.pyc deleted file mode 100644 index 0fea55e..0000000 Binary files a/twilio/base/__pycache__/list_resource.cpython-36.pyc and /dev/null differ diff --git a/twilio/base/__pycache__/obsolete.cpython-36.pyc b/twilio/base/__pycache__/obsolete.cpython-36.pyc deleted file mode 100644 index 32ae72c..0000000 Binary files a/twilio/base/__pycache__/obsolete.cpython-36.pyc and /dev/null differ diff --git a/twilio/base/__pycache__/page.cpython-36.pyc b/twilio/base/__pycache__/page.cpython-36.pyc deleted file mode 100644 index eaaa465..0000000 Binary files a/twilio/base/__pycache__/page.cpython-36.pyc and /dev/null differ diff --git a/twilio/base/__pycache__/serialize.cpython-36.pyc b/twilio/base/__pycache__/serialize.cpython-36.pyc deleted file mode 100644 index 5c8d7ad..0000000 Binary files a/twilio/base/__pycache__/serialize.cpython-36.pyc and /dev/null differ diff --git a/twilio/base/__pycache__/values.cpython-36.pyc b/twilio/base/__pycache__/values.cpython-36.pyc deleted file mode 100644 index fcdb1a3..0000000 Binary files a/twilio/base/__pycache__/values.cpython-36.pyc and /dev/null differ diff --git a/twilio/base/__pycache__/version.cpython-36.pyc b/twilio/base/__pycache__/version.cpython-36.pyc deleted file mode 100644 index e6085fd..0000000 Binary files a/twilio/base/__pycache__/version.cpython-36.pyc and /dev/null differ diff --git a/twilio/base/deserialize.py b/twilio/base/deserialize.py deleted file mode 100644 index ef6370d..0000000 --- a/twilio/base/deserialize.py +++ /dev/null @@ -1,69 +0,0 @@ -import datetime -from decimal import Decimal, BasicContext -from email.utils import parsedate -import pytz - -ISO8601_DATE_FORMAT = '%Y-%m-%d' -ISO8601_DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%SZ' - - -def iso8601_date(s): - """ - Parses an ISO 8601 date string and returns a UTC date object or the string - if the parsing failed. - :param s: ISO 8601-formatted date string (2015-01-25) - :return: - """ - try: - return datetime.datetime.strptime(s, ISO8601_DATE_FORMAT).replace(tzinfo=pytz.utc).date() - except (TypeError, ValueError): - return s - - -def iso8601_datetime(s): - """ - Parses an ISO 8601 datetime string and returns a UTC datetime object, - or the string if parsing failed. - :param s: ISO 8601-formatted datetime string (2015-01-25T12:34:56Z) - :return: datetime or str - """ - try: - return datetime.datetime.strptime(s, ISO8601_DATETIME_FORMAT).replace(tzinfo=pytz.utc) - except (TypeError, ValueError): - return s - - -def rfc2822_datetime(s): - """ - Parses an RFC 2822 date string and returns a UTC datetime object, - or the string if parsing failed. - :param s: RFC 2822-formatted string date - :return: datetime or str - """ - date_tuple = parsedate(s) - if date_tuple is None: - return None - return datetime.datetime(*date_tuple[:6]).replace(tzinfo=pytz.utc) - - -def decimal(d): - """ - Parses a decimal string into a Decimal - :param d: decimal string - :return: Decimal - """ - if not d: - return d - return Decimal(d, BasicContext) - - -def integer(i): - """ - Parses an integer string into an int - :param i: integer string - :return: int - """ - try: - return int(i) - except (TypeError, ValueError): - return i diff --git a/twilio/base/domain.py b/twilio/base/domain.py deleted file mode 100644 index 459c1df..0000000 --- a/twilio/base/domain.py +++ /dev/null @@ -1,48 +0,0 @@ -class Domain(object): - """ - This represents at Twilio API subdomain. - - Like, `api.twilio.com` or `lookups.twilio.com'. - """ - def __init__(self, twilio): - """ - :param Twilio twilio: - :return: - """ - self.twilio = twilio - self.base_url = None - - def absolute_url(self, uri): - """ - Converts a relative `uri` to an absolute url. - :param string uri: The relative uri to make absolute. - :return: An absolute url (based off this domain) - """ - return '{}/{}'.format(self.base_url.strip('/'), uri.strip('/')) - - def request(self, method, uri, params=None, data=None, headers=None, - auth=None, timeout=None, allow_redirects=False): - """ - Makes an HTTP request to this domain. - :param string method: The HTTP method. - :param string uri: The HTTP uri. - :param dict params: Query parameters. - :param object data: The request body. - :param dict headers: The HTTP headers. - :param tuple auth: Basic auth tuple of (username, password) - :param int timeout: The request timeout. - :param bool allow_redirects: True if the client should follow HTTP - redirects. - """ - url = self.absolute_url(uri) - return self.twilio.request( - method, - url, - params=params, - data=data, - headers=headers, - auth=auth, - timeout=timeout, - allow_redirects=allow_redirects - ) - diff --git a/twilio/base/exceptions.py b/twilio/base/exceptions.py deleted file mode 100644 index 8e2cf20..0000000 --- a/twilio/base/exceptions.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- -import sys - -from six import u - - -class TwilioException(Exception): - pass - - -class TwilioRestException(TwilioException): - """ A generic 400 or 500 level exception from the Twilio API - - :param int status: the HTTP status that was returned for the exception - :param str uri: The URI that caused the exception - :param str msg: A human-readable message for the error - :param str method: The HTTP method used to make the request - :param int|None code: A Twilio-specific error code for the error. This is - not available for all errors. - """ - - def __init__(self, status, uri, msg="", code=None, method='GET'): - self.uri = uri - self.status = status - self.msg = msg - self.code = code - self.method = method - - def __str__(self): - """ Try to pretty-print the exception, if this is going on screen. """ - - def red(words): - return u("\033[31m\033[49m%s\033[0m") % words - - def white(words): - return u("\033[37m\033[49m%s\033[0m") % words - - def blue(words): - return u("\033[34m\033[49m%s\033[0m") % words - - def teal(words): - return u("\033[36m\033[49m%s\033[0m") % words - - def get_uri(code): - return "https://www.twilio.com/docs/errors/{0}".format(code) - - # If it makes sense to print a human readable error message, try to - # do it. The one problem is that someone might catch this error and - # try to display the message from it to an end user. - if hasattr(sys.stderr, 'isatty') and sys.stderr.isatty(): - msg = ( - "\n{red_error} {request_was}\n\n{http_line}" - "\n\n{twilio_returned}\n\n{message}\n".format( - red_error=red("HTTP Error"), - request_was=white("Your request was:"), - http_line=teal("%s %s" % (self.method, self.uri)), - twilio_returned=white( - "Twilio returned the following information:"), - message=blue(str(self.msg)) - )) - if self.code: - msg = "".join([msg, "\n{more_info}\n\n{uri}\n\n".format( - more_info=white("More information may be available here:"), - uri=blue(get_uri(self.code))), - ]) - return msg - else: - return "HTTP {0} error: {1}".format(self.status, self.msg) diff --git a/twilio/base/instance_context.py b/twilio/base/instance_context.py deleted file mode 100644 index 3ccfa3a..0000000 --- a/twilio/base/instance_context.py +++ /dev/null @@ -1,8 +0,0 @@ -class InstanceContext(object): - def __init__(self, version): - """ - :param Version version: - """ - self._version = version - """ :type: Version """ - diff --git a/twilio/base/instance_resource.py b/twilio/base/instance_resource.py deleted file mode 100644 index bbb433f..0000000 --- a/twilio/base/instance_resource.py +++ /dev/null @@ -1,8 +0,0 @@ -class InstanceResource(object): - def __init__(self, version): - """ - :param Version version: - """ - self._version = version - """ :type: Version """ - diff --git a/twilio/base/list_resource.py b/twilio/base/list_resource.py deleted file mode 100644 index 823c842..0000000 --- a/twilio/base/list_resource.py +++ /dev/null @@ -1,7 +0,0 @@ -class ListResource(object): - def __init__(self, version): - """ - :param Version version: - """ - self._version = version - """ :type: Version """ diff --git a/twilio/base/obsolete.py b/twilio/base/obsolete.py deleted file mode 100644 index 6c89ba8..0000000 --- a/twilio/base/obsolete.py +++ /dev/null @@ -1,23 +0,0 @@ -import warnings -import functools - - -class ObsoleteException(BaseException): - """ Base class for warnings about obsolete features. """ - pass - - -def obsolete_client(func): - """This is a decorator which can be used to mark Client classes as - obsolete. It will result in an error being emitted when the class is - instantiated.""" - - @functools.wraps(func) - def new_func(*args, **kwargs): - raise ObsoleteException( - "{} has been removed from this version of the library. " - "Please refer to current documentation for guidance." - .format(func.__name__) - ) - - return new_func diff --git a/twilio/base/page.py b/twilio/base/page.py deleted file mode 100644 index e355c18..0000000 --- a/twilio/base/page.py +++ /dev/null @@ -1,136 +0,0 @@ -import json - -from twilio.base.exceptions import TwilioException - - -class Page(object): - """ - Represents a page of records in a collection. - - A `Page` lets you iterate over its records and fetch the next and previous - pages in the collection. - """ - META_KEYS = { - 'end', - 'first_page_uri', - 'next_page_uri', - 'last_page_uri', - 'page', - 'page_size', - 'previous_page_uri', - 'total', - 'num_pages', - 'start', - 'uri' - } - - def __init__(self, version, response): - payload = self.process_response(response) - - self._version = version - self._payload = payload - self._solution = {} - self._records = iter(self.load_page(payload)) - - def __iter__(self): - """ - A `Page` is a valid iterator. - """ - return self - - def __next__(self): - return self.next() - - def next(self): - """ - Returns the next record in the `Page`. - """ - return self.get_instance(next(self._records)) - - @classmethod - def process_response(self, response): - """ - Load a JSON response. - - :param Response response: The HTTP response. - :return dict: The JSON-loaded content. - """ - if response.status_code != 200: - raise TwilioException('Unable to fetch page', response) - - return json.loads(response.text) - - def load_page(self, payload): - """ - Parses the collection of records out of a list payload. - - :param dict payload: The JSON-loaded content. - :return list: The list of records. - """ - if 'meta' in payload and 'key' in payload['meta']: - return payload[payload['meta']['key']] - else: - keys = set(payload.keys()) - key = keys - self.META_KEYS - if len(key) == 1: - return payload[key.pop()] - - raise TwilioException('Page Records can not be deserialized') - - @property - def previous_page_url(self): - """ - :return str: Returns a link to the previous_page_url or None if doesn't exist. - """ - if 'meta' in self._payload and 'previous_page_url' in self._payload['meta']: - return self._payload['meta']['previous_page_url'] - elif 'previous_page_uri' in self._payload and self._payload['previous_page_uri']: - return self._version.domain.absolute_url(self._payload['previous_page_uri']) - - return None - - @property - def next_page_url(self): - """ - :return str: Returns a link to the next_page_url or None if doesn't exist. - """ - if 'meta' in self._payload and 'next_page_url' in self._payload['meta']: - return self._payload['meta']['next_page_url'] - elif 'next_page_uri' in self._payload and self._payload['next_page_uri']: - return self._version.domain.absolute_url(self._payload['next_page_uri']) - - return None - - def get_instance(self, payload): - """ - :param dict payload: A JSON-loaded representation of an instance record. - :return: A rich, resource-dependent object. - """ - raise TwilioException('Page.get_instance() must be implemented in the derived class') - - def next_page(self): - """ - Return the `Page` after this one. - :return Page: The next page. - """ - if not self.next_page_url: - return None - - response = self._version.domain.twilio.request('GET', self.next_page_url) - cls = type(self) - return cls(self._version, response, self._solution) - - def previous_page(self): - """ - Return the `Page` before this one. - :return Page: The previous page. - """ - if not self.previous_page_url: - return None - - response = self._version.domain.twilio.request('GET', self.previous_page_url) - cls = type(self) - return cls(self._version, response, self._solution) - - def __repr__(self): - return '<Page>' diff --git a/twilio/base/serialize.py b/twilio/base/serialize.py deleted file mode 100644 index c0fcf10..0000000 --- a/twilio/base/serialize.py +++ /dev/null @@ -1,75 +0,0 @@ -import datetime -import json - -from twilio.base import values - - -def iso8601_date(d): - """ - Return a string representation of a date that the Twilio API understands - Format is YYYY-MM-DD. Returns None if d is not a string, datetime, or date - """ - if d == values.unset: - return d - elif isinstance(d, datetime.datetime): - return str(d.date()) - elif isinstance(d, datetime.date): - return str(d) - elif isinstance(d, str): - return d - - -def iso8601_datetime(d): - """ - Return a string representation of a date that the Twilio API understands - Format is YYYY-MM-DD. Returns None if d is not a string, datetime, or date - """ - if d == values.unset: - return d - elif isinstance(d, datetime.datetime) or isinstance(d, datetime.date): - return d.strftime('%Y-%m-%dT%H:%M:%SZ') - elif isinstance(d, str): - return d - - -def prefixed_collapsible_map(m, prefix): - """ - Return a dict of params corresponding to those in m with the added prefix - """ - if m == values.unset: - return {} - - def flatten_dict(d, result={}, prv_keys=[]): - for k, v in d.items(): - if isinstance(v, dict): - flatten_dict(v, result, prv_keys + [k]) - else: - result['.'.join(prv_keys + [k])] = v - - return result - - if isinstance(m, dict): - flattened = flatten_dict(m) - return {'{}.{}'.format(prefix, k): v for k, v in flattened.items()} - - return {} - - -def object(obj): - """ - Return a jsonified string represenation of obj if obj is jsonifiable else - return obj untouched - """ - if isinstance(obj, dict) or isinstance(obj, list): - return json.dumps(obj) - return obj - - -def map(lst, serialize_func): - """ - Applies serialize_func to every element in lst - """ - if not isinstance(lst, list): - return lst - return [serialize_func(e) for e in lst] - diff --git a/twilio/base/values.py b/twilio/base/values.py deleted file mode 100644 index f2421c3..0000000 --- a/twilio/base/values.py +++ /dev/null @@ -1,12 +0,0 @@ -from six import iteritems -unset = object() - - -def of(d): - """ - Remove unset values from a dict. - - :param dict d: A dict to strip. - :return dict: A dict with unset values removed. - """ - return {k: v for k, v in iteritems(d) if v != unset} diff --git a/twilio/base/version.py b/twilio/base/version.py deleted file mode 100644 index 51c1bd5..0000000 --- a/twilio/base/version.py +++ /dev/null @@ -1,211 +0,0 @@ -import json -from math import ceil - -from twilio.base import values -from twilio.base.exceptions import TwilioRestException - - -class Version(object): - """ - Represents an API version. - """ - - def __init__(self, domain): - """ - :param Domain domain: - :return: - """ - self.domain = domain - self.version = None - - def absolute_url(self, uri): - """ - Turns a relative uri into an absolute url. - """ - return self.domain.absolute_url(self.relative_uri(uri)) - - def relative_uri(self, uri): - """ - Turns a relative uri into a versioned relative uri. - """ - return '{}/{}'.format(self.version.strip('/'), uri.strip('/')) - - def request(self, method, uri, params=None, data=None, headers=None, - auth=None, timeout=None, allow_redirects=False): - """ - Make an HTTP request. - """ - url = self.relative_uri(uri) - return self.domain.request( - method, - url, - params=params, - data=data, - headers=headers, - auth=auth, - timeout=timeout, - allow_redirects=allow_redirects - ) - - @classmethod - def exception(cls, method, uri, response, message): - """ - Wraps an exceptional response in a `TwilioRestException`. - """ - # noinspection PyBroadException - try: - error_payload = json.loads(response.text) - if 'message' in error_payload: - message = '{}: {}'.format(message, error_payload['message']) - code = error_payload.get('code', response.status_code) - return TwilioRestException(response.status_code, uri, message, code, method) - except Exception: - return TwilioRestException(response.status_code, uri, message, response.status_code, method) - - def fetch(self, method, uri, params=None, data=None, headers=None, auth=None, timeout=None, - allow_redirects=False): - """ - Fetch a resource instance. - """ - response = self.request( - method, - uri, - params=params, - data=data, - headers=headers, - auth=auth, - timeout=timeout, - allow_redirects=allow_redirects, - ) - - if response.status_code < 200 or response.status_code >= 300: - raise self.exception(method, uri, response, 'Unable to fetch record') - - return json.loads(response.text) - - def update(self, method, uri, params=None, data=None, headers=None, auth=None, timeout=None, - allow_redirects=False): - """ - Update a resource instance. - """ - response = self.request( - method, - uri, - params=params, - data=data, - headers=headers, - auth=auth, - timeout=timeout, - allow_redirects=allow_redirects, - ) - - if response.status_code < 200 or response.status_code >= 300: - raise self.exception(method, uri, response, 'Unable to update record') - - return json.loads(response.text) - - def delete(self, method, uri, params=None, data=None, headers=None, auth=None, timeout=None, - allow_redirects=False): - """ - Delete a resource. - """ - response = self.request( - method, - uri, - params=params, - data=data, - headers=headers, - auth=auth, - timeout=timeout, - allow_redirects=allow_redirects, - ) - - if response.status_code < 200 or response.status_code >= 300: - raise self.exception(method, uri, response, 'Unable to delete record') - - return response.status_code == 204 - - def read_limits(self, limit=None, page_size=None): - """ - Takes a limit on the max number of records to read and a max page_size - and calculates the max number of pages to read. - - :param int limit: Max number of records to read. - :param int page_size: Max page size. - :return dict: A dictionary of paging limits. - """ - page_limit = values.unset - - if limit is not None: - - if page_size is None: - page_size = limit - - page_limit = int(ceil(limit / float(page_size))) - - return { - 'limit': limit or values.unset, - 'page_size': page_size or values.unset, - 'page_limit': page_limit, - } - - def page(self, method, uri, params=None, data=None, headers=None, auth=None, timeout=None, - allow_redirects=False): - """ - Makes an HTTP request. - """ - return self.request( - method, - uri, - params=params, - data=data, - headers=headers, - auth=auth, - timeout=timeout, - allow_redirects=allow_redirects, - ) - - def stream(self, page, limit=None, page_limit=None): - """ - Generates records one a time from a page, stopping at prescribed limits. - - :param Page page: The page to stream. - :param int limit: The max number of records to read. - :param int page_imit: The max number of pages to read. - """ - current_record = 1 - current_page = 1 - - while page is not None: - for record in page: - yield record - current_record += 1 - if limit and limit is not values.unset and limit < current_record: - return - - if page_limit and page_limit is not values.unset and page_limit < current_page: - return - - page = page.next_page() - current_page += 1 - - def create(self, method, uri, params=None, data=None, headers=None, auth=None, timeout=None, - allow_redirects=False): - """ - Create a resource instance. - """ - response = self.request( - method, - uri, - params=params, - data=data, - headers=headers, - auth=auth, - timeout=timeout, - allow_redirects=allow_redirects, - ) - - if response.status_code < 200 or response.status_code >= 300: - raise self.exception(method, uri, response, 'Unable to create record') - - return json.loads(response.text) diff --git a/twilio/compat.py b/twilio/compat.py deleted file mode 100644 index 3a800e4..0000000 --- a/twilio/compat.py +++ /dev/null @@ -1,17 +0,0 @@ -# Those are not supported by the six library and needs to be done manually -try: - # python 3 - from urllib.parse import urlencode, urlparse, urljoin, urlunparse -except ImportError: - # python 2 backward compatibility - # noinspection PyUnresolvedReferences - from urllib import urlencode - # noinspection PyUnresolvedReferences - from urlparse import urlparse, urljoin, urlunparse - -try: - # python 2 - from itertools import izip -except ImportError: - # python 3 - izip = zip diff --git a/twilio/http/__init__.py b/twilio/http/__init__.py deleted file mode 100644 index a0360a2..0000000 --- a/twilio/http/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -from twilio.base.exceptions import TwilioException - - -class HttpClient(object): - """ - An abstract class representing an HTTP client. - """ - def request(self, method, url, params=None, data=None, headers=None, auth=None, - timeout=None, allow_redirects=False): - """ - Make an HTTP request. - """ - raise TwilioException('HttpClient is an abstract class') diff --git a/twilio/http/__pycache__/__init__.cpython-36.pyc b/twilio/http/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 57c1ab6..0000000 Binary files a/twilio/http/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/http/__pycache__/http_client.cpython-36.pyc b/twilio/http/__pycache__/http_client.cpython-36.pyc deleted file mode 100644 index 577bf37..0000000 Binary files a/twilio/http/__pycache__/http_client.cpython-36.pyc and /dev/null differ diff --git a/twilio/http/__pycache__/request.cpython-36.pyc b/twilio/http/__pycache__/request.cpython-36.pyc deleted file mode 100644 index 6d22eeb..0000000 Binary files a/twilio/http/__pycache__/request.cpython-36.pyc and /dev/null differ diff --git a/twilio/http/__pycache__/response.cpython-36.pyc b/twilio/http/__pycache__/response.cpython-36.pyc deleted file mode 100644 index fdbbb55..0000000 Binary files a/twilio/http/__pycache__/response.cpython-36.pyc and /dev/null differ diff --git a/twilio/http/__pycache__/validation_client.cpython-36.pyc b/twilio/http/__pycache__/validation_client.cpython-36.pyc deleted file mode 100644 index 863d1cc..0000000 Binary files a/twilio/http/__pycache__/validation_client.cpython-36.pyc and /dev/null differ diff --git a/twilio/http/http_client.py b/twilio/http/http_client.py deleted file mode 100644 index dff16a9..0000000 --- a/twilio/http/http_client.py +++ /dev/null @@ -1,75 +0,0 @@ -from requests import Request, Session, hooks - -from twilio.http import HttpClient -from twilio.http.response import Response -from twilio.http.request import Request as TwilioRequest -import logging -from twilio.compat import urlencode - -_logger = logging.getLogger('twilio.http_client') - - -class TwilioHttpClient(HttpClient): - """ - General purpose HTTP Client for interacting with the Twilio API - """ - def __init__(self, pool_connections=True, request_hooks=None): - self.session = Session() if pool_connections else None - self.last_request = None - self.last_response = None - self.request_hooks = request_hooks or hooks.default_hooks() - - def request(self, method, url, params=None, data=None, headers=None, auth=None, timeout=None, - allow_redirects=False): - """ - Make an HTTP Request with parameters provided. - - :param str method: The HTTP method to use - :param str url: The URL to request - :param dict params: Query parameters to append to the URL - :param dict data: Parameters to go in the body of the HTTP request - :param dict headers: HTTP Headers to send with the request - :param tuple auth: Basic Auth arguments - :param float timeout: Socket/Read timeout for the request - :param boolean allow_redirects: Whether or not to allow redirects - See the requests documentation for explanation of all these parameters - - :return: An http response - :rtype: A :class:`Response <twilio.rest.http.response.Response>` object - """ - - kwargs = { - 'method': method.upper(), - 'url': url, - 'params': params, - 'data': data, - 'headers': headers, - 'auth': auth, - 'hooks': self.request_hooks - } - - if params: - _logger.info('{method} Request: {url}?{query}'.format(query=urlencode(params), **kwargs)) - _logger.info('PARAMS: {params}'.format(**kwargs)) - else: - _logger.info('{method} Request: {url}'.format(**kwargs)) - if data: - _logger.info('PAYLOAD: {data}'.format(**kwargs)) - - self.last_response = None - session = self.session or Session() - request = Request(**kwargs) - self.last_request = TwilioRequest(**kwargs) - - prepped_request = session.prepare_request(request) - response = session.send( - prepped_request, - allow_redirects=allow_redirects, - timeout=timeout, - ) - - _logger.info('{method} Response: {status} {text}'.format(method=method, status=response.status_code, text=response.text)) - - self.last_response = Response(int(response.status_code), response.text) - - return self.last_response diff --git a/twilio/http/request.py b/twilio/http/request.py deleted file mode 100644 index e96528d..0000000 --- a/twilio/http/request.py +++ /dev/null @@ -1,77 +0,0 @@ -from twilio.compat import urlencode - - -class Request(object): - """ - An HTTP request. - """ - ANY = '*' - - def __init__(self, - method=ANY, - url=ANY, - auth=ANY, - params=ANY, - data=ANY, - headers=ANY, - **kwargs): - self.method = method.upper() - self.url = url - self.auth = auth - self.params = params - self.data = data - self.headers = headers - - @classmethod - def attribute_equal(cls, lhs, rhs): - if lhs == cls.ANY or rhs == cls.ANY: - # ANY matches everything - return True - - lhs = lhs or None - rhs = rhs or None - - return lhs == rhs - - def __eq__(self, other): - if not isinstance(other, Request): - return False - - return self.attribute_equal(self.method, other.method) and \ - self.attribute_equal(self.url, other.url) and \ - self.attribute_equal(self.auth, other.auth) and \ - self.attribute_equal(self.params, other.params) and \ - self.attribute_equal(self.data, other.data) and \ - self.attribute_equal(self.headers, other.headers) - - def __str__(self): - auth = '' - if self.auth and self.auth != self.ANY: - auth = '{} '.format(self.auth) - - params = '' - if self.params and self.params != self.ANY: - params = '?{}'.format(urlencode(self.params, doseq=True)) - - data = '' - if self.data and self.data != self.ANY: - if self.method == 'GET': - data = '\n -G' - data += '\n{}'.format('\n'.join(' -d "{}={}"'.format(k, v) for k, v in self.data.items())) - - headers = '' - if self.headers and self.headers != self.ANY: - headers = '\n{}'.format('\n'.join(' -H "{}: {}"'.format(k, v) - for k, v in self.headers.items())) - - return '{auth}{method} {url}{params}{data}{headers}'.format( - auth=auth, - method=self.method, - url=self.url, - params=params, - data=data, - headers=headers, - ) - - def __repr__(self): - return str(self) diff --git a/twilio/http/response.py b/twilio/http/response.py deleted file mode 100644 index a778a8a..0000000 --- a/twilio/http/response.py +++ /dev/null @@ -1,16 +0,0 @@ -class Response(object): - """ - - """ - def __init__(self, status_code, text): - self.content = text - self.cached = False - self.status_code = status_code - self.ok = self.status_code < 400 - - @property - def text(self): - return self.content - - def __repr__(self): - return 'HTTP {} {}'.format(self.status_code, self.content) diff --git a/twilio/http/validation_client.py b/twilio/http/validation_client.py deleted file mode 100644 index f10a775..0000000 --- a/twilio/http/validation_client.py +++ /dev/null @@ -1,95 +0,0 @@ -from collections import namedtuple - -from requests import Request, Session - -from twilio.compat import urlparse -from twilio.http import HttpClient -from twilio.http.response import Response -from twilio.jwt.validation import ClientValidationJwt - - -ValidationPayload = namedtuple('ValidationPayload', ['method', 'path', 'query_string', 'all_headers', - 'signed_headers', 'body']) - - -class ValidationClient(HttpClient): - __SIGNED_HEADERS = ['authorization', 'host'] - - def __init__(self, account_sid, api_key_sid, credential_sid, private_key, pool_connections=True): - """ - Build a ValidationClient which signs requests with private_key and allows Twilio to - validate request has not been tampered with. - - :param str account_sid: A Twilio Account Sid starting with 'AC' - :param str api_key_sid: A Twilio API Key Sid starting with 'SK' - :param str credential_sid: A Credential Sid starting with 'CR', - corresponds to public key Twilio will use to verify the JWT. - :param str private_key: The private key used to sign the Client Validation JWT. - """ - self.account_sid = account_sid - self.credential_sid = credential_sid - self.api_key_sid = api_key_sid - self.private_key = private_key - self.session = Session() if pool_connections else None - - def request(self, method, url, params=None, data=None, headers=None, auth=None, timeout=None, - allow_redirects=False): - """ - Make a signed HTTP Request - - :param str method: The HTTP method to use - :param str url: The URL to request - :param dict params: Query parameters to append to the URL - :param dict data: Parameters to go in the body of the HTTP request - :param dict headers: HTTP Headers to send with the request - :param tuple auth: Basic Auth arguments - :param float timeout: Socket/Read timeout for the request - :param boolean allow_redirects: Whether or not to allow redirects - See the requests documentation for explanation of all these parameters - - :return: An http response - :rtype: A :class:`Response <twilio.rest.http.response.Response>` object - """ - session = self.session or Session() - request = Request(method.upper(), url, params=params, data=data, headers=headers, auth=auth) - prepared_request = session.prepare_request(request) - - if 'Host' not in prepared_request.headers and 'host' not in prepared_request.headers: - prepared_request.headers['Host'] = self._get_host(prepared_request) - - validation_payload = self._build_validation_payload(prepared_request) - jwt = ClientValidationJwt(self.account_sid, self.api_key_sid, self.credential_sid, - self.private_key, validation_payload) - prepared_request.headers['Twilio-Client-Validation'] = jwt.to_jwt() - - response = session.send( - prepared_request, - allow_redirects=allow_redirects, - timeout=timeout, - ) - - return Response(int(response.status_code), response.text) - - def _build_validation_payload(self, request): - """ - Extract relevant information from request to build a ClientValidationJWT - :param PreparedRequest request: request we will extract information from. - :return: ValidationPayload - """ - parsed = urlparse(request.url) - path = parsed.path - query_string = parsed.query or '' - - return ValidationPayload( - method=request.method, - path=path, - query_string=query_string, - all_headers=request.headers, - signed_headers=ValidationClient.__SIGNED_HEADERS, - body=request.body or '' - ) - - def _get_host(self, request): - """Pull the Host out of the request""" - parsed = urlparse(request.url) - return parsed.netloc diff --git a/twilio/jwt/__init__.py b/twilio/jwt/__init__.py deleted file mode 100644 index 32aeb2d..0000000 --- a/twilio/jwt/__init__.py +++ /dev/null @@ -1,155 +0,0 @@ -import hmac -import sys - -from twilio.jwt import compat - -if sys.version_info[0] == 3 and sys.version_info[1] == 2: - # PyJWT expects hmac.compare_digest to exist even under python 3.2 - hmac.compare_digest = compat.compare_digest - -import jwt as jwt_lib - -try: - import json -except ImportError: - import simplejson as json - -import time - - -__all__ = ['Jwt', 'JwtDecodeError'] - - -class JwtDecodeError(Exception): - pass - - -class Jwt(object): - """Base class for building a Json Web Token""" - GENERATE = object() - - def __init__(self, secret_key, issuer, subject=None, algorithm='HS256', nbf=GENERATE, - ttl=3600, valid_until=None): - self.secret_key = secret_key - """:type str: The secret used to encode the JWT""" - self.issuer = issuer - """:type str: The issuer of this JWT""" - self.subject = subject - """:type str: The subject of this JWT, ommited from payload by default""" - self.algorithm = algorithm - """:type str: The algorithm used to encode the JWT, defaults to 'HS256'""" - self.nbf = nbf - """:type int: Time in secs since epoch before which this JWT is invalid. Defaults to now.""" - self.ttl = ttl - """:type int: Time to live of the JWT in seconds, defaults to 1 hour""" - self.valid_until = valid_until - """:type int: Time in secs since epoch this JWT is valid for. Overrides ttl if provided.""" - - self.__decoded_payload = None - self.__decoded_headers = None - - def _generate_payload(self): - """:rtype: dict the payload of the JWT to send""" - raise NotImplementedError('Subclass must provide a payload.') - - def _generate_headers(self): - """:rtype dict: Additional headers to include in the JWT, defaults to an empty dict""" - return {} - - @classmethod - def _from_jwt(cls, headers, payload, key=None): - """ - Class specific implementation of from_jwt which should take jwt components and return - and instance of this Class with jwt information loaded. - :return: Jwt object containing the headers, payload and key - """ - jwt = Jwt( - secret_key=key, - issuer=payload.get('iss', None), - subject=payload.get('sub', None), - algorithm=headers.get('alg', None), - valid_until=payload.get('exp', None), - nbf=payload.get('nbf', None), - ) - jwt.__decoded_payload = payload - jwt.__decoded_headers = headers - return jwt - - @property - def payload(self): - if self.__decoded_payload: - return self.__decoded_payload - - payload = self._generate_payload().copy() - payload['iss'] = self.issuer - payload['exp'] = int(time.time()) + self.ttl - if self.nbf is not None: - if self.nbf == self.GENERATE: - payload['nbf'] = int(time.time()) - else: - payload['nbf'] = self.nbf - if self.valid_until: - payload['exp'] = self.valid_until - if self.subject: - payload['sub'] = self.subject - - return payload - - @property - def headers(self): - if self.__decoded_headers: - return self.__decoded_headers - - headers = self._generate_headers().copy() - headers['typ'] = 'JWT' - headers['alg'] = self.algorithm - return headers - - def to_jwt(self, algorithm=None, ttl=None): - """ - Encode this JWT object into a JWT string - :param str algorithm: override the algorithm used to encode the JWT - :param int ttl: override the ttl configured in the constructor - :rtype: str The JWT string - """ - - if not self.secret_key: - raise ValueError('JWT does not have a signing key configured.') - - headers = self.headers.copy() - if algorithm: - headers['alg'] = algorithm - algorithm = algorithm or self.algorithm - - payload = self.payload.copy() - if ttl: - payload['exp'] = int(time.time()) + ttl - - return jwt_lib.encode(payload, self.secret_key, algorithm=algorithm, headers=headers) - - @classmethod - def from_jwt(cls, jwt, key=''): - """ - Decode a JWT string into a Jwt object - :param str jwt: JWT string - :param Optional[str] key: key used to verify JWT signature, if not provided then validation - is skipped. - :raises JwtDecodeError if decoding JWT fails for any reason. - :return: A DecodedJwt object containing the jwt information. - """ - verify = True if key else False - - try: - payload = jwt_lib.decode(bytes(jwt), key, options={ - 'verify_signature': verify, - 'verify_exp': True, - 'verify_nbf': True, - }) - headers = jwt_lib.get_unverified_header(jwt) - except Exception as e: - raise JwtDecodeError(getattr(e, 'message', str(e))) - - return cls._from_jwt(headers, payload, key) - - def __str__(self): - return '<JWT {}>'.format(self.to_jwt()) diff --git a/twilio/jwt/__pycache__/__init__.cpython-36.pyc b/twilio/jwt/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 2d4a327..0000000 Binary files a/twilio/jwt/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/jwt/__pycache__/compat.cpython-36.pyc b/twilio/jwt/__pycache__/compat.cpython-36.pyc deleted file mode 100644 index 40de12f..0000000 Binary files a/twilio/jwt/__pycache__/compat.cpython-36.pyc and /dev/null differ diff --git a/twilio/jwt/access_token/__init__.py b/twilio/jwt/access_token/__init__.py deleted file mode 100644 index 4e542a5..0000000 --- a/twilio/jwt/access_token/__init__.py +++ /dev/null @@ -1,65 +0,0 @@ -import time - -from twilio.jwt import Jwt - - -class AccessTokenGrant(object): - """A Grant giving access to a Twilio Resource""" - @property - def key(self): - """:rtype str Grant's twilio specific key""" - raise NotImplementedError('Grant must have a key property.') - - def to_payload(self): - """:return: dict something""" - raise NotImplementedError('Grant must implement to_payload.') - - def __str__(self): - '<{} {}>'.format(self.__class__.__name__, self.to_payload()) - - -class AccessToken(Jwt): - """Access Token containing one or more AccessTokenGrants used to access Twilio Resources""" - def __init__(self, account_sid, signing_key_sid, secret, grants=None, - identity=None, nbf=Jwt.GENERATE, ttl=3600, valid_until=None): - grants = grants or [] - if any(not isinstance(g, AccessTokenGrant) for g in grants): - raise ValueError('Grants must be instances of AccessTokenGrant.') - - self.account_sid = account_sid - self.signing_key_sid = signing_key_sid - self.identity = identity - self.grants = grants - super(AccessToken, self).__init__( - secret_key=secret, - algorithm='HS256', - issuer=signing_key_sid, - subject=self.account_sid, - nbf=nbf, - ttl=ttl, - valid_until=valid_until, - ) - - def add_grant(self, grant): - """Add a grant to this AccessToken""" - if not isinstance(grant, AccessTokenGrant): - raise ValueError('Grant must be an instance of AccessTokenGrant.') - self.grants.append(grant) - - def _generate_headers(self): - return { - 'cty': 'twilio-fpa;v=1' - } - - def _generate_payload(self): - now = int(time.time()) - payload = { - 'jti': '{}-{}'.format(self.signing_key_sid, now), - 'grants': {grant.key: grant.to_payload() for grant in self.grants} - } - if self.identity: - payload['grants']['identity'] = self.identity - return payload - - def __str__(self): - return '<AccessToken {}>'.format(self.to_jwt()) diff --git a/twilio/jwt/access_token/__pycache__/__init__.cpython-36.pyc b/twilio/jwt/access_token/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index c9ff476..0000000 Binary files a/twilio/jwt/access_token/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/jwt/access_token/__pycache__/grants.cpython-36.pyc b/twilio/jwt/access_token/__pycache__/grants.cpython-36.pyc deleted file mode 100644 index 6de64d2..0000000 Binary files a/twilio/jwt/access_token/__pycache__/grants.cpython-36.pyc and /dev/null differ diff --git a/twilio/jwt/access_token/grants.py b/twilio/jwt/access_token/grants.py deleted file mode 100644 index 66520a4..0000000 --- a/twilio/jwt/access_token/grants.py +++ /dev/null @@ -1,191 +0,0 @@ -from twilio.jwt.access_token import AccessTokenGrant -import warnings -import functools - - -def deprecated(func): - '''This is a decorator which can be used to mark functions - as deprecated. It will result in a warning being emitted - when the function is used.''' - - @functools.wraps(func) - def new_func(*args, **kwargs): - warnings.simplefilter('always', DeprecationWarning) - warnings.warn("Call to deprecated function {}.".format(func.__name__), category=DeprecationWarning, stacklevel=2) - warnings.simplefilter('default', DeprecationWarning) - return func(*args, **kwargs) - - return new_func - - -class ChatGrant(AccessTokenGrant): - """Grant to access Twilio Chat""" - - def __init__(self, service_sid=None, endpoint_id=None, - deployment_role_sid=None, push_credential_sid=None): - self.service_sid = service_sid - self.endpoint_id = endpoint_id - self.deployment_role_sid = deployment_role_sid - self.push_credential_sid = push_credential_sid - - @property - def key(self): - return "chat" - - def to_payload(self): - grant = {} - if self.service_sid: - grant['service_sid'] = self.service_sid - if self.endpoint_id: - grant['endpoint_id'] = self.endpoint_id - if self.deployment_role_sid: - grant['deployment_role_sid'] = self.deployment_role_sid - if self.push_credential_sid: - grant['push_credential_sid'] = self.push_credential_sid - - return grant - - -class IpMessagingGrant(AccessTokenGrant): - """Grant to access Twilio IP Messaging""" - - @deprecated - def __init__(self, service_sid=None, endpoint_id=None, - deployment_role_sid=None, push_credential_sid=None): - self.service_sid = service_sid - self.endpoint_id = endpoint_id - self.deployment_role_sid = deployment_role_sid - self.push_credential_sid = push_credential_sid - - @property - def key(self): - return "ip_messaging" - - def to_payload(self): - grant = {} - if self.service_sid: - grant['service_sid'] = self.service_sid - if self.endpoint_id: - grant['endpoint_id'] = self.endpoint_id - if self.deployment_role_sid: - grant['deployment_role_sid'] = self.deployment_role_sid - if self.push_credential_sid: - grant['push_credential_sid'] = self.push_credential_sid - - return grant - - -class SyncGrant(AccessTokenGrant): - """Grant to access Twilio Sync""" - def __init__(self, service_sid=None, endpoint_id=None): - self.service_sid = service_sid - self.endpoint_id = endpoint_id - - @property - def key(self): - return "data_sync" - - def to_payload(self): - grant = {} - if self.service_sid: - grant['service_sid'] = self.service_sid - if self.endpoint_id: - grant['endpoint_id'] = self.endpoint_id - - return grant - - -class VoiceGrant(AccessTokenGrant): - """Grant to access Twilio Programmable Voice""" - def __init__(self, - outgoing_application_sid=None, - outgoing_application_params=None, - push_credential_sid=None, - endpoint_id=None): - self.outgoing_application_sid = outgoing_application_sid - """ :type : str """ - self.outgoing_application_params = outgoing_application_params - """ :type : dict """ - self.push_credential_sid = push_credential_sid - """ :type : str """ - self.endpoint_id = endpoint_id - """ :type : str """ - - @property - def key(self): - return "voice" - - def to_payload(self): - grant = {} - if self.outgoing_application_sid: - grant['outgoing'] = {} - grant['outgoing']['application_sid'] = self.outgoing_application_sid - - if self.outgoing_application_params: - grant['outgoing']['params'] = self.outgoing_application_params - - if self.push_credential_sid: - grant['push_credential_sid'] = self.push_credential_sid - - if self.endpoint_id: - grant['endpoint_id'] = self.endpoint_id - - return grant - - -class ConversationsGrant(AccessTokenGrant): - """Grant to access Twilio Conversations""" - @deprecated - def __init__(self, configuration_profile_sid=None): - self.configuration_profile_sid = configuration_profile_sid - - @property - def key(self): - return "rtc" - - def to_payload(self): - grant = {} - if self.configuration_profile_sid: - grant['configuration_profile_sid'] = self.configuration_profile_sid - - return grant - - -class VideoGrant(AccessTokenGrant): - """Grant to access Twilio Video""" - def __init__(self, room=None): - self.room = room - - @property - def key(self): - return "video" - - def to_payload(self): - grant = {} - if self.room: - grant['room'] = self.room - - return grant - - -class TaskRouterGrant(AccessTokenGrant): - """Grant to access Twilio TaskRouter""" - def __init__(self, workspace_sid=None, worker_sid=None, role=None): - self.workspace_sid = workspace_sid - self.worker_sid = worker_sid - self.role = role - - @property - def key(self): - return "task_router" - - def to_payload(self): - grant = {} - if self.workspace_sid: - grant['workspace_sid'] = self.workspace_sid - if self.worker_sid: - grant['worker_sid'] = self.worker_sid - if self.role: - grant['role'] = self.role - - return grant diff --git a/twilio/jwt/client/__init__.py b/twilio/jwt/client/__init__.py deleted file mode 100644 index be0ede9..0000000 --- a/twilio/jwt/client/__init__.py +++ /dev/null @@ -1,105 +0,0 @@ -from twilio.jwt import Jwt - -from six import iteritems -from twilio.compat import urlencode - - -class ClientCapabilityToken(Jwt): - """A token to control permissions with Twilio Client""" - - def __init__(self, account_sid, auth_token, nbf=Jwt.GENERATE, ttl=3600, valid_until=None, - **kwargs): - """ - :param str account_sid: The account sid to which this token is granted access. - :param str auth_token: The secret key used to sign the token. Note, this auth token is not - visible to the user of the token. - :param int nbf: Time in secs from epic before which this token is considered invalid. - :param int ttl: the amount of time in seconds from generation that this token is valid for. - :param kwargs: - - - :returns: A new CapabilityToken with zero permissions - """ - super(ClientCapabilityToken, self).__init__( - algorithm='HS256', - secret_key=auth_token, - issuer=account_sid, - nbf=nbf, - ttl=ttl, - valid_until=None, - ) - - self.account_sid = account_sid - self.auth_token = auth_token - self.client_name = None - self.capabilities = {} - - if 'allow_client_outgoing' in kwargs: - self.allow_client_outgoing(**kwargs['allow_client_outgoing']) - if 'allow_client_incoming' in kwargs: - self.allow_client_incoming(**kwargs['allow_client_incoming']) - if 'allow_event_stream' in kwargs: - self.allow_event_stream(**kwargs['allow_event_stream']) - - def allow_client_outgoing(self, application_sid, **kwargs): - """ - Allow the user of this token to make outgoing connections. Keyword arguments are passed - to the application. - - :param str application_sid: Application to contact - """ - scope = ScopeURI('client', 'outgoing', {'appSid': application_sid}) - if kwargs: - scope.add_param('appParams', urlencode(kwargs, doseq=True)) - - self.capabilities['outgoing'] = scope - - def allow_client_incoming(self, client_name): - """ - Allow the user of this token to accept incoming connections. - - :param str client_name: Client name to accept calls from - """ - self.client_name = client_name - self.capabilities['incoming'] = ScopeURI('client', 'incoming', {'clientName': client_name}) - - def allow_event_stream(self, **kwargs): - """ - Allow the user of this token to access their event stream. - """ - scope = ScopeURI('stream', 'subscribe', {'path': '/2010-04-01/Events'}) - if kwargs: - scope.add_param('params', urlencode(kwargs, doseq=True)) - - self.capabilities["events"] = scope - - def _generate_payload(self): - if 'outgoing' in self.capabilities and self.client_name is not None: - self.capabilities['outgoing'].add_param('clientName', self.client_name) - - scope_uris = [scope_uri.to_payload() for scope_uri in self.capabilities.values()] - return {'scope': ' '.join(scope_uris)} - - -class ScopeURI(object): - """A single capability granted to Twilio Client and scoped to a service""" - - def __init__(self, service, privilege, params=None): - self.service = service - self.privilege = privilege - self.params = params or {} - - def add_param(self, key, value): - self.params[key] = value - - def to_payload(self): - if self.params: - sorted_params = sorted([(k, v) for k, v in iteritems(self.params)]) - encoded_params = urlencode(sorted_params) - param_string = '?{}'.format(encoded_params) - else: - param_string = '' - return 'scope:{}:{}{}'.format(self.service, self.privilege, param_string) - - def __str__(self): - return '<ScopeURI {}>'.format(self.to_payload()) diff --git a/twilio/jwt/client/__pycache__/__init__.cpython-36.pyc b/twilio/jwt/client/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index e31780a..0000000 Binary files a/twilio/jwt/client/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/jwt/compat.py b/twilio/jwt/compat.py deleted file mode 100644 index f0237c2..0000000 --- a/twilio/jwt/compat.py +++ /dev/null @@ -1,25 +0,0 @@ -def compare_digest(a, b): - """ - PyJWT expects hmac.compare_digest to exist for all Python 3.x, however it was added in Python > 3.3 - It has a fallback for Python 2.x but not for Pythons between 2.x and 3.3 - Copied from: https://github.com/python/cpython/commit/6cea65555caf2716b4633827715004ab0291a282#diff-c49659257ec1b129707ce47a98adc96eL16 - - Returns the equivalent of 'a == b', but avoids content based short - circuiting to reduce the vulnerability to timing attacks. - """ - # Consistent timing matters more here than data type flexibility - if not (isinstance(a, bytes) and isinstance(b, bytes)): - raise TypeError("inputs must be bytes instances") - - # We assume the length of the expected digest is public knowledge, - # thus this early return isn't leaking anything an attacker wouldn't - # already know - if len(a) != len(b): - return False - - # We assume that integers in the bytes range are all cached, - # thus timing shouldn't vary much due to integer object creation - result = 0 - for x, y in zip(a, b): - result |= x ^ y - return result == 0 diff --git a/twilio/jwt/taskrouter/__init__.py b/twilio/jwt/taskrouter/__init__.py deleted file mode 100644 index 3095ae7..0000000 --- a/twilio/jwt/taskrouter/__init__.py +++ /dev/null @@ -1,134 +0,0 @@ -from twilio.jwt import Jwt - - -class TaskRouterCapabilityToken(Jwt): - VERSION = 'v1' - DOMAIN = 'https://taskrouter.twilio.com' - EVENTS_BASE_URL = 'https://event-bridge.twilio.com/v1/wschannels' - - def __init__(self, account_sid, auth_token, workspace_sid, channel_id, **kwargs): - """ - :param str account_sid: Twilio account sid - :param str auth_token: Twilio auth token used to sign the JWT - :param str workspace_sid: TaskRouter workspace sid - :param str channel_id: TaskRouter channel sid - :param kwargs: - :param bool allow_web_sockets: shortcut to calling allow_web_sockets, defaults to True - :param bool allow_fetch_self: shortcut to calling allow_fetch_self, defaults to True - :param bool allow_update_self: shortcut to calling allow_update_self, defaults to False - :param bool allow_delete_self: shortcut to calling allow_delete_self, defaults to False - :param bool allow_fetch_subresources: shortcut to calling allow_fetch_subresources, - defaults to False - :param bool allow_update_subresources: shortcut to calling allow_update_subresources, - defaults to False - :param bool allow_delete_subresources: shortcut to calling allow_delete_subresources, - defaults to False - :returns a new TaskRouterCapabilityToken with capabilities set depending on kwargs. - """ - super(TaskRouterCapabilityToken, self).__init__( - secret_key=auth_token, - issuer=account_sid, - algorithm='HS256', - nbf=kwargs.get('nbf', Jwt.GENERATE), - ttl=kwargs.get('ttl', 3600), - valid_until=kwargs.get('valid_until', None), - ) - - self._validate_inputs(account_sid, workspace_sid, channel_id) - - self.account_sid = account_sid - self.auth_token = auth_token - self.workspace_sid = workspace_sid - self.channel_id = channel_id - self.policies = [] - - if kwargs.get('allow_web_sockets', True): - self.allow_web_sockets() - if kwargs.get('allow_fetch_self', True): - self.allow_fetch_self() - if kwargs.get('allow_update_self', False): - self.allow_update_self() - if kwargs.get('allow_delete_self', False): - self.allow_delete_self() - if kwargs.get('allow_fetch_subresources', False): - self.allow_fetch_subresources() - if kwargs.get('allow_delete_subresources', False): - self.allow_delete_subresources() - if kwargs.get('allow_update_subresources', False): - self.allow_update_subresources() - - @property - def workspace_url(self): - return '{}/{}/Workspaces/{}'.format(self.DOMAIN, self.VERSION, self.workspace_sid) - - @property - def resource_url(self): - raise NotImplementedError('Subclass must set its specific resource_url.') - - @property - def channel_prefix(self): - raise NotImplementedError('Subclass must set its specific channel_id sid prefix.') - - def allow_fetch_self(self): - self._make_policy(self.resource_url, 'GET', True) - - def allow_update_self(self): - self._make_policy(self.resource_url, 'POST', True) - - def allow_delete_self(self): - self._make_policy(self.resource_url, 'DELETE', True) - - def allow_fetch_subresources(self): - self._make_policy(self.resource_url + '/**', 'GET', True) - - def allow_update_subresources(self): - self._make_policy(self.resource_url + '/**', 'POST', True) - - def allow_delete_subresources(self): - self._make_policy(self.resource_url + '/**', 'DELETE', True) - - def allow_web_sockets(self, channel_id=None): - channel_id = channel_id or self.channel_id - web_socket_url = '{}/{}/{}'.format(self.EVENTS_BASE_URL, self.account_sid, channel_id) - self._make_policy(web_socket_url, 'GET', True) - self._make_policy(web_socket_url, 'POST', True) - - def _generate_payload(self): - payload = { - 'account_sid': self.account_sid, - 'workspace_sid': self.workspace_sid, - 'channel': self.channel_id, - 'version': self.VERSION, - 'friendly_name': self.channel_id, - 'policies': self.policies, - } - - if self.channel_id.startswith('WK'): - payload['worker_sid'] = self.channel_id - elif self.channel_id.startswith('WQ'): - payload['taskqueue_sid'] = self.channel_id - - return payload - - def _make_policy(self, url, method, allowed, query_filter=None, post_filter=None): - self.policies.append({ - 'url': url, - 'method': method.upper(), - 'allow': allowed, - 'query_filter': query_filter or {}, - 'post_filter': post_filter or {}, - }) - - def _validate_inputs(self, account_sid, workspace_sid, channel_id): - if not account_sid or not account_sid.startswith('AC'): - raise ValueError('Invalid account sid provided {}'.format(account_sid)) - - if not workspace_sid or not workspace_sid.startswith('WS'): - raise ValueError('Invalid workspace sid provided {}'.format(workspace_sid)) - - if not channel_id or not channel_id.startswith(self.channel_prefix): - raise ValueError('Invalid channel id provided {}'.format(channel_id)) - - def __str__(self): - return '<TaskRouterCapabilityToken {}>'.format(self.to_jwt()) - diff --git a/twilio/jwt/taskrouter/__pycache__/__init__.cpython-36.pyc b/twilio/jwt/taskrouter/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 05013d9..0000000 Binary files a/twilio/jwt/taskrouter/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/jwt/taskrouter/__pycache__/capabilities.cpython-36.pyc b/twilio/jwt/taskrouter/__pycache__/capabilities.cpython-36.pyc deleted file mode 100644 index 8fbe7ef..0000000 Binary files a/twilio/jwt/taskrouter/__pycache__/capabilities.cpython-36.pyc and /dev/null differ diff --git a/twilio/jwt/taskrouter/capabilities.py b/twilio/jwt/taskrouter/capabilities.py deleted file mode 100644 index 0f4cb8c..0000000 --- a/twilio/jwt/taskrouter/capabilities.py +++ /dev/null @@ -1,112 +0,0 @@ -from twilio.jwt.taskrouter import TaskRouterCapabilityToken - - -class WorkerCapabilityToken(TaskRouterCapabilityToken): - def __init__(self, account_sid, auth_token, workspace_sid, worker_sid, ttl=3600, **kwargs): - """ - :param kwargs: - All kwarg parameters supported by TaskRouterCapabilityToken - :param bool allow_fetch_activities: shortcut to calling allow_fetch_activities, - defaults to True - :param bool allow_fetch_reservations: shortcut to calling allow_fetch_reservations, - defaults to True - :param bool allow_fetch_worker_reservations: shortcut to calling allow_fetch_worker_reservations, - defaults to True - :param bool allow_update_activities: shortcut to calling allow_update_activities, - defaults to False - :param bool allow_update_reservations: shortcut to calling allow_update_reservations, - defaults to False - """ - super(WorkerCapabilityToken, self).__init__( - account_sid=account_sid, - auth_token=auth_token, - workspace_sid=workspace_sid, - channel_id=worker_sid, - ttl=ttl, - **kwargs - ) - - if kwargs.get('allow_fetch_activities', True): - self.allow_fetch_activities() - if kwargs.get('allow_fetch_reservations', True): - self.allow_fetch_reservations() - if kwargs.get('allow_fetch_worker_reservations', True): - self.allow_fetch_worker_reservations() - if kwargs.get('allow_update_activities', False): - self.allow_update_activities() - if kwargs.get('allow_update_reservations', False): - self.allow_update_reservations() - - @property - def resource_url(self): - return '{}/Workers/{}'.format(self.workspace_url, self.channel_id) - - @property - def channel_prefix(self): - return 'WK' - - def allow_fetch_activities(self): - self._make_policy(self.workspace_url + '/Activities', 'GET', True) - - def allow_fetch_reservations(self): - self._make_policy(self.workspace_url + '/Tasks/**', 'GET', True) - - def allow_fetch_worker_reservations(self): - self._make_policy(self.resource_url + '/Reservations/**', 'GET', True) - - def allow_update_activities(self): - post_filter = {'ActivitySid': {'required': True}} - self._make_policy(self.resource_url, 'POST', True, post_filter=post_filter) - - def allow_update_reservations(self): - self._make_policy(self.workspace_url + '/Tasks/**', 'POST', True) - self._make_policy(self.resource_url + '/Reservations/**', 'POST', True) - - def __str__(self): - return '<WorkerCapabilityToken {}>'.format(self.to_jwt()) - - -class TaskQueueCapabilityToken(TaskRouterCapabilityToken): - def __init__(self, account_sid, auth_token, workspace_sid, task_queue_sid, ttl=3600, **kwargs): - super(TaskQueueCapabilityToken, self).__init__( - account_sid=account_sid, - auth_token=auth_token, - workspace_sid=workspace_sid, - channel_id=task_queue_sid, - ttl=ttl, - **kwargs - ) - - @property - def resource_url(self): - return '{}/TaskQueues/{}'.format(self.workspace_url, self.channel_id) - - @property - def channel_prefix(self): - return 'WQ' - - def __str__(self): - return '<TaskQueueCapabilityToken {}>'.format(self.to_jwt()) - - -class WorkspaceCapabilityToken(TaskRouterCapabilityToken): - def __init__(self, account_sid, auth_token, workspace_sid, ttl=3600, **kwargs): - super(WorkspaceCapabilityToken, self).__init__( - account_sid=account_sid, - auth_token=auth_token, - workspace_sid=workspace_sid, - channel_id=workspace_sid, - ttl=ttl, - **kwargs - ) - - @property - def resource_url(self): - return self.workspace_url - - @property - def channel_prefix(self): - return 'WS' - - def __str__(self): - return '<WorkspaceCapabilityToken {}>'.format(self.to_jwt()) diff --git a/twilio/jwt/validation/__init__.py b/twilio/jwt/validation/__init__.py deleted file mode 100644 index 70c1d41..0000000 --- a/twilio/jwt/validation/__init__.py +++ /dev/null @@ -1,88 +0,0 @@ -from hashlib import sha256 -from six import string_types - -from twilio.jwt import Jwt - - -class ClientValidationJwt(Jwt): - """A JWT included on requests so that Twilio can verify request authenticity""" - __CTY = 'twilio-pkrv;v=1' - - def __init__(self, account_sid, api_key_sid, credential_sid, private_key, validation_payload): - """ - Create a new ClientValidationJwt - :param str account_sid: A Twilio Account Sid starting with 'AC' - :param str api_key_sid: A Twilio API Key Sid starting with 'SK' - :param str credential_sid: A Credential Sid starting with 'CR', - public key Twilio will use to verify the JWT. - :param str private_key: The private key used to sign the JWT. - :param ValidationPayload validation_payload: information from the request to sign - """ - super(ClientValidationJwt, self).__init__( - secret_key=private_key, - issuer=api_key_sid, - subject=account_sid, - algorithm='RS256', - ttl=300 # 5 minute ttl - ) - self.credential_sid = credential_sid - self.validation_payload = validation_payload - - def _generate_headers(self): - return { - 'cty': ClientValidationJwt.__CTY, - 'kid': self.credential_sid - } - - def _generate_payload(self): - # Lowercase header keys, combine and sort headers with list values - all_headers = {k.lower(): self._sort_and_join(v, ',') for k, v in self.validation_payload.all_headers.items()} - # Names of headers we are signing in the jwt - signed_headers = sorted(self.validation_payload.signed_headers) - - # Stringify headers, only include headers in signed_headers - headers_str = ['{}:{}'.format(h, all_headers[h]) for h in signed_headers if h in all_headers] - headers_str = '\n'.join(headers_str) - - # Sort query string parameters - query_string = self.validation_payload.query_string.split('&') - query_string = self._sort_and_join(query_string, '&') - - req_body_hash = self._hash(self.validation_payload.body) or '' - - signed_headers_str = ';'.join(signed_headers) - - signed_payload = [ - self.validation_payload.method, - self.validation_payload.path, - query_string, - ] - - if headers_str: - signed_payload.append(headers_str) - signed_payload.append('') - signed_payload.append(signed_headers_str) - signed_payload.append(req_body_hash) - - signed_payload = '\n'.join(signed_payload) - - return { - 'hrh': signed_headers_str, - 'rqh': self._hash(signed_payload) - } - - @classmethod - def _sort_and_join(self, values, joiner): - if isinstance(values, string_types): - return values - return joiner.join(sorted(values)) - - @classmethod - def _hash(self, input_str): - if not input_str: - return input_str - - if not isinstance(input_str, bytes): - input_str = input_str.encode('utf-8') - - return sha256(input_str).hexdigest() diff --git a/twilio/jwt/validation/__pycache__/__init__.cpython-36.pyc b/twilio/jwt/validation/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 57aa37f..0000000 Binary files a/twilio/jwt/validation/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/request_validator.py b/twilio/request_validator.py deleted file mode 100644 index f798b54..0000000 --- a/twilio/request_validator.py +++ /dev/null @@ -1,79 +0,0 @@ -import base64 -import hmac -from hashlib import sha1 - -from six import PY3 - -from twilio.compat import izip, urlparse - - -def compare(string1, string2): - """Compare two strings while protecting against timing attacks - - :param str string1: the first string - :param str string2: the second string - - :returns: True if the strings are equal, False if not - :rtype: :obj:`bool` - """ - if len(string1) != len(string2): - return False - result = True - for c1, c2 in izip(string1, string2): - result &= c1 == c2 - return result - - -def remove_port(uri): - """Remove the port number from a URI - - :param uri: full URI that Twilio requested on your server - - :returns: full URI without a port number - :rtype: str - """ - new_netloc = uri.netloc.split(':')[0] - new_uri = uri._replace(netloc=new_netloc) - return new_uri.geturl() - - -class RequestValidator(object): - - def __init__(self, token): - self.token = token.encode("utf-8") - - def compute_signature(self, uri, params, utf=PY3): - """Compute the signature for a given request - - :param uri: full URI that Twilio requested on your server - :param params: post vars that Twilio sent with the request - :param utf: whether return should be bytestring or unicode (python3) - - :returns: The computed signature - """ - s = uri - if len(params) > 0: - for k, v in sorted(params.items()): - s += k + v - - # compute signature and compare signatures - mac = hmac.new(self.token, s.encode("utf-8"), sha1) - computed = base64.b64encode(mac.digest()) - if utf: - computed = computed.decode('utf-8') - - return computed.strip() - - def validate(self, uri, params, signature): - """Validate a request from Twilio - - :param uri: full URI that Twilio requested on your server - :param params: post vars that Twilio sent with the request - :param signature: expected signature in HTTP X-Twilio-Signature header - - :returns: True if the request passes validation, False if not - """ - parsed_uri = urlparse(uri) - if parsed_uri.scheme == "https" and parsed_uri.port: - uri = remove_port(parsed_uri) - return compare(self.compute_signature(uri, params), signature) diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py deleted file mode 100644 index 0d10baf..0000000 --- a/twilio/rest/__init__.py +++ /dev/null @@ -1,599 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -import os -import platform -from twilio import __version__ -from twilio.base.exceptions import TwilioException -from twilio.base.obsolete import obsolete_client -from twilio.http.http_client import TwilioHttpClient - - -class Client(object): - """ A client for accessing the Twilio API. """ - - def __init__(self, username=None, password=None, account_sid=None, region=None, - http_client=None, environment=None): - """ - Initializes the Twilio Client - - :param str username: Username to authenticate with - :param str password: Password to authenticate with - :param str account_sid: Account Sid, defaults to Username - :param str region: Twilio Region to make requests to - :param HttpClient http_client: HttpClient, defaults to TwilioHttpClient - :param dict environment: Environment to look for auth details, defaults to os.environ - - :returns: Twilio Client - :rtype: twilio.rest.Client - """ - environment = environment or os.environ - - self.username = username or environment.get('TWILIO_ACCOUNT_SID') - """ :type : str """ - self.password = password or environment.get('TWILIO_AUTH_TOKEN') - """ :type : str """ - self.account_sid = account_sid or self.username - """ :type : str """ - self.region = region - """ :type : str """ - - if not self.username or not self.password: - raise TwilioException("Credentials are required to create a TwilioClient") - - self.auth = (self.username, self.password) - """ :type : tuple(str, str) """ - self.http_client = http_client or TwilioHttpClient() - """ :type : HttpClient """ - - # Domains - self._accounts = None - self._api = None - self._chat = None - self._fax = None - self._ip_messaging = None - self._lookups = None - self._monitor = None - self._notify = None - self._preview = None - self._pricing = None - self._proxy = None - self._taskrouter = None - self._trunking = None - self._video = None - self._messaging = None - self._wireless = None - self._sync = None - self._studio = None - - def request(self, method, uri, params=None, data=None, headers=None, auth=None, - timeout=None, allow_redirects=False): - """ - Makes a request to the Twilio API using the configured http client - Authentication information is automatically added if none is provided - - :param str method: HTTP Method - :param str uri: Fully qualified url - :param dict[str, str] params: Query string parameters - :param dict[str, str] data: POST body data - :param dict[str, str] headers: HTTP Headers - :param tuple(str, str) auth: Authentication - :param int timeout: Timeout in seconds - :param bool allow_redirects: Should the client follow redirects - - :returns: Response from the Twilio API - :rtype: twilio.http.response.Response - """ - auth = auth or self.auth - headers = headers or {} - - headers['User-Agent'] = 'twilio-python/{} (Python {})'.format( - __version__, - platform.python_version(), - ) - headers['X-Twilio-Client'] = 'python-{}'.format(__version__) - headers['Accept-Charset'] = 'utf-8' - - if method == 'POST' and 'Content-Type' not in headers: - headers['Content-Type'] = 'application/x-www-form-urlencoded' - - if 'Accept' not in headers: - headers['Accept'] = 'application/json' - - if self.region: - head, tail = uri.split('.', 1) - - if not tail.startswith(self.region): - uri = '.'.join([head, self.region, tail]) - - return self.http_client.request( - method, - uri, - params=params, - data=data, - headers=headers, - auth=auth, - timeout=timeout, - allow_redirects=allow_redirects - ) - - @property - def accounts(self): - """ - Access the Accounts Twilio Domain - - :returns: Accounts Twilio Domain - :rtype: twilio.rest.accounts.Accounts - """ - if self._accounts is None: - from twilio.rest.accounts import Accounts - self._accounts = Accounts(self) - return self._accounts - - @property - def api(self): - """ - Access the Api Twilio Domain - - :returns: Api Twilio Domain - :rtype: twilio.rest.api.Api - """ - if self._api is None: - from twilio.rest.api import Api - self._api = Api(self) - return self._api - - @property - def chat(self): - """ - Access the Chat Twilio Domain - - :returns: Chat Twilio Domain - :rtype: twilio.rest.chat.Chat - """ - if self._chat is None: - from twilio.rest.chat import Chat - self._chat = Chat(self) - return self._chat - - @property - def fax(self): - """ - Access the Fax Twilio Domain - - :returns: Fax Twilio Domain - :rtype: twilio.rest.fax.Fax - """ - if self._fax is None: - from twilio.rest.fax import Fax - self._fax = Fax(self) - return self._fax - - @property - def ip_messaging(self): - """ - Access the IpMessaging Twilio Domain - - :returns: IpMessaging Twilio Domain - :rtype: twilio.rest.ip_messaging.IpMessaging - """ - if self._ip_messaging is None: - from twilio.rest.ip_messaging import IpMessaging - self._ip_messaging = IpMessaging(self) - return self._ip_messaging - - @property - def lookups(self): - """ - Access the Lookups Twilio Domain - - :returns: Lookups Twilio Domain - :rtype: twilio.rest.lookups.Lookups - """ - if self._lookups is None: - from twilio.rest.lookups import Lookups - self._lookups = Lookups(self) - return self._lookups - - @property - def monitor(self): - """ - Access the Monitor Twilio Domain - - :returns: Monitor Twilio Domain - :rtype: twilio.rest.monitor.Monitor - """ - if self._monitor is None: - from twilio.rest.monitor import Monitor - self._monitor = Monitor(self) - return self._monitor - - @property - def notify(self): - """ - Access the Notify Twilio Domain - - :returns: Notify Twilio Domain - :rtype: twilio.rest.notify.Notify - """ - if self._notify is None: - from twilio.rest.notify import Notify - self._notify = Notify(self) - return self._notify - - @property - def preview(self): - """ - Access the Preview Twilio Domain - - :returns: Preview Twilio Domain - :rtype: twilio.rest.preview.Preview - """ - if self._preview is None: - from twilio.rest.preview import Preview - self._preview = Preview(self) - return self._preview - - @property - def pricing(self): - """ - Access the Pricing Twilio Domain - - :returns: Pricing Twilio Domain - :rtype: twilio.rest.pricing.Pricing - """ - if self._pricing is None: - from twilio.rest.pricing import Pricing - self._pricing = Pricing(self) - return self._pricing - - @property - def proxy(self): - """ - Access the Proxy Twilio Domain - - :returns: Proxy Twilio Domain - :rtype: twilio.rest.proxy.Proxy - """ - if self._proxy is None: - from twilio.rest.proxy import Proxy - self._proxy = Proxy(self) - return self._proxy - - @property - def taskrouter(self): - """ - Access the Taskrouter Twilio Domain - - :returns: Taskrouter Twilio Domain - :rtype: twilio.rest.taskrouter.Taskrouter - """ - if self._taskrouter is None: - from twilio.rest.taskrouter import Taskrouter - self._taskrouter = Taskrouter(self) - return self._taskrouter - - @property - def trunking(self): - """ - Access the Trunking Twilio Domain - - :returns: Trunking Twilio Domain - :rtype: twilio.rest.trunking.Trunking - """ - if self._trunking is None: - from twilio.rest.trunking import Trunking - self._trunking = Trunking(self) - return self._trunking - - @property - def video(self): - """ - Access the Video Twilio Domain - - :returns: Video Twilio Domain - :rtype: twilio.rest.video.Video - """ - if self._video is None: - from twilio.rest.video import Video - self._video = Video(self) - return self._video - - @property - def messaging(self): - """ - Access the Messaging Twilio Domain - - :returns: Messaging Twilio Domain - :rtype: twilio.rest.messaging.Messaging - """ - if self._messaging is None: - from twilio.rest.messaging import Messaging - self._messaging = Messaging(self) - return self._messaging - - @property - def wireless(self): - """ - Access the Wireless Twilio Domain - - :returns: Wireless Twilio Domain - :rtype: twilio.rest.wireless.Wireless - """ - if self._wireless is None: - from twilio.rest.wireless import Wireless - self._wireless = Wireless(self) - return self._wireless - - @property - def sync(self): - """ - Access the Sync Twilio Domain - - :returns: Sync Twilio Domain - :rtype: twilio.rest.sync.Sync - """ - if self._sync is None: - from twilio.rest.sync import Sync - self._sync = Sync(self) - return self._sync - - @property - def studio(self): - """ - Access the Studio Twilio Domain - - :returns: Studio Twilio Domain - :rtype: twilio.rest.studio.Studio - """ - if self._studio is None: - from twilio.rest.studio import Studio - self._studio = Studio(self) - return self._studio - - @property - def addresses(self): - """ - :rtype: twilio.rest.api.v2010.account.address.AddressList - """ - return self.api.account.addresses - - @property - def applications(self): - """ - :rtype: twilio.rest.api.v2010.account.application.ApplicationList - """ - return self.api.account.applications - - @property - def authorized_connect_apps(self): - """ - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - """ - return self.api.account.authorized_connect_apps - - @property - def available_phone_numbers(self): - """ - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - """ - return self.api.account.available_phone_numbers - - @property - def calls(self): - """ - :rtype: twilio.rest.api.v2010.account.call.CallList - """ - return self.api.account.calls - - @property - def conferences(self): - """ - :rtype: twilio.rest.api.v2010.account.conference.ConferenceList - """ - return self.api.account.conferences - - @property - def connect_apps(self): - """ - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppList - """ - return self.api.account.connect_apps - - @property - def incoming_phone_numbers(self): - """ - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - """ - return self.api.account.incoming_phone_numbers - - @property - def keys(self): - """ - :rtype: twilio.rest.api.v2010.account.key.KeyList - """ - return self.api.account.keys - - @property - def messages(self): - """ - :rtype: twilio.rest.api.v2010.account.message.MessageList - """ - return self.api.account.messages - - @property - def new_keys(self): - """ - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList - """ - return self.api.account.new_keys - - @property - def new_signing_keys(self): - """ - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - """ - return self.api.account.new_signing_keys - - @property - def notifications(self): - """ - :rtype: twilio.rest.api.v2010.account.notification.NotificationList - """ - return self.api.account.notifications - - @property - def outgoing_caller_ids(self): - """ - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - """ - return self.api.account.outgoing_caller_ids - - @property - def queues(self): - """ - :rtype: twilio.rest.api.v2010.account.queue.QueueList - """ - return self.api.account.queues - - @property - def recordings(self): - """ - :rtype: twilio.rest.api.v2010.account.recording.RecordingList - """ - return self.api.account.recordings - - @property - def signing_keys(self): - """ - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyList - """ - return self.api.account.signing_keys - - @property - def sip(self): - """ - :rtype: twilio.rest.api.v2010.account.sip.SipList - """ - return self.api.account.sip - - @property - def short_codes(self): - """ - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeList - """ - return self.api.account.short_codes - - @property - def tokens(self): - """ - :rtype: twilio.rest.api.v2010.account.token.TokenList - """ - return self.api.account.tokens - - @property - def transcriptions(self): - """ - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionList - """ - return self.api.account.transcriptions - - @property - def usage(self): - """ - :rtype: twilio.rest.api.v2010.account.usage.UsageList - """ - return self.api.account.usage - - @property - def validation_requests(self): - """ - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - """ - return self.api.account.validation_requests - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio {}>'.format(self.account_sid) - - -@obsolete_client -class TwilioClient(object): - """ Dummy client which provides no functionality. Please use - twilio.rest.Client instead. """ - - def __init__(self, *args): - pass - - -@obsolete_client -class TwilioRestClient(object): - """ Dummy client which provides no functionality. Please use - twilio.rest.Client instead. """ - - def __init__(self, *args): - pass - - -@obsolete_client -class TwilioIpMessagingClient(object): - """ Dummy client which provides no functionality. Please use - twilio.rest.Client instead. """ - - def __init__(self, *args): - pass - - -@obsolete_client -class TwilioLookupsClient(object): - """ Dummy client which provides no functionality. Please use - twilio.rest.Client instead. """ - - def __init__(self, *args): - pass - - -@obsolete_client -class TwilioMonitorClient(object): - """ Dummy client which provides no functionality. Please use - twilio.rest.Client instead. """ - - def __init__(self, *args): - pass - - -@obsolete_client -class TwilioPricingClient(object): - """ Dummy client which provides no functionality. Please use - twilio.rest.Client instead. """ - - def __init__(self, *args): - pass - - -@obsolete_client -class TwilioTaskRouterClient(object): - """ Dummy client which provides no functionality. Please use - twilio.rest.Client instead. """ - - def __init__(self, *args): - pass - - -@obsolete_client -class TwilioTrunkingClient(object): - """ Dummy client which provides no functionality. Please use - twilio.rest.Client instead. """ - - def __init__(self, *args): - pass diff --git a/twilio/rest/__pycache__/__init__.cpython-36.pyc b/twilio/rest/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index ff164a1..0000000 Binary files a/twilio/rest/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/accounts/__init__.py b/twilio/rest/accounts/__init__.py deleted file mode 100644 index a591948..0000000 --- a/twilio/rest/accounts/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.accounts.v1 import V1 - - -class Accounts(Domain): - - def __init__(self, twilio): - """ - Initialize the Accounts Domain - - :returns: Domain for Accounts - :rtype: twilio.rest.accounts.Accounts - """ - super(Accounts, self).__init__(twilio) - - self.base_url = 'https://accounts.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of accounts - :rtype: twilio.rest.accounts.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def credentials(self): - """ - :rtype: twilio.rest.accounts.v1.credential.CredentialList - """ - return self.v1.credentials - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Accounts>' diff --git a/twilio/rest/accounts/__pycache__/__init__.cpython-36.pyc b/twilio/rest/accounts/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index aadffbe..0000000 Binary files a/twilio/rest/accounts/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/accounts/v1/__init__.py b/twilio/rest/accounts/v1/__init__.py deleted file mode 100644 index 3841d15..0000000 --- a/twilio/rest/accounts/v1/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.accounts.v1.credential import CredentialList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Accounts - - :returns: V1 version of Accounts - :rtype: twilio.rest.accounts.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._credentials = None - - @property - def credentials(self): - """ - :rtype: twilio.rest.accounts.v1.credential.CredentialList - """ - if self._credentials is None: - self._credentials = CredentialList(self) - return self._credentials - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Accounts.V1>' diff --git a/twilio/rest/accounts/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/accounts/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 27aace6..0000000 Binary files a/twilio/rest/accounts/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/accounts/v1/credential/__init__.py b/twilio/rest/accounts/v1/credential/__init__.py deleted file mode 100644 index 9eb299d..0000000 --- a/twilio/rest/accounts/v1/credential/__init__.py +++ /dev/null @@ -1,133 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.accounts.v1.credential.aws import AwsList -from twilio.rest.accounts.v1.credential.public_key import PublicKeyList - - -class CredentialList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the CredentialList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.accounts.v1.credential.CredentialList - :rtype: twilio.rest.accounts.v1.credential.CredentialList - """ - super(CredentialList, self).__init__(version) - - # Path Solution - self._solution = {} - - # Components - self._public_key = None - self._aws = None - - @property - def public_key(self): - """ - Access the public_key - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyList - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyList - """ - if self._public_key is None: - self._public_key = PublicKeyList(self._version, ) - return self._public_key - - @property - def aws(self): - """ - Access the aws - - :returns: twilio.rest.accounts.v1.credential.aws.AwsList - :rtype: twilio.rest.accounts.v1.credential.aws.AwsList - """ - if self._aws is None: - self._aws = AwsList(self._version, ) - return self._aws - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Accounts.V1.CredentialList>' - - -class CredentialPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the CredentialPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.accounts.v1.credential.CredentialPage - :rtype: twilio.rest.accounts.v1.credential.CredentialPage - """ - super(CredentialPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.accounts.v1.credential.CredentialInstance - :rtype: twilio.rest.accounts.v1.credential.CredentialInstance - """ - return CredentialInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Accounts.V1.CredentialPage>' - - -class CredentialInstance(InstanceResource): - """ """ - - def __init__(self, version, payload): - """ - Initialize the CredentialInstance - - :returns: twilio.rest.accounts.v1.credential.CredentialInstance - :rtype: twilio.rest.accounts.v1.credential.CredentialInstance - """ - super(CredentialInstance, self).__init__(version) - - # Context - self._context = None - self._solution = {} - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Accounts.V1.CredentialInstance>' diff --git a/twilio/rest/accounts/v1/credential/__pycache__/__init__.cpython-36.pyc b/twilio/rest/accounts/v1/credential/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 45e2722..0000000 Binary files a/twilio/rest/accounts/v1/credential/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/accounts/v1/credential/__pycache__/aws.cpython-36.pyc b/twilio/rest/accounts/v1/credential/__pycache__/aws.cpython-36.pyc deleted file mode 100644 index 67c9b10..0000000 Binary files a/twilio/rest/accounts/v1/credential/__pycache__/aws.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/accounts/v1/credential/__pycache__/public_key.cpython-36.pyc b/twilio/rest/accounts/v1/credential/__pycache__/public_key.cpython-36.pyc deleted file mode 100644 index 8817cd7..0000000 Binary files a/twilio/rest/accounts/v1/credential/__pycache__/public_key.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/accounts/v1/credential/aws.py b/twilio/rest/accounts/v1/credential/aws.py deleted file mode 100644 index 58d71f5..0000000 --- a/twilio/rest/accounts/v1/credential/aws.py +++ /dev/null @@ -1,412 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class AwsList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the AwsList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.accounts.v1.credential.aws.AwsList - :rtype: twilio.rest.accounts.v1.credential.aws.AwsList - """ - super(AwsList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Credentials/AWS'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AwsInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.accounts.v1.credential.aws.AwsInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AwsInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.accounts.v1.credential.aws.AwsInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AwsInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AwsPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AwsInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AwsPage(self._version, response, self._solution) - - def create(self, credentials, friendly_name=values.unset, - account_sid=values.unset): - """ - Create a new AwsInstance - - :param unicode credentials: The credentials - :param unicode friendly_name: The friendly_name - :param unicode account_sid: The account_sid - - :returns: Newly created AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance - """ - data = values.of({ - 'Credentials': credentials, - 'FriendlyName': friendly_name, - 'AccountSid': account_sid, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return AwsInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a AwsContext - - :param sid: The sid - - :returns: twilio.rest.accounts.v1.credential.aws.AwsContext - :rtype: twilio.rest.accounts.v1.credential.aws.AwsContext - """ - return AwsContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AwsContext - - :param sid: The sid - - :returns: twilio.rest.accounts.v1.credential.aws.AwsContext - :rtype: twilio.rest.accounts.v1.credential.aws.AwsContext - """ - return AwsContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Accounts.V1.AwsList>' - - -class AwsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the AwsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.accounts.v1.credential.aws.AwsPage - :rtype: twilio.rest.accounts.v1.credential.aws.AwsPage - """ - super(AwsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AwsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.accounts.v1.credential.aws.AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance - """ - return AwsInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Accounts.V1.AwsPage>' - - -class AwsContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the AwsContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.accounts.v1.credential.aws.AwsContext - :rtype: twilio.rest.accounts.v1.credential.aws.AwsContext - """ - super(AwsContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Credentials/AWS/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a AwsInstance - - :returns: Fetched AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return AwsInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset): - """ - Update the AwsInstance - - :param unicode friendly_name: The friendly_name - - :returns: Updated AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return AwsInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the AwsInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Accounts.V1.AwsContext {}>'.format(context) - - -class AwsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the AwsInstance - - :returns: twilio.rest.accounts.v1.credential.aws.AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance - """ - super(AwsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AwsContext for this AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsContext - """ - if self._context is None: - self._context = AwsContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a AwsInstance - - :returns: Fetched AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset): - """ - Update the AwsInstance - - :param unicode friendly_name: The friendly_name - - :returns: Updated AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) - - def delete(self): - """ - Deletes the AwsInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Accounts.V1.AwsInstance {}>'.format(context) diff --git a/twilio/rest/accounts/v1/credential/public_key.py b/twilio/rest/accounts/v1/credential/public_key.py deleted file mode 100644 index c3fcf95..0000000 --- a/twilio/rest/accounts/v1/credential/public_key.py +++ /dev/null @@ -1,412 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class PublicKeyList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the PublicKeyList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyList - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyList - """ - super(PublicKeyList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Credentials/PublicKeys'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams PublicKeyInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PublicKeyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PublicKeyInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return PublicKeyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PublicKeyInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PublicKeyPage(self._version, response, self._solution) - - def create(self, public_key, friendly_name=values.unset, - account_sid=values.unset): - """ - Create a new PublicKeyInstance - - :param unicode public_key: URL encoded representation of the public key - :param unicode friendly_name: A human readable description of this resource - :param unicode account_sid: The Subaccount this Credential should be associated with. - - :returns: Newly created PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - """ - data = values.of({ - 'PublicKey': public_key, - 'FriendlyName': friendly_name, - 'AccountSid': account_sid, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return PublicKeyInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a PublicKeyContext - - :param sid: Fetch by unique Credential Sid - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - """ - return PublicKeyContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a PublicKeyContext - - :param sid: Fetch by unique Credential Sid - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - """ - return PublicKeyContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Accounts.V1.PublicKeyList>' - - -class PublicKeyPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the PublicKeyPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyPage - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyPage - """ - super(PublicKeyPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PublicKeyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - """ - return PublicKeyInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Accounts.V1.PublicKeyPage>' - - -class PublicKeyContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the PublicKeyContext - - :param Version version: Version that contains the resource - :param sid: Fetch by unique Credential Sid - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - """ - super(PublicKeyContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Credentials/PublicKeys/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a PublicKeyInstance - - :returns: Fetched PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return PublicKeyInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset): - """ - Update the PublicKeyInstance - - :param unicode friendly_name: A human readable description of this resource - - :returns: Updated PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return PublicKeyInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the PublicKeyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Accounts.V1.PublicKeyContext {}>'.format(context) - - -class PublicKeyInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the PublicKeyInstance - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - """ - super(PublicKeyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PublicKeyContext for this PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - """ - if self._context is None: - self._context = PublicKeyContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: AccountSid the Credential resource belongs to - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URI for this resource, relative to `https://accounts.twilio.com` - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a PublicKeyInstance - - :returns: Fetched PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset): - """ - Update the PublicKeyInstance - - :param unicode friendly_name: A human readable description of this resource - - :returns: Updated PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) - - def delete(self): - """ - Deletes the PublicKeyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Accounts.V1.PublicKeyInstance {}>'.format(context) diff --git a/twilio/rest/api/__init__.py b/twilio/rest/api/__init__.py deleted file mode 100644 index c14010d..0000000 --- a/twilio/rest/api/__init__.py +++ /dev/null @@ -1,222 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.api.v2010 import V2010 - - -class Api(Domain): - - def __init__(self, twilio): - """ - Initialize the Api Domain - - :returns: Domain for Api - :rtype: twilio.rest.api.Api - """ - super(Api, self).__init__(twilio) - - self.base_url = 'https://api.twilio.com' - - # Versions - self._v2010 = None - - @property - def v2010(self): - """ - :returns: Version v2010 of api - :rtype: twilio.rest.api.v2010.V2010 - """ - if self._v2010 is None: - self._v2010 = V2010(self) - return self._v2010 - - @property - def account(self): - """ - :returns: Account provided as the authenticating account - :rtype: twilio.rest.api.v2010.account.AccountContext - """ - return self.v2010.account - - @property - def accounts(self): - """ - :rtype: twilio.rest.api.v2010.account.AccountList - """ - return self.v2010.accounts - - @property - def addresses(self): - """ - :rtype: twilio.rest.api.v2010.account.address.AddressList - """ - return self.account.addresses - - @property - def applications(self): - """ - :rtype: twilio.rest.api.v2010.account.application.ApplicationList - """ - return self.account.applications - - @property - def authorized_connect_apps(self): - """ - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - """ - return self.account.authorized_connect_apps - - @property - def available_phone_numbers(self): - """ - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - """ - return self.account.available_phone_numbers - - @property - def calls(self): - """ - :rtype: twilio.rest.api.v2010.account.call.CallList - """ - return self.account.calls - - @property - def conferences(self): - """ - :rtype: twilio.rest.api.v2010.account.conference.ConferenceList - """ - return self.account.conferences - - @property - def connect_apps(self): - """ - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppList - """ - return self.account.connect_apps - - @property - def incoming_phone_numbers(self): - """ - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - """ - return self.account.incoming_phone_numbers - - @property - def keys(self): - """ - :rtype: twilio.rest.api.v2010.account.key.KeyList - """ - return self.account.keys - - @property - def messages(self): - """ - :rtype: twilio.rest.api.v2010.account.message.MessageList - """ - return self.account.messages - - @property - def new_keys(self): - """ - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList - """ - return self.account.new_keys - - @property - def new_signing_keys(self): - """ - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - """ - return self.account.new_signing_keys - - @property - def notifications(self): - """ - :rtype: twilio.rest.api.v2010.account.notification.NotificationList - """ - return self.account.notifications - - @property - def outgoing_caller_ids(self): - """ - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - """ - return self.account.outgoing_caller_ids - - @property - def queues(self): - """ - :rtype: twilio.rest.api.v2010.account.queue.QueueList - """ - return self.account.queues - - @property - def recordings(self): - """ - :rtype: twilio.rest.api.v2010.account.recording.RecordingList - """ - return self.account.recordings - - @property - def signing_keys(self): - """ - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyList - """ - return self.account.signing_keys - - @property - def sip(self): - """ - :rtype: twilio.rest.api.v2010.account.sip.SipList - """ - return self.account.sip - - @property - def short_codes(self): - """ - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeList - """ - return self.account.short_codes - - @property - def tokens(self): - """ - :rtype: twilio.rest.api.v2010.account.token.TokenList - """ - return self.account.tokens - - @property - def transcriptions(self): - """ - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionList - """ - return self.account.transcriptions - - @property - def usage(self): - """ - :rtype: twilio.rest.api.v2010.account.usage.UsageList - """ - return self.account.usage - - @property - def validation_requests(self): - """ - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - """ - return self.account.validation_requests - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api>' diff --git a/twilio/rest/api/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index fb32a65..0000000 Binary files a/twilio/rest/api/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/__init__.py b/twilio/rest/api/v2010/__init__.py deleted file mode 100644 index 49aa728..0000000 --- a/twilio/rest/api/v2010/__init__.py +++ /dev/null @@ -1,224 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.api.v2010.account import AccountContext -from twilio.rest.api.v2010.account import AccountList - - -class V2010(Version): - - def __init__(self, domain): - """ - Initialize the V2010 version of Api - - :returns: V2010 version of Api - :rtype: twilio.rest.api.v2010.V2010.V2010 - """ - super(V2010, self).__init__(domain) - self.version = '2010-04-01' - self._accounts = None - self._account = None - - @property - def accounts(self): - """ - :rtype: twilio.rest.api.v2010.account.AccountList - """ - if self._accounts is None: - self._accounts = AccountList(self) - return self._accounts - - @property - def account(self): - """ - :returns: Account provided as the authenticating account - :rtype: AccountContext - """ - if self._account is None: - self._account = AccountContext(self, self.domain.twilio.account_sid) - return self._account - - @account.setter - def account(self, value): - """ - Setter to override the primary account - - :param AccountContext|AccountInstance value: account to use as primary account - """ - self._account = value - - @property - def addresses(self): - """ - :rtype: twilio.rest.api.v2010.account.address.AddressList - """ - return self.account.addresses - - @property - def applications(self): - """ - :rtype: twilio.rest.api.v2010.account.application.ApplicationList - """ - return self.account.applications - - @property - def authorized_connect_apps(self): - """ - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - """ - return self.account.authorized_connect_apps - - @property - def available_phone_numbers(self): - """ - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - """ - return self.account.available_phone_numbers - - @property - def calls(self): - """ - :rtype: twilio.rest.api.v2010.account.call.CallList - """ - return self.account.calls - - @property - def conferences(self): - """ - :rtype: twilio.rest.api.v2010.account.conference.ConferenceList - """ - return self.account.conferences - - @property - def connect_apps(self): - """ - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppList - """ - return self.account.connect_apps - - @property - def incoming_phone_numbers(self): - """ - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - """ - return self.account.incoming_phone_numbers - - @property - def keys(self): - """ - :rtype: twilio.rest.api.v2010.account.key.KeyList - """ - return self.account.keys - - @property - def messages(self): - """ - :rtype: twilio.rest.api.v2010.account.message.MessageList - """ - return self.account.messages - - @property - def new_keys(self): - """ - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList - """ - return self.account.new_keys - - @property - def new_signing_keys(self): - """ - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - """ - return self.account.new_signing_keys - - @property - def notifications(self): - """ - :rtype: twilio.rest.api.v2010.account.notification.NotificationList - """ - return self.account.notifications - - @property - def outgoing_caller_ids(self): - """ - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - """ - return self.account.outgoing_caller_ids - - @property - def queues(self): - """ - :rtype: twilio.rest.api.v2010.account.queue.QueueList - """ - return self.account.queues - - @property - def recordings(self): - """ - :rtype: twilio.rest.api.v2010.account.recording.RecordingList - """ - return self.account.recordings - - @property - def signing_keys(self): - """ - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyList - """ - return self.account.signing_keys - - @property - def sip(self): - """ - :rtype: twilio.rest.api.v2010.account.sip.SipList - """ - return self.account.sip - - @property - def short_codes(self): - """ - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeList - """ - return self.account.short_codes - - @property - def tokens(self): - """ - :rtype: twilio.rest.api.v2010.account.token.TokenList - """ - return self.account.tokens - - @property - def transcriptions(self): - """ - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionList - """ - return self.account.transcriptions - - @property - def usage(self): - """ - :rtype: twilio.rest.api.v2010.account.usage.UsageList - """ - return self.account.usage - - @property - def validation_requests(self): - """ - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - """ - return self.account.validation_requests - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010>' diff --git a/twilio/rest/api/v2010/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 9bff5b0..0000000 Binary files a/twilio/rest/api/v2010/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__init__.py b/twilio/rest/api/v2010/account/__init__.py deleted file mode 100644 index abe9891..0000000 --- a/twilio/rest/api/v2010/account/__init__.py +++ /dev/null @@ -1,1017 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.address import AddressList -from twilio.rest.api.v2010.account.application import ApplicationList -from twilio.rest.api.v2010.account.authorized_connect_app import AuthorizedConnectAppList -from twilio.rest.api.v2010.account.available_phone_number import AvailablePhoneNumberCountryList -from twilio.rest.api.v2010.account.call import CallList -from twilio.rest.api.v2010.account.conference import ConferenceList -from twilio.rest.api.v2010.account.connect_app import ConnectAppList -from twilio.rest.api.v2010.account.incoming_phone_number import IncomingPhoneNumberList -from twilio.rest.api.v2010.account.key import KeyList -from twilio.rest.api.v2010.account.message import MessageList -from twilio.rest.api.v2010.account.new_key import NewKeyList -from twilio.rest.api.v2010.account.new_signing_key import NewSigningKeyList -from twilio.rest.api.v2010.account.notification import NotificationList -from twilio.rest.api.v2010.account.outgoing_caller_id import OutgoingCallerIdList -from twilio.rest.api.v2010.account.queue import QueueList -from twilio.rest.api.v2010.account.recording import RecordingList -from twilio.rest.api.v2010.account.short_code import ShortCodeList -from twilio.rest.api.v2010.account.signing_key import SigningKeyList -from twilio.rest.api.v2010.account.sip import SipList -from twilio.rest.api.v2010.account.token import TokenList -from twilio.rest.api.v2010.account.transcription import TranscriptionList -from twilio.rest.api.v2010.account.usage import UsageList -from twilio.rest.api.v2010.account.validation_request import ValidationRequestList - - -class AccountList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the AccountList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.api.v2010.account.AccountList - :rtype: twilio.rest.api.v2010.account.AccountList - """ - super(AccountList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Accounts.json'.format(**self._solution) - - def create(self, friendly_name=values.unset): - """ - Create a new AccountInstance - - :param unicode friendly_name: A human readable description of the account - - :returns: Newly created AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return AccountInstance(self._version, payload, ) - - def stream(self, friendly_name=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Streams AccountInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode friendly_name: FriendlyName to filter on - :param AccountInstance.Status status: Status to filter on - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.AccountInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, status=status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, friendly_name=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Lists AccountInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: FriendlyName to filter on - :param AccountInstance.Status status: Status to filter on - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.AccountInstance] - """ - return list(self.stream( - friendly_name=friendly_name, - status=status, - limit=limit, - page_size=page_size, - )) - - def page(self, friendly_name=values.unset, status=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AccountInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: FriendlyName to filter on - :param AccountInstance.Status status: Status to filter on - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountPage - """ - params = values.of({ - 'FriendlyName': friendly_name, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AccountPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AccountInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AccountPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AccountContext - - :param sid: Fetch by unique Account Sid - - :returns: twilio.rest.api.v2010.account.AccountContext - :rtype: twilio.rest.api.v2010.account.AccountContext - """ - return AccountContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AccountContext - - :param sid: Fetch by unique Account Sid - - :returns: twilio.rest.api.v2010.account.AccountContext - :rtype: twilio.rest.api.v2010.account.AccountContext - """ - return AccountContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AccountList>' - - -class AccountPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the AccountPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.api.v2010.account.AccountPage - :rtype: twilio.rest.api.v2010.account.AccountPage - """ - super(AccountPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AccountInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance - """ - return AccountInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AccountPage>' - - -class AccountContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the AccountContext - - :param Version version: Version that contains the resource - :param sid: Fetch by unique Account Sid - - :returns: twilio.rest.api.v2010.account.AccountContext - :rtype: twilio.rest.api.v2010.account.AccountContext - """ - super(AccountContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Accounts/{sid}.json'.format(**self._solution) - - # Dependents - self._addresses = None - self._applications = None - self._authorized_connect_apps = None - self._available_phone_numbers = None - self._calls = None - self._conferences = None - self._connect_apps = None - self._incoming_phone_numbers = None - self._keys = None - self._messages = None - self._new_keys = None - self._new_signing_keys = None - self._notifications = None - self._outgoing_caller_ids = None - self._queues = None - self._recordings = None - self._signing_keys = None - self._sip = None - self._short_codes = None - self._tokens = None - self._transcriptions = None - self._usage = None - self._validation_requests = None - - def fetch(self): - """ - Fetch a AccountInstance - - :returns: Fetched AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return AccountInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, status=values.unset): - """ - Update the AccountInstance - - :param unicode friendly_name: FriendlyName to update - :param AccountInstance.Status status: Status to update the Account with - - :returns: Updated AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance - """ - data = values.of({'FriendlyName': friendly_name, 'Status': status, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return AccountInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def addresses(self): - """ - Access the addresses - - :returns: twilio.rest.api.v2010.account.address.AddressList - :rtype: twilio.rest.api.v2010.account.address.AddressList - """ - if self._addresses is None: - self._addresses = AddressList(self._version, account_sid=self._solution['sid'], ) - return self._addresses - - @property - def applications(self): - """ - Access the applications - - :returns: twilio.rest.api.v2010.account.application.ApplicationList - :rtype: twilio.rest.api.v2010.account.application.ApplicationList - """ - if self._applications is None: - self._applications = ApplicationList(self._version, account_sid=self._solution['sid'], ) - return self._applications - - @property - def authorized_connect_apps(self): - """ - Access the authorized_connect_apps - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - """ - if self._authorized_connect_apps is None: - self._authorized_connect_apps = AuthorizedConnectAppList( - self._version, - account_sid=self._solution['sid'], - ) - return self._authorized_connect_apps - - @property - def available_phone_numbers(self): - """ - Access the available_phone_numbers - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - """ - if self._available_phone_numbers is None: - self._available_phone_numbers = AvailablePhoneNumberCountryList( - self._version, - account_sid=self._solution['sid'], - ) - return self._available_phone_numbers - - @property - def calls(self): - """ - Access the calls - - :returns: twilio.rest.api.v2010.account.call.CallList - :rtype: twilio.rest.api.v2010.account.call.CallList - """ - if self._calls is None: - self._calls = CallList(self._version, account_sid=self._solution['sid'], ) - return self._calls - - @property - def conferences(self): - """ - Access the conferences - - :returns: twilio.rest.api.v2010.account.conference.ConferenceList - :rtype: twilio.rest.api.v2010.account.conference.ConferenceList - """ - if self._conferences is None: - self._conferences = ConferenceList(self._version, account_sid=self._solution['sid'], ) - return self._conferences - - @property - def connect_apps(self): - """ - Access the connect_apps - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppList - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppList - """ - if self._connect_apps is None: - self._connect_apps = ConnectAppList(self._version, account_sid=self._solution['sid'], ) - return self._connect_apps - - @property - def incoming_phone_numbers(self): - """ - Access the incoming_phone_numbers - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - """ - if self._incoming_phone_numbers is None: - self._incoming_phone_numbers = IncomingPhoneNumberList( - self._version, - account_sid=self._solution['sid'], - ) - return self._incoming_phone_numbers - - @property - def keys(self): - """ - Access the keys - - :returns: twilio.rest.api.v2010.account.key.KeyList - :rtype: twilio.rest.api.v2010.account.key.KeyList - """ - if self._keys is None: - self._keys = KeyList(self._version, account_sid=self._solution['sid'], ) - return self._keys - - @property - def messages(self): - """ - Access the messages - - :returns: twilio.rest.api.v2010.account.message.MessageList - :rtype: twilio.rest.api.v2010.account.message.MessageList - """ - if self._messages is None: - self._messages = MessageList(self._version, account_sid=self._solution['sid'], ) - return self._messages - - @property - def new_keys(self): - """ - Access the new_keys - - :returns: twilio.rest.api.v2010.account.new_key.NewKeyList - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList - """ - if self._new_keys is None: - self._new_keys = NewKeyList(self._version, account_sid=self._solution['sid'], ) - return self._new_keys - - @property - def new_signing_keys(self): - """ - Access the new_signing_keys - - :returns: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - """ - if self._new_signing_keys is None: - self._new_signing_keys = NewSigningKeyList(self._version, account_sid=self._solution['sid'], ) - return self._new_signing_keys - - @property - def notifications(self): - """ - Access the notifications - - :returns: twilio.rest.api.v2010.account.notification.NotificationList - :rtype: twilio.rest.api.v2010.account.notification.NotificationList - """ - if self._notifications is None: - self._notifications = NotificationList(self._version, account_sid=self._solution['sid'], ) - return self._notifications - - @property - def outgoing_caller_ids(self): - """ - Access the outgoing_caller_ids - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - """ - if self._outgoing_caller_ids is None: - self._outgoing_caller_ids = OutgoingCallerIdList(self._version, account_sid=self._solution['sid'], ) - return self._outgoing_caller_ids - - @property - def queues(self): - """ - Access the queues - - :returns: twilio.rest.api.v2010.account.queue.QueueList - :rtype: twilio.rest.api.v2010.account.queue.QueueList - """ - if self._queues is None: - self._queues = QueueList(self._version, account_sid=self._solution['sid'], ) - return self._queues - - @property - def recordings(self): - """ - Access the recordings - - :returns: twilio.rest.api.v2010.account.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.recording.RecordingList - """ - if self._recordings is None: - self._recordings = RecordingList(self._version, account_sid=self._solution['sid'], ) - return self._recordings - - @property - def signing_keys(self): - """ - Access the signing_keys - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyList - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyList - """ - if self._signing_keys is None: - self._signing_keys = SigningKeyList(self._version, account_sid=self._solution['sid'], ) - return self._signing_keys - - @property - def sip(self): - """ - Access the sip - - :returns: twilio.rest.api.v2010.account.sip.SipList - :rtype: twilio.rest.api.v2010.account.sip.SipList - """ - if self._sip is None: - self._sip = SipList(self._version, account_sid=self._solution['sid'], ) - return self._sip - - @property - def short_codes(self): - """ - Access the short_codes - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeList - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeList - """ - if self._short_codes is None: - self._short_codes = ShortCodeList(self._version, account_sid=self._solution['sid'], ) - return self._short_codes - - @property - def tokens(self): - """ - Access the tokens - - :returns: twilio.rest.api.v2010.account.token.TokenList - :rtype: twilio.rest.api.v2010.account.token.TokenList - """ - if self._tokens is None: - self._tokens = TokenList(self._version, account_sid=self._solution['sid'], ) - return self._tokens - - @property - def transcriptions(self): - """ - Access the transcriptions - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionList - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionList - """ - if self._transcriptions is None: - self._transcriptions = TranscriptionList(self._version, account_sid=self._solution['sid'], ) - return self._transcriptions - - @property - def usage(self): - """ - Access the usage - - :returns: twilio.rest.api.v2010.account.usage.UsageList - :rtype: twilio.rest.api.v2010.account.usage.UsageList - """ - if self._usage is None: - self._usage = UsageList(self._version, account_sid=self._solution['sid'], ) - return self._usage - - @property - def validation_requests(self): - """ - Access the validation_requests - - :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - """ - if self._validation_requests is None: - self._validation_requests = ValidationRequestList(self._version, account_sid=self._solution['sid'], ) - return self._validation_requests - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AccountContext {}>'.format(context) - - -class AccountInstance(InstanceResource): - """ """ - - class Status(object): - ACTIVE = "active" - SUSPENDED = "suspended" - CLOSED = "closed" - - class Type(object): - TRIAL = "Trial" - FULL = "Full" - - def __init__(self, version, payload, sid=None): - """ - Initialize the AccountInstance - - :returns: twilio.rest.api.v2010.account.AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance - """ - super(AccountInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'auth_token': payload['auth_token'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'owner_account_sid': payload['owner_account_sid'], - 'sid': payload['sid'], - 'status': payload['status'], - 'subresource_uris': payload['subresource_uris'], - 'type': payload['type'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AccountContext for this AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountContext - """ - if self._context is None: - self._context = AccountContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def auth_token(self): - """ - :returns: The authorization token for this account - :rtype: unicode - """ - return self._properties['auth_token'] - - @property - def date_created(self): - """ - :returns: The date this account was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this account was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this account - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def owner_account_sid(self): - """ - :returns: The unique 34 character id representing the parent of this account - :rtype: unicode - """ - return self._properties['owner_account_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status of this account - :rtype: AccountInstance.Status - """ - return self._properties['status'] - - @property - def subresource_uris(self): - """ - :returns: Account Instance Subresources - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def type(self): - """ - :returns: The type of this account - :rtype: AccountInstance.Type - """ - return self._properties['type'] - - @property - def uri(self): - """ - :returns: The URI for this resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a AccountInstance - - :returns: Fetched AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, status=values.unset): - """ - Update the AccountInstance - - :param unicode friendly_name: FriendlyName to update - :param AccountInstance.Status status: Status to update the Account with - - :returns: Updated AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance - """ - return self._proxy.update(friendly_name=friendly_name, status=status, ) - - @property - def addresses(self): - """ - Access the addresses - - :returns: twilio.rest.api.v2010.account.address.AddressList - :rtype: twilio.rest.api.v2010.account.address.AddressList - """ - return self._proxy.addresses - - @property - def applications(self): - """ - Access the applications - - :returns: twilio.rest.api.v2010.account.application.ApplicationList - :rtype: twilio.rest.api.v2010.account.application.ApplicationList - """ - return self._proxy.applications - - @property - def authorized_connect_apps(self): - """ - Access the authorized_connect_apps - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - """ - return self._proxy.authorized_connect_apps - - @property - def available_phone_numbers(self): - """ - Access the available_phone_numbers - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - """ - return self._proxy.available_phone_numbers - - @property - def calls(self): - """ - Access the calls - - :returns: twilio.rest.api.v2010.account.call.CallList - :rtype: twilio.rest.api.v2010.account.call.CallList - """ - return self._proxy.calls - - @property - def conferences(self): - """ - Access the conferences - - :returns: twilio.rest.api.v2010.account.conference.ConferenceList - :rtype: twilio.rest.api.v2010.account.conference.ConferenceList - """ - return self._proxy.conferences - - @property - def connect_apps(self): - """ - Access the connect_apps - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppList - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppList - """ - return self._proxy.connect_apps - - @property - def incoming_phone_numbers(self): - """ - Access the incoming_phone_numbers - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - """ - return self._proxy.incoming_phone_numbers - - @property - def keys(self): - """ - Access the keys - - :returns: twilio.rest.api.v2010.account.key.KeyList - :rtype: twilio.rest.api.v2010.account.key.KeyList - """ - return self._proxy.keys - - @property - def messages(self): - """ - Access the messages - - :returns: twilio.rest.api.v2010.account.message.MessageList - :rtype: twilio.rest.api.v2010.account.message.MessageList - """ - return self._proxy.messages - - @property - def new_keys(self): - """ - Access the new_keys - - :returns: twilio.rest.api.v2010.account.new_key.NewKeyList - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList - """ - return self._proxy.new_keys - - @property - def new_signing_keys(self): - """ - Access the new_signing_keys - - :returns: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - """ - return self._proxy.new_signing_keys - - @property - def notifications(self): - """ - Access the notifications - - :returns: twilio.rest.api.v2010.account.notification.NotificationList - :rtype: twilio.rest.api.v2010.account.notification.NotificationList - """ - return self._proxy.notifications - - @property - def outgoing_caller_ids(self): - """ - Access the outgoing_caller_ids - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - """ - return self._proxy.outgoing_caller_ids - - @property - def queues(self): - """ - Access the queues - - :returns: twilio.rest.api.v2010.account.queue.QueueList - :rtype: twilio.rest.api.v2010.account.queue.QueueList - """ - return self._proxy.queues - - @property - def recordings(self): - """ - Access the recordings - - :returns: twilio.rest.api.v2010.account.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.recording.RecordingList - """ - return self._proxy.recordings - - @property - def signing_keys(self): - """ - Access the signing_keys - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyList - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyList - """ - return self._proxy.signing_keys - - @property - def sip(self): - """ - Access the sip - - :returns: twilio.rest.api.v2010.account.sip.SipList - :rtype: twilio.rest.api.v2010.account.sip.SipList - """ - return self._proxy.sip - - @property - def short_codes(self): - """ - Access the short_codes - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeList - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeList - """ - return self._proxy.short_codes - - @property - def tokens(self): - """ - Access the tokens - - :returns: twilio.rest.api.v2010.account.token.TokenList - :rtype: twilio.rest.api.v2010.account.token.TokenList - """ - return self._proxy.tokens - - @property - def transcriptions(self): - """ - Access the transcriptions - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionList - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionList - """ - return self._proxy.transcriptions - - @property - def usage(self): - """ - Access the usage - - :returns: twilio.rest.api.v2010.account.usage.UsageList - :rtype: twilio.rest.api.v2010.account.usage.UsageList - """ - return self._proxy.usage - - @property - def validation_requests(self): - """ - Access the validation_requests - - :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - """ - return self._proxy.validation_requests - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AccountInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 6e2405c..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__pycache__/application.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/application.cpython-36.pyc deleted file mode 100644 index 15a418f..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/application.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__pycache__/authorized_connect_app.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/authorized_connect_app.cpython-36.pyc deleted file mode 100644 index 55a1a38..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/authorized_connect_app.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__pycache__/connect_app.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/connect_app.cpython-36.pyc deleted file mode 100644 index a2c6b6c..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/connect_app.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__pycache__/key.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/key.cpython-36.pyc deleted file mode 100644 index dfc2629..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/key.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__pycache__/new_key.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/new_key.cpython-36.pyc deleted file mode 100644 index 28c56b3..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/new_key.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__pycache__/new_signing_key.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/new_signing_key.cpython-36.pyc deleted file mode 100644 index a208647..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/new_signing_key.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__pycache__/notification.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/notification.cpython-36.pyc deleted file mode 100644 index 2765f78..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/notification.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__pycache__/outgoing_caller_id.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/outgoing_caller_id.cpython-36.pyc deleted file mode 100644 index ab6e8aa..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/outgoing_caller_id.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__pycache__/short_code.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/short_code.cpython-36.pyc deleted file mode 100644 index c15dd31..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/short_code.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__pycache__/signing_key.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/signing_key.cpython-36.pyc deleted file mode 100644 index 1eca144..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/signing_key.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__pycache__/token.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/token.cpython-36.pyc deleted file mode 100644 index b1a9eab..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/token.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__pycache__/transcription.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/transcription.cpython-36.pyc deleted file mode 100644 index 53ec455..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/transcription.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/__pycache__/validation_request.cpython-36.pyc b/twilio/rest/api/v2010/account/__pycache__/validation_request.cpython-36.pyc deleted file mode 100644 index 65deeef..0000000 Binary files a/twilio/rest/api/v2010/account/__pycache__/validation_request.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/address/__init__.py b/twilio/rest/api/v2010/account/address/__init__.py deleted file mode 100644 index 9f7caad..0000000 --- a/twilio/rest/api/v2010/account/address/__init__.py +++ /dev/null @@ -1,612 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.address.dependent_phone_number import DependentPhoneNumberList - - -class AddressList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the AddressList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - - :returns: twilio.rest.api.v2010.account.address.AddressList - :rtype: twilio.rest.api.v2010.account.address.AddressList - """ - super(AddressList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Addresses.json'.format(**self._solution) - - def create(self, customer_name, street, city, region, postal_code, iso_country, - friendly_name=values.unset, emergency_enabled=values.unset, - auto_correct_address=values.unset): - """ - Create a new AddressInstance - - :param unicode customer_name: The customer_name - :param unicode street: The street - :param unicode city: The city - :param unicode region: The region - :param unicode postal_code: The postal_code - :param unicode iso_country: The iso_country - :param unicode friendly_name: The friendly_name - :param bool emergency_enabled: The emergency_enabled - :param bool auto_correct_address: The auto_correct_address - - :returns: Newly created AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance - """ - data = values.of({ - 'CustomerName': customer_name, - 'Street': street, - 'City': city, - 'Region': region, - 'PostalCode': postal_code, - 'IsoCountry': iso_country, - 'FriendlyName': friendly_name, - 'EmergencyEnabled': emergency_enabled, - 'AutoCorrectAddress': auto_correct_address, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return AddressInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def stream(self, customer_name=values.unset, friendly_name=values.unset, - iso_country=values.unset, limit=None, page_size=None): - """ - Streams AddressInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode customer_name: The customer_name - :param unicode friendly_name: The friendly_name - :param unicode iso_country: The iso_country - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.address.AddressInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - customer_name=customer_name, - friendly_name=friendly_name, - iso_country=iso_country, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, customer_name=values.unset, friendly_name=values.unset, - iso_country=values.unset, limit=None, page_size=None): - """ - Lists AddressInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode customer_name: The customer_name - :param unicode friendly_name: The friendly_name - :param unicode iso_country: The iso_country - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.address.AddressInstance] - """ - return list(self.stream( - customer_name=customer_name, - friendly_name=friendly_name, - iso_country=iso_country, - limit=limit, - page_size=page_size, - )) - - def page(self, customer_name=values.unset, friendly_name=values.unset, - iso_country=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of AddressInstance records from the API. - Request is executed immediately - - :param unicode customer_name: The customer_name - :param unicode friendly_name: The friendly_name - :param unicode iso_country: The iso_country - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressPage - """ - params = values.of({ - 'CustomerName': customer_name, - 'FriendlyName': friendly_name, - 'IsoCountry': iso_country, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AddressPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AddressInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AddressPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AddressContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.address.AddressContext - :rtype: twilio.rest.api.v2010.account.address.AddressContext - """ - return AddressContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AddressContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.address.AddressContext - :rtype: twilio.rest.api.v2010.account.address.AddressContext - """ - return AddressContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AddressList>' - - -class AddressPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the AddressPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - - :returns: twilio.rest.api.v2010.account.address.AddressPage - :rtype: twilio.rest.api.v2010.account.address.AddressPage - """ - super(AddressPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AddressInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.address.AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance - """ - return AddressInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AddressPage>' - - -class AddressContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the AddressContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.address.AddressContext - :rtype: twilio.rest.api.v2010.account.address.AddressContext - """ - super(AddressContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Addresses/{sid}.json'.format(**self._solution) - - # Dependents - self._dependent_phone_numbers = None - - def delete(self): - """ - Deletes the AddressInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a AddressInstance - - :returns: Fetched AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return AddressInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, customer_name=values.unset, - street=values.unset, city=values.unset, region=values.unset, - postal_code=values.unset, emergency_enabled=values.unset, - auto_correct_address=values.unset): - """ - Update the AddressInstance - - :param unicode friendly_name: The friendly_name - :param unicode customer_name: The customer_name - :param unicode street: The street - :param unicode city: The city - :param unicode region: The region - :param unicode postal_code: The postal_code - :param bool emergency_enabled: The emergency_enabled - :param bool auto_correct_address: The auto_correct_address - - :returns: Updated AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'CustomerName': customer_name, - 'Street': street, - 'City': city, - 'Region': region, - 'PostalCode': postal_code, - 'EmergencyEnabled': emergency_enabled, - 'AutoCorrectAddress': auto_correct_address, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return AddressInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - @property - def dependent_phone_numbers(self): - """ - Access the dependent_phone_numbers - - :returns: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberList - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberList - """ - if self._dependent_phone_numbers is None: - self._dependent_phone_numbers = DependentPhoneNumberList( - self._version, - account_sid=self._solution['account_sid'], - address_sid=self._solution['sid'], - ) - return self._dependent_phone_numbers - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AddressContext {}>'.format(context) - - -class AddressInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the AddressInstance - - :returns: twilio.rest.api.v2010.account.address.AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance - """ - super(AddressInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'city': payload['city'], - 'customer_name': payload['customer_name'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'iso_country': payload['iso_country'], - 'postal_code': payload['postal_code'], - 'region': payload['region'], - 'sid': payload['sid'], - 'street': payload['street'], - 'uri': payload['uri'], - 'emergency_enabled': payload['emergency_enabled'], - 'validated': payload['validated'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AddressContext for this AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressContext - """ - if self._context is None: - self._context = AddressContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def city(self): - """ - :returns: The city - :rtype: unicode - """ - return self._properties['city'] - - @property - def customer_name(self): - """ - :returns: The customer_name - :rtype: unicode - """ - return self._properties['customer_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def iso_country(self): - """ - :returns: The iso_country - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def postal_code(self): - """ - :returns: The postal_code - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def region(self): - """ - :returns: The region - :rtype: unicode - """ - return self._properties['region'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def street(self): - """ - :returns: The street - :rtype: unicode - """ - return self._properties['street'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def emergency_enabled(self): - """ - :returns: The emergency_enabled - :rtype: bool - """ - return self._properties['emergency_enabled'] - - @property - def validated(self): - """ - :returns: The validated - :rtype: bool - """ - return self._properties['validated'] - - def delete(self): - """ - Deletes the AddressInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a AddressInstance - - :returns: Fetched AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, customer_name=values.unset, - street=values.unset, city=values.unset, region=values.unset, - postal_code=values.unset, emergency_enabled=values.unset, - auto_correct_address=values.unset): - """ - Update the AddressInstance - - :param unicode friendly_name: The friendly_name - :param unicode customer_name: The customer_name - :param unicode street: The street - :param unicode city: The city - :param unicode region: The region - :param unicode postal_code: The postal_code - :param bool emergency_enabled: The emergency_enabled - :param bool auto_correct_address: The auto_correct_address - - :returns: Updated AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - customer_name=customer_name, - street=street, - city=city, - region=region, - postal_code=postal_code, - emergency_enabled=emergency_enabled, - auto_correct_address=auto_correct_address, - ) - - @property - def dependent_phone_numbers(self): - """ - Access the dependent_phone_numbers - - :returns: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberList - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberList - """ - return self._proxy.dependent_phone_numbers - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AddressInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/address/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/address/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index a5cac4a..0000000 Binary files a/twilio/rest/api/v2010/account/address/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/address/__pycache__/dependent_phone_number.cpython-36.pyc b/twilio/rest/api/v2010/account/address/__pycache__/dependent_phone_number.cpython-36.pyc deleted file mode 100644 index 9092fd0..0000000 Binary files a/twilio/rest/api/v2010/account/address/__pycache__/dependent_phone_number.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/address/dependent_phone_number.py b/twilio/rest/api/v2010/account/address/dependent_phone_number.py deleted file mode 100644 index 39126bf..0000000 --- a/twilio/rest/api/v2010/account/address/dependent_phone_number.py +++ /dev/null @@ -1,444 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DependentPhoneNumberList(ListResource): - """ """ - - def __init__(self, version, account_sid, address_sid): - """ - Initialize the DependentPhoneNumberList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param address_sid: The sid - - :returns: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberList - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberList - """ - super(DependentPhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'address_sid': address_sid, } - self._uri = '/Accounts/{account_sid}/Addresses/{address_sid}/DependentPhoneNumbers.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DependentPhoneNumberInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DependentPhoneNumberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DependentPhoneNumberInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DependentPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return DependentPhoneNumberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DependentPhoneNumberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DependentPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DependentPhoneNumberPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.DependentPhoneNumberList>' - - -class DependentPhoneNumberPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the DependentPhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param address_sid: The sid - - :returns: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberPage - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberPage - """ - super(DependentPhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DependentPhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberInstance - """ - return DependentPhoneNumberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - address_sid=self._solution['address_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.DependentPhoneNumberPage>' - - -class DependentPhoneNumberInstance(InstanceResource): - """ """ - - class AddressRequirement(object): - NONE = "none" - ANY = "any" - LOCAL = "local" - FOREIGN = "foreign" - - class EmergencyStatus(object): - ACTIVE = "Active" - INACTIVE = "Inactive" - - def __init__(self, version, payload, account_sid, address_sid): - """ - Initialize the DependentPhoneNumberInstance - - :returns: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberInstance - """ - super(DependentPhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'phone_number': payload['phone_number'], - 'voice_url': payload['voice_url'], - 'voice_method': payload['voice_method'], - 'voice_fallback_method': payload['voice_fallback_method'], - 'voice_fallback_url': payload['voice_fallback_url'], - 'voice_caller_id_lookup': payload['voice_caller_id_lookup'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'sms_fallback_method': payload['sms_fallback_method'], - 'sms_fallback_url': payload['sms_fallback_url'], - 'sms_method': payload['sms_method'], - 'sms_url': payload['sms_url'], - 'address_requirements': payload['address_requirements'], - 'capabilities': payload['capabilities'], - 'status_callback': payload['status_callback'], - 'status_callback_method': payload['status_callback_method'], - 'api_version': payload['api_version'], - 'sms_application_sid': payload['sms_application_sid'], - 'voice_application_sid': payload['voice_application_sid'], - 'trunk_sid': payload['trunk_sid'], - 'emergency_status': payload['emergency_status'], - 'emergency_address_sid': payload['emergency_address_sid'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'address_sid': address_sid, } - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def voice_url(self): - """ - :returns: The voice_url - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def voice_method(self): - """ - :returns: The voice_method - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_fallback_method(self): - """ - :returns: The voice_fallback_method - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: The voice_caller_id_lookup - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def sms_fallback_method(self): - """ - :returns: The sms_fallback_method - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The sms_method - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The sms_url - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def address_requirements(self): - """ - :returns: The address_requirements - :rtype: DependentPhoneNumberInstance.AddressRequirement - """ - return self._properties['address_requirements'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: dict - """ - return self._properties['capabilities'] - - @property - def status_callback(self): - """ - :returns: The status_callback - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The status_callback_method - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def sms_application_sid(self): - """ - :returns: The sms_application_sid - :rtype: unicode - """ - return self._properties['sms_application_sid'] - - @property - def voice_application_sid(self): - """ - :returns: The voice_application_sid - :rtype: unicode - """ - return self._properties['voice_application_sid'] - - @property - def trunk_sid(self): - """ - :returns: The trunk_sid - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def emergency_status(self): - """ - :returns: The emergency_status - :rtype: DependentPhoneNumberInstance.EmergencyStatus - """ - return self._properties['emergency_status'] - - @property - def emergency_address_sid(self): - """ - :returns: The emergency_address_sid - :rtype: unicode - """ - return self._properties['emergency_address_sid'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.DependentPhoneNumberInstance>' diff --git a/twilio/rest/api/v2010/account/application.py b/twilio/rest/api/v2010/account/application.py deleted file mode 100644 index 315a744..0000000 --- a/twilio/rest/api/v2010/account/application.py +++ /dev/null @@ -1,667 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class ApplicationList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the ApplicationList - - :param Version version: Version that contains the resource - :param account_sid: A string that uniquely identifies this resource - - :returns: twilio.rest.api.v2010.account.application.ApplicationList - :rtype: twilio.rest.api.v2010.account.application.ApplicationList - """ - super(ApplicationList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Applications.json'.format(**self._solution) - - def create(self, friendly_name, api_version=values.unset, - voice_url=values.unset, voice_method=values.unset, - voice_fallback_url=values.unset, voice_fallback_method=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - voice_caller_id_lookup=values.unset, sms_url=values.unset, - sms_method=values.unset, sms_fallback_url=values.unset, - sms_fallback_method=values.unset, sms_status_callback=values.unset, - message_status_callback=values.unset): - """ - Create a new ApplicationInstance - - :param unicode friendly_name: The friendly_name - :param unicode api_version: The API version to use - :param unicode voice_url: URL Twilio will make requests to when relieving a call - :param unicode voice_method: HTTP method to use with the URL - :param unicode voice_fallback_url: Fallback URL - :param unicode voice_fallback_method: HTTP method to use with the fallback url - :param unicode status_callback: URL to hit with status updates - :param unicode status_callback_method: HTTP method to use with the status callback - :param bool voice_caller_id_lookup: True or False - :param unicode sms_url: URL Twilio will request when receiving an SMS - :param unicode sms_method: HTTP method to use with sms_url - :param unicode sms_fallback_url: Fallback URL if there's an error parsing TwiML - :param unicode sms_fallback_method: HTTP method to use with sms_fallback_method - :param unicode sms_status_callback: URL Twilio with request with status updates - :param unicode message_status_callback: URL to make requests to with status updates - - :returns: Newly created ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'ApiVersion': api_version, - 'VoiceUrl': voice_url, - 'VoiceMethod': voice_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceFallbackMethod': voice_fallback_method, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'VoiceCallerIdLookup': voice_caller_id_lookup, - 'SmsUrl': sms_url, - 'SmsMethod': sms_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsStatusCallback': sms_status_callback, - 'MessageStatusCallback': message_status_callback, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ApplicationInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def stream(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Streams ApplicationInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode friendly_name: Filter by friendly name - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.application.ApplicationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Lists ApplicationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: Filter by friendly name - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.application.ApplicationInstance] - """ - return list(self.stream(friendly_name=friendly_name, limit=limit, page_size=page_size, )) - - def page(self, friendly_name=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ApplicationInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: Filter by friendly name - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationPage - """ - params = values.of({ - 'FriendlyName': friendly_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ApplicationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ApplicationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ApplicationPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ApplicationContext - - :param sid: Fetch by unique Application Sid - - :returns: twilio.rest.api.v2010.account.application.ApplicationContext - :rtype: twilio.rest.api.v2010.account.application.ApplicationContext - """ - return ApplicationContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ApplicationContext - - :param sid: Fetch by unique Application Sid - - :returns: twilio.rest.api.v2010.account.application.ApplicationContext - :rtype: twilio.rest.api.v2010.account.application.ApplicationContext - """ - return ApplicationContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ApplicationList>' - - -class ApplicationPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ApplicationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A string that uniquely identifies this resource - - :returns: twilio.rest.api.v2010.account.application.ApplicationPage - :rtype: twilio.rest.api.v2010.account.application.ApplicationPage - """ - super(ApplicationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ApplicationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.application.ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance - """ - return ApplicationInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ApplicationPage>' - - -class ApplicationContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the ApplicationContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique Application Sid - - :returns: twilio.rest.api.v2010.account.application.ApplicationContext - :rtype: twilio.rest.api.v2010.account.application.ApplicationContext - """ - super(ApplicationContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Applications/{sid}.json'.format(**self._solution) - - def delete(self): - """ - Deletes the ApplicationInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a ApplicationInstance - - :returns: Fetched ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ApplicationInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, api_version=values.unset, - voice_url=values.unset, voice_method=values.unset, - voice_fallback_url=values.unset, voice_fallback_method=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - voice_caller_id_lookup=values.unset, sms_url=values.unset, - sms_method=values.unset, sms_fallback_url=values.unset, - sms_fallback_method=values.unset, sms_status_callback=values.unset, - message_status_callback=values.unset): - """ - Update the ApplicationInstance - - :param unicode friendly_name: Human readable description of this resource - :param unicode api_version: The API version to use - :param unicode voice_url: URL Twilio will make requests to when relieving a call - :param unicode voice_method: HTTP method to use with the URL - :param unicode voice_fallback_url: Fallback URL - :param unicode voice_fallback_method: HTTP method to use with the fallback url - :param unicode status_callback: URL to hit with status updates - :param unicode status_callback_method: HTTP method to use with the status callback - :param bool voice_caller_id_lookup: True or False - :param unicode sms_url: URL Twilio will request when receiving an SMS - :param unicode sms_method: HTTP method to use with sms_url - :param unicode sms_fallback_url: Fallback URL if there's an error parsing TwiML - :param unicode sms_fallback_method: HTTP method to use with sms_fallback_method - :param unicode sms_status_callback: URL Twilio with request with status updates - :param unicode message_status_callback: URL to make requests to with status updates - - :returns: Updated ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'ApiVersion': api_version, - 'VoiceUrl': voice_url, - 'VoiceMethod': voice_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceFallbackMethod': voice_fallback_method, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'VoiceCallerIdLookup': voice_caller_id_lookup, - 'SmsUrl': sms_url, - 'SmsMethod': sms_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsStatusCallback': sms_status_callback, - 'MessageStatusCallback': message_status_callback, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ApplicationInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.ApplicationContext {}>'.format(context) - - -class ApplicationInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the ApplicationInstance - - :returns: twilio.rest.api.v2010.account.application.ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance - """ - super(ApplicationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'message_status_callback': payload['message_status_callback'], - 'sid': payload['sid'], - 'sms_fallback_method': payload['sms_fallback_method'], - 'sms_fallback_url': payload['sms_fallback_url'], - 'sms_method': payload['sms_method'], - 'sms_status_callback': payload['sms_status_callback'], - 'sms_url': payload['sms_url'], - 'status_callback': payload['status_callback'], - 'status_callback_method': payload['status_callback_method'], - 'uri': payload['uri'], - 'voice_caller_id_lookup': payload['voice_caller_id_lookup'], - 'voice_fallback_method': payload['voice_fallback_method'], - 'voice_fallback_url': payload['voice_fallback_url'], - 'voice_method': payload['voice_method'], - 'voice_url': payload['voice_url'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ApplicationContext for this ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationContext - """ - if self._context is None: - self._context = ApplicationContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: A string that uniquely identifies this resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version to use - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def date_created(self): - """ - :returns: Date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: Date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: Human readable description of this resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def message_status_callback(self): - """ - :returns: URL to make requests to with status updates - :rtype: unicode - """ - return self._properties['message_status_callback'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_fallback_method(self): - """ - :returns: HTTP method to use with sms_fallback_method - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: Fallback URL if there's an error parsing TwiML - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: HTTP method to use with sms_url - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_status_callback(self): - """ - :returns: URL Twilio with request with status updates - :rtype: unicode - """ - return self._properties['sms_status_callback'] - - @property - def sms_url(self): - """ - :returns: URL Twilio will request when receiving an SMS - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def status_callback(self): - """ - :returns: URL to hit with status updates - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: HTTP method to use with the status callback - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def uri(self): - """ - :returns: URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: True or False - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def voice_fallback_method(self): - """ - :returns: HTTP method to use with the fallback url - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: Fallback URL - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: HTTP method to use with the URL - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: URL Twilio will make requests to when relieving a call - :rtype: unicode - """ - return self._properties['voice_url'] - - def delete(self): - """ - Deletes the ApplicationInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a ApplicationInstance - - :returns: Fetched ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, api_version=values.unset, - voice_url=values.unset, voice_method=values.unset, - voice_fallback_url=values.unset, voice_fallback_method=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - voice_caller_id_lookup=values.unset, sms_url=values.unset, - sms_method=values.unset, sms_fallback_url=values.unset, - sms_fallback_method=values.unset, sms_status_callback=values.unset, - message_status_callback=values.unset): - """ - Update the ApplicationInstance - - :param unicode friendly_name: Human readable description of this resource - :param unicode api_version: The API version to use - :param unicode voice_url: URL Twilio will make requests to when relieving a call - :param unicode voice_method: HTTP method to use with the URL - :param unicode voice_fallback_url: Fallback URL - :param unicode voice_fallback_method: HTTP method to use with the fallback url - :param unicode status_callback: URL to hit with status updates - :param unicode status_callback_method: HTTP method to use with the status callback - :param bool voice_caller_id_lookup: True or False - :param unicode sms_url: URL Twilio will request when receiving an SMS - :param unicode sms_method: HTTP method to use with sms_url - :param unicode sms_fallback_url: Fallback URL if there's an error parsing TwiML - :param unicode sms_fallback_method: HTTP method to use with sms_fallback_method - :param unicode sms_status_callback: URL Twilio with request with status updates - :param unicode message_status_callback: URL to make requests to with status updates - - :returns: Updated ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - api_version=api_version, - voice_url=voice_url, - voice_method=voice_method, - voice_fallback_url=voice_fallback_url, - voice_fallback_method=voice_fallback_method, - status_callback=status_callback, - status_callback_method=status_callback_method, - voice_caller_id_lookup=voice_caller_id_lookup, - sms_url=sms_url, - sms_method=sms_method, - sms_fallback_url=sms_fallback_url, - sms_fallback_method=sms_fallback_method, - sms_status_callback=sms_status_callback, - message_status_callback=message_status_callback, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.ApplicationInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/authorized_connect_app.py b/twilio/rest/api/v2010/account/authorized_connect_app.py deleted file mode 100644 index 4daf004..0000000 --- a/twilio/rest/api/v2010/account/authorized_connect_app.py +++ /dev/null @@ -1,405 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class AuthorizedConnectAppList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the AuthorizedConnectAppList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - """ - super(AuthorizedConnectAppList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/AuthorizedConnectApps.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AuthorizedConnectAppInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AuthorizedConnectAppInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AuthorizedConnectAppInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AuthorizedConnectAppPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AuthorizedConnectAppInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AuthorizedConnectAppPage(self._version, response, self._solution) - - def get(self, connect_app_sid): - """ - Constructs a AuthorizedConnectAppContext - - :param connect_app_sid: The connect_app_sid - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - """ - return AuthorizedConnectAppContext( - self._version, - account_sid=self._solution['account_sid'], - connect_app_sid=connect_app_sid, - ) - - def __call__(self, connect_app_sid): - """ - Constructs a AuthorizedConnectAppContext - - :param connect_app_sid: The connect_app_sid - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - """ - return AuthorizedConnectAppContext( - self._version, - account_sid=self._solution['account_sid'], - connect_app_sid=connect_app_sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AuthorizedConnectAppList>' - - -class AuthorizedConnectAppPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the AuthorizedConnectAppPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppPage - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppPage - """ - super(AuthorizedConnectAppPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AuthorizedConnectAppInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance - """ - return AuthorizedConnectAppInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AuthorizedConnectAppPage>' - - -class AuthorizedConnectAppContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, connect_app_sid): - """ - Initialize the AuthorizedConnectAppContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param connect_app_sid: The connect_app_sid - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - """ - super(AuthorizedConnectAppContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'connect_app_sid': connect_app_sid, } - self._uri = '/Accounts/{account_sid}/AuthorizedConnectApps/{connect_app_sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a AuthorizedConnectAppInstance - - :returns: Fetched AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return AuthorizedConnectAppInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - connect_app_sid=self._solution['connect_app_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AuthorizedConnectAppContext {}>'.format(context) - - -class AuthorizedConnectAppInstance(InstanceResource): - """ """ - - class Permission(object): - GET_ALL = "get-all" - POST_ALL = "post-all" - - def __init__(self, version, payload, account_sid, connect_app_sid=None): - """ - Initialize the AuthorizedConnectAppInstance - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance - """ - super(AuthorizedConnectAppInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'connect_app_company_name': payload['connect_app_company_name'], - 'connect_app_description': payload['connect_app_description'], - 'connect_app_friendly_name': payload['connect_app_friendly_name'], - 'connect_app_homepage_url': payload['connect_app_homepage_url'], - 'connect_app_sid': payload['connect_app_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'permissions': payload['permissions'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'connect_app_sid': connect_app_sid or self._properties['connect_app_sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AuthorizedConnectAppContext for this AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - """ - if self._context is None: - self._context = AuthorizedConnectAppContext( - self._version, - account_sid=self._solution['account_sid'], - connect_app_sid=self._solution['connect_app_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def connect_app_company_name(self): - """ - :returns: The company name set for this Connect App. - :rtype: unicode - """ - return self._properties['connect_app_company_name'] - - @property - def connect_app_description(self): - """ - :returns: Human readable description of the app - :rtype: unicode - """ - return self._properties['connect_app_description'] - - @property - def connect_app_friendly_name(self): - """ - :returns: A human readable name for the Connect App. - :rtype: unicode - """ - return self._properties['connect_app_friendly_name'] - - @property - def connect_app_homepage_url(self): - """ - :returns: The public URL for this Connect App. - :rtype: unicode - """ - return self._properties['connect_app_homepage_url'] - - @property - def connect_app_sid(self): - """ - :returns: A string that uniquely identifies this app - :rtype: unicode - """ - return self._properties['connect_app_sid'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def permissions(self): - """ - :returns: Permissions authorized to this app - :rtype: AuthorizedConnectAppInstance.Permission - """ - return self._properties['permissions'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a AuthorizedConnectAppInstance - - :returns: Fetched AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AuthorizedConnectAppInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/available_phone_number/__init__.py b/twilio/rest/api/v2010/account/available_phone_number/__init__.py deleted file mode 100644 index ad4c449..0000000 --- a/twilio/rest/api/v2010/account/available_phone_number/__init__.py +++ /dev/null @@ -1,553 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.available_phone_number.local import LocalList -from twilio.rest.api.v2010.account.available_phone_number.machine_to_machine import MachineToMachineList -from twilio.rest.api.v2010.account.available_phone_number.mobile import MobileList -from twilio.rest.api.v2010.account.available_phone_number.national import NationalList -from twilio.rest.api.v2010.account.available_phone_number.shared_cost import SharedCostList -from twilio.rest.api.v2010.account.available_phone_number.toll_free import TollFreeList -from twilio.rest.api.v2010.account.available_phone_number.voip import VoipList - - -class AvailablePhoneNumberCountryList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the AvailablePhoneNumberCountryList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - """ - super(AvailablePhoneNumberCountryList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AvailablePhoneNumberCountryInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AvailablePhoneNumberCountryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AvailablePhoneNumberCountryInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AvailablePhoneNumberCountryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AvailablePhoneNumberCountryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AvailablePhoneNumberCountryPage(self._version, response, self._solution) - - def get(self, country_code): - """ - Constructs a AvailablePhoneNumberCountryContext - - :param country_code: The country_code - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - """ - return AvailablePhoneNumberCountryContext( - self._version, - account_sid=self._solution['account_sid'], - country_code=country_code, - ) - - def __call__(self, country_code): - """ - Constructs a AvailablePhoneNumberCountryContext - - :param country_code: The country_code - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - """ - return AvailablePhoneNumberCountryContext( - self._version, - account_sid=self._solution['account_sid'], - country_code=country_code, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AvailablePhoneNumberCountryList>' - - -class AvailablePhoneNumberCountryPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the AvailablePhoneNumberCountryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryPage - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryPage - """ - super(AvailablePhoneNumberCountryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AvailablePhoneNumberCountryInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance - """ - return AvailablePhoneNumberCountryInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AvailablePhoneNumberCountryPage>' - - -class AvailablePhoneNumberCountryContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, country_code): - """ - Initialize the AvailablePhoneNumberCountryContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param country_code: The country_code - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - """ - super(AvailablePhoneNumberCountryContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}.json'.format(**self._solution) - - # Dependents - self._local = None - self._toll_free = None - self._mobile = None - self._national = None - self._voip = None - self._shared_cost = None - self._machine_to_machine = None - - def fetch(self): - """ - Fetch a AvailablePhoneNumberCountryInstance - - :returns: Fetched AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return AvailablePhoneNumberCountryInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - @property - def local(self): - """ - Access the local - - :returns: twilio.rest.api.v2010.account.available_phone_number.local.LocalList - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalList - """ - if self._local is None: - self._local = LocalList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._local - - @property - def toll_free(self): - """ - Access the toll_free - - :returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeList - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeList - """ - if self._toll_free is None: - self._toll_free = TollFreeList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._toll_free - - @property - def mobile(self): - """ - Access the mobile - - :returns: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileList - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileList - """ - if self._mobile is None: - self._mobile = MobileList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._mobile - - @property - def national(self): - """ - Access the national - - :returns: twilio.rest.api.v2010.account.available_phone_number.national.NationalList - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalList - """ - if self._national is None: - self._national = NationalList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._national - - @property - def voip(self): - """ - Access the voip - - :returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList - """ - if self._voip is None: - self._voip = VoipList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._voip - - @property - def shared_cost(self): - """ - Access the shared_cost - - :returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList - """ - if self._shared_cost is None: - self._shared_cost = SharedCostList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._shared_cost - - @property - def machine_to_machine(self): - """ - Access the machine_to_machine - - :returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList - """ - if self._machine_to_machine is None: - self._machine_to_machine = MachineToMachineList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._machine_to_machine - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AvailablePhoneNumberCountryContext {}>'.format(context) - - -class AvailablePhoneNumberCountryInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, country_code=None): - """ - Initialize the AvailablePhoneNumberCountryInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance - """ - super(AvailablePhoneNumberCountryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'country_code': payload['country_code'], - 'country': payload['country'], - 'uri': payload['uri'], - 'beta': payload['beta'], - 'subresource_uris': payload['subresource_uris'], - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'country_code': country_code or self._properties['country_code'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AvailablePhoneNumberCountryContext for this AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - """ - if self._context is None: - self._context = AvailablePhoneNumberCountryContext( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._context - - @property - def country_code(self): - """ - :returns: The ISO Country code to lookup phone numbers for. - :rtype: unicode - """ - return self._properties['country_code'] - - @property - def country(self): - """ - :returns: The country - :rtype: unicode - """ - return self._properties['country'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def beta(self): - """ - :returns: The beta - :rtype: bool - """ - return self._properties['beta'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - def fetch(self): - """ - Fetch a AvailablePhoneNumberCountryInstance - - :returns: Fetched AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance - """ - return self._proxy.fetch() - - @property - def local(self): - """ - Access the local - - :returns: twilio.rest.api.v2010.account.available_phone_number.local.LocalList - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalList - """ - return self._proxy.local - - @property - def toll_free(self): - """ - Access the toll_free - - :returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeList - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeList - """ - return self._proxy.toll_free - - @property - def mobile(self): - """ - Access the mobile - - :returns: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileList - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileList - """ - return self._proxy.mobile - - @property - def national(self): - """ - Access the national - - :returns: twilio.rest.api.v2010.account.available_phone_number.national.NationalList - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalList - """ - return self._proxy.national - - @property - def voip(self): - """ - Access the voip - - :returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList - """ - return self._proxy.voip - - @property - def shared_cost(self): - """ - Access the shared_cost - - :returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList - """ - return self._proxy.shared_cost - - @property - def machine_to_machine(self): - """ - Access the machine_to_machine - - :returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList - """ - return self._proxy.machine_to_machine - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AvailablePhoneNumberCountryInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/available_phone_number/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 8d9672f..0000000 Binary files a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/local.cpython-36.pyc b/twilio/rest/api/v2010/account/available_phone_number/__pycache__/local.cpython-36.pyc deleted file mode 100644 index 3a6870a..0000000 Binary files a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/local.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/machine_to_machine.cpython-36.pyc b/twilio/rest/api/v2010/account/available_phone_number/__pycache__/machine_to_machine.cpython-36.pyc deleted file mode 100644 index c8a42f7..0000000 Binary files a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/machine_to_machine.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/mobile.cpython-36.pyc b/twilio/rest/api/v2010/account/available_phone_number/__pycache__/mobile.cpython-36.pyc deleted file mode 100644 index db158a3..0000000 Binary files a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/mobile.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/national.cpython-36.pyc b/twilio/rest/api/v2010/account/available_phone_number/__pycache__/national.cpython-36.pyc deleted file mode 100644 index fefaeac..0000000 Binary files a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/national.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/shared_cost.cpython-36.pyc b/twilio/rest/api/v2010/account/available_phone_number/__pycache__/shared_cost.cpython-36.pyc deleted file mode 100644 index 83bb9e4..0000000 Binary files a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/shared_cost.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/toll_free.cpython-36.pyc b/twilio/rest/api/v2010/account/available_phone_number/__pycache__/toll_free.cpython-36.pyc deleted file mode 100644 index 45c7672..0000000 Binary files a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/toll_free.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/voip.cpython-36.pyc b/twilio/rest/api/v2010/account/available_phone_number/__pycache__/voip.cpython-36.pyc deleted file mode 100644 index 3cb8624..0000000 Binary files a/twilio/rest/api/v2010/account/available_phone_number/__pycache__/voip.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/available_phone_number/local.py b/twilio/rest/api/v2010/account/available_phone_number/local.py deleted file mode 100644 index 615ccb4..0000000 --- a/twilio/rest/api/v2010/account/available_phone_number/local.py +++ /dev/null @@ -1,462 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class LocalList(ListResource): - """ """ - - def __init__(self, version, account_sid, country_code): - """ - Initialize the LocalList - - :param Version version: Version that contains the resource - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.local.LocalList - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalList - """ - super(LocalList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/Local.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams LocalInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.local.LocalInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists LocalInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.local.LocalInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of LocalInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of LocalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalPage - """ - params = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return LocalPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of LocalInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of LocalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return LocalPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.LocalList>' - - -class LocalPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the LocalPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.local.LocalPage - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalPage - """ - super(LocalPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of LocalInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.local.LocalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalInstance - """ - return LocalInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.LocalPage>' - - -class LocalInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the LocalInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.local.LocalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalInstance - """ - super(LocalInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload['friendly_name'], - 'phone_number': payload['phone_number'], - 'lata': payload['lata'], - 'locality': payload['locality'], - 'rate_center': payload['rate_center'], - 'latitude': deserialize.decimal(payload['latitude']), - 'longitude': deserialize.decimal(payload['longitude']), - 'region': payload['region'], - 'postal_code': payload['postal_code'], - 'iso_country': payload['iso_country'], - 'address_requirements': payload['address_requirements'], - 'beta': payload['beta'], - 'capabilities': payload['capabilities'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The lata - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate_center - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The region - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal_code - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The iso_country - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The address_requirements - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: The beta - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.LocalInstance>' diff --git a/twilio/rest/api/v2010/account/available_phone_number/machine_to_machine.py b/twilio/rest/api/v2010/account/available_phone_number/machine_to_machine.py deleted file mode 100644 index 74fe5e1..0000000 --- a/twilio/rest/api/v2010/account/available_phone_number/machine_to_machine.py +++ /dev/null @@ -1,462 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MachineToMachineList(ListResource): - """ """ - - def __init__(self, version, account_sid, country_code): - """ - Initialize the MachineToMachineList - - :param Version version: Version that contains the resource - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList - """ - super(MachineToMachineList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/MachineToMachine.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams MachineToMachineInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists MachineToMachineInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MachineToMachineInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MachineToMachineInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachinePage - """ - params = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MachineToMachinePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MachineToMachineInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MachineToMachineInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachinePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MachineToMachinePage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MachineToMachineList>' - - -class MachineToMachinePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MachineToMachinePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachinePage - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachinePage - """ - super(MachineToMachinePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MachineToMachineInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineInstance - """ - return MachineToMachineInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MachineToMachinePage>' - - -class MachineToMachineInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the MachineToMachineInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineInstance - """ - super(MachineToMachineInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload['friendly_name'], - 'phone_number': payload['phone_number'], - 'lata': payload['lata'], - 'locality': payload['locality'], - 'rate_center': payload['rate_center'], - 'latitude': deserialize.decimal(payload['latitude']), - 'longitude': deserialize.decimal(payload['longitude']), - 'region': payload['region'], - 'postal_code': payload['postal_code'], - 'iso_country': payload['iso_country'], - 'address_requirements': payload['address_requirements'], - 'beta': payload['beta'], - 'capabilities': payload['capabilities'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The lata - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate_center - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The region - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal_code - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The iso_country - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The address_requirements - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: The beta - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MachineToMachineInstance>' diff --git a/twilio/rest/api/v2010/account/available_phone_number/mobile.py b/twilio/rest/api/v2010/account/available_phone_number/mobile.py deleted file mode 100644 index 8d25959..0000000 --- a/twilio/rest/api/v2010/account/available_phone_number/mobile.py +++ /dev/null @@ -1,462 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MobileList(ListResource): - """ """ - - def __init__(self, version, account_sid, country_code): - """ - Initialize the MobileList - - :param Version version: Version that contains the resource - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileList - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileList - """ - super(MobileList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/Mobile.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams MobileInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.mobile.MobileInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists MobileInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.mobile.MobileInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MobileInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MobileInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobilePage - """ - params = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MobilePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MobileInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MobileInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobilePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MobilePage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MobileList>' - - -class MobilePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MobilePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.mobile.MobilePage - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobilePage - """ - super(MobilePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MobileInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileInstance - """ - return MobileInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MobilePage>' - - -class MobileInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the MobileInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileInstance - """ - super(MobileInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload['friendly_name'], - 'phone_number': payload['phone_number'], - 'lata': payload['lata'], - 'locality': payload['locality'], - 'rate_center': payload['rate_center'], - 'latitude': deserialize.decimal(payload['latitude']), - 'longitude': deserialize.decimal(payload['longitude']), - 'region': payload['region'], - 'postal_code': payload['postal_code'], - 'iso_country': payload['iso_country'], - 'address_requirements': payload['address_requirements'], - 'beta': payload['beta'], - 'capabilities': payload['capabilities'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The lata - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate_center - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The region - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal_code - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The iso_country - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The address_requirements - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: The beta - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MobileInstance>' diff --git a/twilio/rest/api/v2010/account/available_phone_number/national.py b/twilio/rest/api/v2010/account/available_phone_number/national.py deleted file mode 100644 index cb3e6ba..0000000 --- a/twilio/rest/api/v2010/account/available_phone_number/national.py +++ /dev/null @@ -1,462 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NationalList(ListResource): - """ """ - - def __init__(self, version, account_sid, country_code): - """ - Initialize the NationalList - - :param Version version: Version that contains the resource - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.national.NationalList - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalList - """ - super(NationalList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/National.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams NationalInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.national.NationalInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists NationalInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.national.NationalInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of NationalInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of NationalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalPage - """ - params = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return NationalPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of NationalInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of NationalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return NationalPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.NationalList>' - - -class NationalPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the NationalPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.national.NationalPage - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalPage - """ - super(NationalPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NationalInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.national.NationalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalInstance - """ - return NationalInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.NationalPage>' - - -class NationalInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the NationalInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.national.NationalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalInstance - """ - super(NationalInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload['friendly_name'], - 'phone_number': payload['phone_number'], - 'lata': payload['lata'], - 'locality': payload['locality'], - 'rate_center': payload['rate_center'], - 'latitude': deserialize.decimal(payload['latitude']), - 'longitude': deserialize.decimal(payload['longitude']), - 'region': payload['region'], - 'postal_code': payload['postal_code'], - 'iso_country': payload['iso_country'], - 'address_requirements': payload['address_requirements'], - 'beta': payload['beta'], - 'capabilities': payload['capabilities'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The lata - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate_center - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The region - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal_code - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The iso_country - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The address_requirements - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: The beta - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.NationalInstance>' diff --git a/twilio/rest/api/v2010/account/available_phone_number/shared_cost.py b/twilio/rest/api/v2010/account/available_phone_number/shared_cost.py deleted file mode 100644 index 8fb9bc5..0000000 --- a/twilio/rest/api/v2010/account/available_phone_number/shared_cost.py +++ /dev/null @@ -1,462 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SharedCostList(ListResource): - """ """ - - def __init__(self, version, account_sid, country_code): - """ - Initialize the SharedCostList - - :param Version version: Version that contains the resource - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList - """ - super(SharedCostList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/SharedCost.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams SharedCostInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists SharedCostInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of SharedCostInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SharedCostInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostPage - """ - params = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SharedCostPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SharedCostInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SharedCostInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SharedCostPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.SharedCostList>' - - -class SharedCostPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the SharedCostPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostPage - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostPage - """ - super(SharedCostPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SharedCostInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostInstance - """ - return SharedCostInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.SharedCostPage>' - - -class SharedCostInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the SharedCostInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostInstance - """ - super(SharedCostInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload['friendly_name'], - 'phone_number': payload['phone_number'], - 'lata': payload['lata'], - 'locality': payload['locality'], - 'rate_center': payload['rate_center'], - 'latitude': deserialize.decimal(payload['latitude']), - 'longitude': deserialize.decimal(payload['longitude']), - 'region': payload['region'], - 'postal_code': payload['postal_code'], - 'iso_country': payload['iso_country'], - 'address_requirements': payload['address_requirements'], - 'beta': payload['beta'], - 'capabilities': payload['capabilities'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The lata - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate_center - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The region - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal_code - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The iso_country - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The address_requirements - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: The beta - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.SharedCostInstance>' diff --git a/twilio/rest/api/v2010/account/available_phone_number/toll_free.py b/twilio/rest/api/v2010/account/available_phone_number/toll_free.py deleted file mode 100644 index 68f3516..0000000 --- a/twilio/rest/api/v2010/account/available_phone_number/toll_free.py +++ /dev/null @@ -1,462 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TollFreeList(ListResource): - """ """ - - def __init__(self, version, account_sid, country_code): - """ - Initialize the TollFreeList - - :param Version version: Version that contains the resource - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeList - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeList - """ - super(TollFreeList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/TollFree.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams TollFreeInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists TollFreeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of TollFreeInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TollFreeInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreePage - """ - params = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return TollFreePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TollFreeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TollFreeInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TollFreePage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TollFreeList>' - - -class TollFreePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TollFreePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreePage - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreePage - """ - super(TollFreePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TollFreeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance - """ - return TollFreeInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TollFreePage>' - - -class TollFreeInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the TollFreeInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance - """ - super(TollFreeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload['friendly_name'], - 'phone_number': payload['phone_number'], - 'lata': payload['lata'], - 'locality': payload['locality'], - 'rate_center': payload['rate_center'], - 'latitude': deserialize.decimal(payload['latitude']), - 'longitude': deserialize.decimal(payload['longitude']), - 'region': payload['region'], - 'postal_code': payload['postal_code'], - 'iso_country': payload['iso_country'], - 'address_requirements': payload['address_requirements'], - 'beta': payload['beta'], - 'capabilities': payload['capabilities'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The lata - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate_center - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The region - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal_code - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The iso_country - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The address_requirements - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: The beta - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TollFreeInstance>' diff --git a/twilio/rest/api/v2010/account/available_phone_number/voip.py b/twilio/rest/api/v2010/account/available_phone_number/voip.py deleted file mode 100644 index 9521f6e..0000000 --- a/twilio/rest/api/v2010/account/available_phone_number/voip.py +++ /dev/null @@ -1,462 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class VoipList(ListResource): - """ """ - - def __init__(self, version, account_sid, country_code): - """ - Initialize the VoipList - - :param Version version: Version that contains the resource - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList - """ - super(VoipList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/Voip.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams VoipInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists VoipInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of VoipInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area_code - :param unicode contains: The contains - :param bool sms_enabled: The sms_enabled - :param bool mms_enabled: The mms_enabled - :param bool voice_enabled: The voice_enabled - :param bool exclude_all_address_required: The exclude_all_address_required - :param bool exclude_local_address_required: The exclude_local_address_required - :param bool exclude_foreign_address_required: The exclude_foreign_address_required - :param bool beta: The beta - :param unicode near_number: The near_number - :param unicode near_lat_long: The near_lat_long - :param unicode distance: The distance - :param unicode in_postal_code: The in_postal_code - :param unicode in_region: The in_region - :param unicode in_rate_center: The in_rate_center - :param unicode in_lata: The in_lata - :param unicode in_locality: The in_locality - :param bool fax_enabled: The fax_enabled - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of VoipInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipPage - """ - params = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return VoipPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of VoipInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of VoipInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return VoipPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.VoipList>' - - -class VoipPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the VoipPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The 34 character string that uniquely identifies your account. - :param country_code: The ISO Country code to lookup phone numbers for. - - :returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipPage - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipPage - """ - super(VoipPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of VoipInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance - """ - return VoipInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.VoipPage>' - - -class VoipInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the VoipInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance - """ - super(VoipInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload['friendly_name'], - 'phone_number': payload['phone_number'], - 'lata': payload['lata'], - 'locality': payload['locality'], - 'rate_center': payload['rate_center'], - 'latitude': deserialize.decimal(payload['latitude']), - 'longitude': deserialize.decimal(payload['longitude']), - 'region': payload['region'], - 'postal_code': payload['postal_code'], - 'iso_country': payload['iso_country'], - 'address_requirements': payload['address_requirements'], - 'beta': payload['beta'], - 'capabilities': payload['capabilities'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The lata - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate_center - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The region - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal_code - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The iso_country - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The address_requirements - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: The beta - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.VoipInstance>' diff --git a/twilio/rest/api/v2010/account/call/__init__.py b/twilio/rest/api/v2010/account/call/__init__.py deleted file mode 100644 index 23b26dc..0000000 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ /dev/null @@ -1,891 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.call.feedback import FeedbackList -from twilio.rest.api.v2010.account.call.feedback_summary import FeedbackSummaryList -from twilio.rest.api.v2010.account.call.notification import NotificationList -from twilio.rest.api.v2010.account.call.recording import RecordingList - - -class CallList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the CallList - - :param Version version: Version that contains the resource - :param account_sid: The unique id of the Account responsible for creating this Call - - :returns: twilio.rest.api.v2010.account.call.CallList - :rtype: twilio.rest.api.v2010.account.call.CallList - """ - super(CallList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Calls.json'.format(**self._solution) - - # Components - self._feedback_summaries = None - - def create(self, to, from_, method=values.unset, fallback_url=values.unset, - fallback_method=values.unset, status_callback=values.unset, - status_callback_event=values.unset, - status_callback_method=values.unset, send_digits=values.unset, - if_machine=values.unset, timeout=values.unset, record=values.unset, - recording_channels=values.unset, - recording_status_callback=values.unset, - recording_status_callback_method=values.unset, - sip_auth_username=values.unset, sip_auth_password=values.unset, - machine_detection=values.unset, - machine_detection_timeout=values.unset, - recording_status_callback_event=values.unset, url=values.unset, - application_sid=values.unset): - """ - Create a new CallInstance - - :param unicode to: Phone number, SIP address or client identifier to call - :param unicode from_: Twilio number from which to originate the call - :param unicode method: HTTP method to use to fetch TwiML - :param unicode fallback_url: Fallback URL in case of error - :param unicode fallback_method: HTTP Method to use with FallbackUrl - :param unicode status_callback: Status Callback URL - :param unicode status_callback_event: The status_callback_event - :param unicode status_callback_method: HTTP Method to use with StatusCallback - :param unicode send_digits: Digits to send - :param unicode if_machine: Action to take if a machine has answered the call - :param unicode timeout: Number of seconds to wait for an answer - :param bool record: Whether or not to record the Call - :param unicode recording_channels: The recording_channels - :param unicode recording_status_callback: The recording_status_callback - :param unicode recording_status_callback_method: The recording_status_callback_method - :param unicode sip_auth_username: The sip_auth_username - :param unicode sip_auth_password: The sip_auth_password - :param unicode machine_detection: Enable machine detection or end of greeting detection - :param unicode machine_detection_timeout: Number of miliseconds to wait for machine detection - :param unicode recording_status_callback_event: The recording_status_callback_event - :param unicode url: Url from which to fetch TwiML - :param unicode application_sid: ApplicationSid that configures from where to fetch TwiML - - :returns: Newly created CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance - """ - data = values.of({ - 'To': to, - 'From': from_, - 'Url': url, - 'ApplicationSid': application_sid, - 'Method': method, - 'FallbackUrl': fallback_url, - 'FallbackMethod': fallback_method, - 'StatusCallback': status_callback, - 'StatusCallbackEvent': serialize.map(status_callback_event, lambda e: e), - 'StatusCallbackMethod': status_callback_method, - 'SendDigits': send_digits, - 'IfMachine': if_machine, - 'Timeout': timeout, - 'Record': record, - 'RecordingChannels': recording_channels, - 'RecordingStatusCallback': recording_status_callback, - 'RecordingStatusCallbackMethod': recording_status_callback_method, - 'SipAuthUsername': sip_auth_username, - 'SipAuthPassword': sip_auth_password, - 'MachineDetection': machine_detection, - 'MachineDetectionTimeout': machine_detection_timeout, - 'RecordingStatusCallbackEvent': serialize.map(recording_status_callback_event, lambda e: e), - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CallInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def stream(self, to=values.unset, from_=values.unset, - parent_call_sid=values.unset, status=values.unset, - start_time_before=values.unset, start_time=values.unset, - start_time_after=values.unset, end_time_before=values.unset, - end_time=values.unset, end_time_after=values.unset, limit=None, - page_size=None): - """ - Streams CallInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode to: Phone number or Client identifier to filter `to` on - :param unicode from_: Phone number or Client identifier to filter `from` on - :param unicode parent_call_sid: Parent Call Sid to filter on - :param CallInstance.Status status: Status to filter on - :param datetime start_time_before: StartTime to filter on - :param datetime start_time: StartTime to filter on - :param datetime start_time_after: StartTime to filter on - :param datetime end_time_before: EndTime to filter on - :param datetime end_time: EndTime to filter on - :param datetime end_time_after: EndTime to filter on - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.call.CallInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - to=to, - from_=from_, - parent_call_sid=parent_call_sid, - status=status, - start_time_before=start_time_before, - start_time=start_time, - start_time_after=start_time_after, - end_time_before=end_time_before, - end_time=end_time, - end_time_after=end_time_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, to=values.unset, from_=values.unset, - parent_call_sid=values.unset, status=values.unset, - start_time_before=values.unset, start_time=values.unset, - start_time_after=values.unset, end_time_before=values.unset, - end_time=values.unset, end_time_after=values.unset, limit=None, - page_size=None): - """ - Lists CallInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode to: Phone number or Client identifier to filter `to` on - :param unicode from_: Phone number or Client identifier to filter `from` on - :param unicode parent_call_sid: Parent Call Sid to filter on - :param CallInstance.Status status: Status to filter on - :param datetime start_time_before: StartTime to filter on - :param datetime start_time: StartTime to filter on - :param datetime start_time_after: StartTime to filter on - :param datetime end_time_before: EndTime to filter on - :param datetime end_time: EndTime to filter on - :param datetime end_time_after: EndTime to filter on - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.call.CallInstance] - """ - return list(self.stream( - to=to, - from_=from_, - parent_call_sid=parent_call_sid, - status=status, - start_time_before=start_time_before, - start_time=start_time, - start_time_after=start_time_after, - end_time_before=end_time_before, - end_time=end_time, - end_time_after=end_time_after, - limit=limit, - page_size=page_size, - )) - - def page(self, to=values.unset, from_=values.unset, - parent_call_sid=values.unset, status=values.unset, - start_time_before=values.unset, start_time=values.unset, - start_time_after=values.unset, end_time_before=values.unset, - end_time=values.unset, end_time_after=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CallInstance records from the API. - Request is executed immediately - - :param unicode to: Phone number or Client identifier to filter `to` on - :param unicode from_: Phone number or Client identifier to filter `from` on - :param unicode parent_call_sid: Parent Call Sid to filter on - :param CallInstance.Status status: Status to filter on - :param datetime start_time_before: StartTime to filter on - :param datetime start_time: StartTime to filter on - :param datetime start_time_after: StartTime to filter on - :param datetime end_time_before: EndTime to filter on - :param datetime end_time: EndTime to filter on - :param datetime end_time_after: EndTime to filter on - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallPage - """ - params = values.of({ - 'To': to, - 'From': from_, - 'ParentCallSid': parent_call_sid, - 'Status': status, - 'StartTime<': serialize.iso8601_datetime(start_time_before), - 'StartTime': serialize.iso8601_datetime(start_time), - 'StartTime>': serialize.iso8601_datetime(start_time_after), - 'EndTime<': serialize.iso8601_datetime(end_time_before), - 'EndTime': serialize.iso8601_datetime(end_time), - 'EndTime>': serialize.iso8601_datetime(end_time_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CallPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CallInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CallPage(self._version, response, self._solution) - - @property - def feedback_summaries(self): - """ - Access the feedback_summaries - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryList - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryList - """ - if self._feedback_summaries is None: - self._feedback_summaries = FeedbackSummaryList( - self._version, - account_sid=self._solution['account_sid'], - ) - return self._feedback_summaries - - def get(self, sid): - """ - Constructs a CallContext - - :param sid: Call Sid that uniquely identifies the Call to fetch - - :returns: twilio.rest.api.v2010.account.call.CallContext - :rtype: twilio.rest.api.v2010.account.call.CallContext - """ - return CallContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CallContext - - :param sid: Call Sid that uniquely identifies the Call to fetch - - :returns: twilio.rest.api.v2010.account.call.CallContext - :rtype: twilio.rest.api.v2010.account.call.CallContext - """ - return CallContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.CallList>' - - -class CallPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the CallPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique id of the Account responsible for creating this Call - - :returns: twilio.rest.api.v2010.account.call.CallPage - :rtype: twilio.rest.api.v2010.account.call.CallPage - """ - super(CallPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CallInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.call.CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance - """ - return CallInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.CallPage>' - - -class CallContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the CallContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Call Sid that uniquely identifies the Call to fetch - - :returns: twilio.rest.api.v2010.account.call.CallContext - :rtype: twilio.rest.api.v2010.account.call.CallContext - """ - super(CallContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Calls/{sid}.json'.format(**self._solution) - - # Dependents - self._recordings = None - self._notifications = None - self._feedback = None - - def delete(self): - """ - Deletes the CallInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a CallInstance - - :returns: Fetched CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CallInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, url=values.unset, method=values.unset, status=values.unset, - fallback_url=values.unset, fallback_method=values.unset, - status_callback=values.unset, status_callback_method=values.unset): - """ - Update the CallInstance - - :param unicode url: URL that returns TwiML - :param unicode method: HTTP method to use to fetch TwiML - :param CallInstance.UpdateStatus status: Status to update the Call with - :param unicode fallback_url: Fallback URL in case of error - :param unicode fallback_method: HTTP Method to use with FallbackUrl - :param unicode status_callback: Status Callback URL - :param unicode status_callback_method: HTTP Method to use with StatusCallback - - :returns: Updated CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance - """ - data = values.of({ - 'Url': url, - 'Method': method, - 'Status': status, - 'FallbackUrl': fallback_url, - 'FallbackMethod': fallback_method, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return CallInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - @property - def recordings(self): - """ - Access the recordings - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingList - """ - if self._recordings is None: - self._recordings = RecordingList( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['sid'], - ) - return self._recordings - - @property - def notifications(self): - """ - Access the notifications - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationList - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationList - """ - if self._notifications is None: - self._notifications = NotificationList( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['sid'], - ) - return self._notifications - - @property - def feedback(self): - """ - Access the feedback - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackList - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackList - """ - if self._feedback is None: - self._feedback = FeedbackList( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['sid'], - ) - return self._feedback - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.CallContext {}>'.format(context) - - -class CallInstance(InstanceResource): - """ """ - - class Event(object): - INITIATED = "initiated" - RINGING = "ringing" - ANSWERED = "answered" - COMPLETED = "completed" - - class Status(object): - QUEUED = "queued" - RINGING = "ringing" - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - BUSY = "busy" - FAILED = "failed" - NO_ANSWER = "no-answer" - CANCELED = "canceled" - - class UpdateStatus(object): - CANCELED = "canceled" - COMPLETED = "completed" - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the CallInstance - - :returns: twilio.rest.api.v2010.account.call.CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance - """ - super(CallInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'annotation': payload['annotation'], - 'answered_by': payload['answered_by'], - 'api_version': payload['api_version'], - 'caller_name': payload['caller_name'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'direction': payload['direction'], - 'duration': payload['duration'], - 'end_time': deserialize.rfc2822_datetime(payload['end_time']), - 'forwarded_from': payload['forwarded_from'], - 'from_': payload['from'], - 'from_formatted': payload['from_formatted'], - 'group_sid': payload['group_sid'], - 'parent_call_sid': payload['parent_call_sid'], - 'phone_number_sid': payload['phone_number_sid'], - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'sid': payload['sid'], - 'start_time': deserialize.rfc2822_datetime(payload['start_time']), - 'status': payload['status'], - 'subresource_uris': payload['subresource_uris'], - 'to': payload['to'], - 'to_formatted': payload['to_formatted'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CallContext for this CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallContext - """ - if self._context is None: - self._context = CallContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique id of the Account responsible for creating this Call - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def annotation(self): - """ - :returns: The annotation provided for the Call - :rtype: unicode - """ - return self._properties['annotation'] - - @property - def answered_by(self): - """ - :returns: If this call was initiated with answering machine detection, either `human` or `machine`. Empty otherwise. - :rtype: unicode - """ - return self._properties['answered_by'] - - @property - def api_version(self): - """ - :returns: The API Version the Call was created through - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def caller_name(self): - """ - :returns: If this call was an incoming call to a phone number with Caller ID Lookup enabled, the caller's name. Empty otherwise. - :rtype: unicode - """ - return self._properties['caller_name'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def direction(self): - """ - :returns: A string describing the direction of the call. `inbound` for inbound calls, `outbound-api` for calls initiated via the REST API or `outbound-dial` for calls initiated by a `Dial` verb. - :rtype: unicode - """ - return self._properties['direction'] - - @property - def duration(self): - """ - :returns: The duration - :rtype: unicode - """ - return self._properties['duration'] - - @property - def end_time(self): - """ - :returns: The end time of the Call. Null if the call did not complete successfully. - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def forwarded_from(self): - """ - :returns: If this Call was an incoming call forwarded from another number, the forwarding phone number (depends on carrier supporting forwarding). Empty otherwise. - :rtype: unicode - """ - return self._properties['forwarded_from'] - - @property - def from_(self): - """ - :returns: The phone number, SIP address or Client identifier that made this Call. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. - :rtype: unicode - """ - return self._properties['from_'] - - @property - def from_formatted(self): - """ - :returns: The phone number, SIP address or Client identifier that made this Call. Formatted for display. - :rtype: unicode - """ - return self._properties['from_formatted'] - - @property - def group_sid(self): - """ - :returns: A 34 character Group Sid associated with this Call. Empty if no Group is associated with the Call. - :rtype: unicode - """ - return self._properties['group_sid'] - - @property - def parent_call_sid(self): - """ - :returns: A 34 character string that uniquely identifies the Call that created this leg. - :rtype: unicode - """ - return self._properties['parent_call_sid'] - - @property - def phone_number_sid(self): - """ - :returns: If the call was inbound, this is the Sid of the IncomingPhoneNumber that received the call. If the call was outbound, it is the Sid of the OutgoingCallerId from which the call was placed. - :rtype: unicode - """ - return self._properties['phone_number_sid'] - - @property - def price(self): - """ - :returns: The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available. - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which `Price` is measured. - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def start_time(self): - """ - :returns: The start time of the Call. Null if the call has not yet been dialed. - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def status(self): - """ - :returns: The status - :rtype: CallInstance.Status - """ - return self._properties['status'] - - @property - def subresource_uris(self): - """ - :returns: Call Instance Subresources - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def to(self): - """ - :returns: The phone number, SIP address or Client identifier that received this Call. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. - :rtype: unicode - """ - return self._properties['to'] - - @property - def to_formatted(self): - """ - :returns: The phone number, SIP address or Client identifier that received this Call. Formatted for display. - :rtype: unicode - """ - return self._properties['to_formatted'] - - @property - def uri(self): - """ - :returns: The URI for this resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - def delete(self): - """ - Deletes the CallInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a CallInstance - - :returns: Fetched CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance - """ - return self._proxy.fetch() - - def update(self, url=values.unset, method=values.unset, status=values.unset, - fallback_url=values.unset, fallback_method=values.unset, - status_callback=values.unset, status_callback_method=values.unset): - """ - Update the CallInstance - - :param unicode url: URL that returns TwiML - :param unicode method: HTTP method to use to fetch TwiML - :param CallInstance.UpdateStatus status: Status to update the Call with - :param unicode fallback_url: Fallback URL in case of error - :param unicode fallback_method: HTTP Method to use with FallbackUrl - :param unicode status_callback: Status Callback URL - :param unicode status_callback_method: HTTP Method to use with StatusCallback - - :returns: Updated CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance - """ - return self._proxy.update( - url=url, - method=method, - status=status, - fallback_url=fallback_url, - fallback_method=fallback_method, - status_callback=status_callback, - status_callback_method=status_callback_method, - ) - - @property - def recordings(self): - """ - Access the recordings - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingList - """ - return self._proxy.recordings - - @property - def notifications(self): - """ - Access the notifications - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationList - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationList - """ - return self._proxy.notifications - - @property - def feedback(self): - """ - Access the feedback - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackList - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackList - """ - return self._proxy.feedback - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.CallInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/call/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/call/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 7784db7..0000000 Binary files a/twilio/rest/api/v2010/account/call/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/call/__pycache__/feedback.cpython-36.pyc b/twilio/rest/api/v2010/account/call/__pycache__/feedback.cpython-36.pyc deleted file mode 100644 index 3b0e6de..0000000 Binary files a/twilio/rest/api/v2010/account/call/__pycache__/feedback.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/call/__pycache__/feedback_summary.cpython-36.pyc b/twilio/rest/api/v2010/account/call/__pycache__/feedback_summary.cpython-36.pyc deleted file mode 100644 index f92c40c..0000000 Binary files a/twilio/rest/api/v2010/account/call/__pycache__/feedback_summary.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/call/__pycache__/notification.cpython-36.pyc b/twilio/rest/api/v2010/account/call/__pycache__/notification.cpython-36.pyc deleted file mode 100644 index 2e47d11..0000000 Binary files a/twilio/rest/api/v2010/account/call/__pycache__/notification.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/call/__pycache__/recording.cpython-36.pyc b/twilio/rest/api/v2010/account/call/__pycache__/recording.cpython-36.pyc deleted file mode 100644 index 7778ac7..0000000 Binary files a/twilio/rest/api/v2010/account/call/__pycache__/recording.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/call/feedback.py b/twilio/rest/api/v2010/account/call/feedback.py deleted file mode 100644 index edd3530..0000000 --- a/twilio/rest/api/v2010/account/call/feedback.py +++ /dev/null @@ -1,364 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class FeedbackList(ListResource): - """ """ - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the FeedbackList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param call_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackList - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackList - """ - super(FeedbackList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - - def get(self): - """ - Constructs a FeedbackContext - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - """ - return FeedbackContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def __call__(self): - """ - Constructs a FeedbackContext - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - """ - return FeedbackContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.FeedbackList>' - - -class FeedbackPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the FeedbackPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param call_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackPage - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackPage - """ - super(FeedbackPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FeedbackInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.FeedbackPage>' - - -class FeedbackContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the FeedbackContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param call_sid: The call sid that uniquely identifies the call - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - """ - super(FeedbackContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Feedback.json'.format(**self._solution) - - def create(self, quality_score, issue=values.unset): - """ - Create a new FeedbackInstance - - :param unicode quality_score: The quality_score - :param FeedbackInstance.Issues issue: The issue - - :returns: Newly created FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - data = values.of({'QualityScore': quality_score, 'Issue': serialize.map(issue, lambda e: e), }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def fetch(self): - """ - Fetch a FeedbackInstance - - :returns: Fetched FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def update(self, quality_score, issue=values.unset): - """ - Update the FeedbackInstance - - :param unicode quality_score: An integer from 1 to 5 - :param FeedbackInstance.Issues issue: Issues experienced during the call - - :returns: Updated FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - data = values.of({'QualityScore': quality_score, 'Issue': serialize.map(issue, lambda e: e), }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.FeedbackContext {}>'.format(context) - - -class FeedbackInstance(InstanceResource): - """ """ - - class Issues(object): - AUDIO_LATENCY = "audio-latency" - DIGITS_NOT_CAPTURED = "digits-not-captured" - DROPPED_CALL = "dropped-call" - IMPERFECT_AUDIO = "imperfect-audio" - INCORRECT_CALLER_ID = "incorrect-caller-id" - ONE_WAY_AUDIO = "one-way-audio" - POST_DIAL_DELAY = "post-dial-delay" - UNSOLICITED_CALL = "unsolicited-call" - - def __init__(self, version, payload, account_sid, call_sid): - """ - Initialize the FeedbackInstance - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - super(FeedbackInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'issues': payload['issues'], - 'quality_score': deserialize.integer(payload['quality_score']), - 'sid': payload['sid'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FeedbackContext for this FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - """ - if self._context is None: - self._context = FeedbackContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def issues(self): - """ - :returns: The issues - :rtype: FeedbackInstance.Issues - """ - return self._properties['issues'] - - @property - def quality_score(self): - """ - :returns: 1 to 5 quality score - :rtype: unicode - """ - return self._properties['quality_score'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - def create(self, quality_score, issue=values.unset): - """ - Create a new FeedbackInstance - - :param unicode quality_score: The quality_score - :param FeedbackInstance.Issues issue: The issue - - :returns: Newly created FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - return self._proxy.create(quality_score, issue=issue, ) - - def fetch(self): - """ - Fetch a FeedbackInstance - - :returns: Fetched FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - return self._proxy.fetch() - - def update(self, quality_score, issue=values.unset): - """ - Update the FeedbackInstance - - :param unicode quality_score: An integer from 1 to 5 - :param FeedbackInstance.Issues issue: Issues experienced during the call - - :returns: Updated FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - return self._proxy.update(quality_score, issue=issue, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.FeedbackInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/call/feedback_summary.py b/twilio/rest/api/v2010/account/call/feedback_summary.py deleted file mode 100644 index aa86d85..0000000 --- a/twilio/rest/api/v2010/account/call/feedback_summary.py +++ /dev/null @@ -1,396 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class FeedbackSummaryList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the FeedbackSummaryList - - :param Version version: Version that contains the resource - :param account_sid: The unique id of the Account responsible for creating this Call - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryList - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryList - """ - super(FeedbackSummaryList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Calls/FeedbackSummary.json'.format(**self._solution) - - def create(self, start_date, end_date, include_subaccounts=values.unset, - status_callback=values.unset, status_callback_method=values.unset): - """ - Create a new FeedbackSummaryInstance - - :param date start_date: The start_date - :param date end_date: The end_date - :param bool include_subaccounts: The include_subaccounts - :param unicode status_callback: The status_callback - :param unicode status_callback_method: The status_callback_method - - :returns: Newly created FeedbackSummaryInstance - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - """ - data = values.of({ - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'IncludeSubaccounts': include_subaccounts, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return FeedbackSummaryInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def get(self, sid): - """ - Constructs a FeedbackSummaryContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - """ - return FeedbackSummaryContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FeedbackSummaryContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - """ - return FeedbackSummaryContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.FeedbackSummaryList>' - - -class FeedbackSummaryPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the FeedbackSummaryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique id of the Account responsible for creating this Call - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryPage - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryPage - """ - super(FeedbackSummaryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FeedbackSummaryInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - """ - return FeedbackSummaryInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.FeedbackSummaryPage>' - - -class FeedbackSummaryContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the FeedbackSummaryContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - """ - super(FeedbackSummaryContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Calls/FeedbackSummary/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a FeedbackSummaryInstance - - :returns: Fetched FeedbackSummaryInstance - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return FeedbackSummaryInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the FeedbackSummaryInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.FeedbackSummaryContext {}>'.format(context) - - -class FeedbackSummaryInstance(InstanceResource): - """ """ - - class Status(object): - QUEUED = "queued" - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - FAILED = "failed" - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the FeedbackSummaryInstance - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - """ - super(FeedbackSummaryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'call_count': deserialize.integer(payload['call_count']), - 'call_feedback_count': deserialize.integer(payload['call_feedback_count']), - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'end_date': deserialize.iso8601_datetime(payload['end_date']), - 'include_subaccounts': payload['include_subaccounts'], - 'issues': payload['issues'], - 'quality_score_average': deserialize.decimal(payload['quality_score_average']), - 'quality_score_median': deserialize.decimal(payload['quality_score_median']), - 'quality_score_standard_deviation': deserialize.decimal(payload['quality_score_standard_deviation']), - 'sid': payload['sid'], - 'start_date': deserialize.iso8601_datetime(payload['start_date']), - 'status': payload['status'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FeedbackSummaryContext for this FeedbackSummaryInstance - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - """ - if self._context is None: - self._context = FeedbackSummaryContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def call_count(self): - """ - :returns: The call_count - :rtype: unicode - """ - return self._properties['call_count'] - - @property - def call_feedback_count(self): - """ - :returns: The call_feedback_count - :rtype: unicode - """ - return self._properties['call_feedback_count'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def end_date(self): - """ - :returns: The end_date - :rtype: datetime - """ - return self._properties['end_date'] - - @property - def include_subaccounts(self): - """ - :returns: The include_subaccounts - :rtype: bool - """ - return self._properties['include_subaccounts'] - - @property - def issues(self): - """ - :returns: The issues - :rtype: unicode - """ - return self._properties['issues'] - - @property - def quality_score_average(self): - """ - :returns: The quality_score_average - :rtype: unicode - """ - return self._properties['quality_score_average'] - - @property - def quality_score_median(self): - """ - :returns: The quality_score_median - :rtype: unicode - """ - return self._properties['quality_score_median'] - - @property - def quality_score_standard_deviation(self): - """ - :returns: The quality_score_standard_deviation - :rtype: unicode - """ - return self._properties['quality_score_standard_deviation'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def start_date(self): - """ - :returns: The start_date - :rtype: datetime - """ - return self._properties['start_date'] - - @property - def status(self): - """ - :returns: The status - :rtype: FeedbackSummaryInstance.Status - """ - return self._properties['status'] - - def fetch(self): - """ - Fetch a FeedbackSummaryInstance - - :returns: Fetched FeedbackSummaryInstance - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the FeedbackSummaryInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.FeedbackSummaryInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/call/notification.py b/twilio/rest/api/v2010/account/call/notification.py deleted file mode 100644 index c6e0e5e..0000000 --- a/twilio/rest/api/v2010/account/call/notification.py +++ /dev/null @@ -1,531 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class NotificationList(ListResource): - """ """ - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the NotificationList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param call_sid: The call_sid - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationList - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationList - """ - super(NotificationList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Notifications.json'.format(**self._solution) - - def stream(self, log=values.unset, message_date_before=values.unset, - message_date=values.unset, message_date_after=values.unset, - limit=None, page_size=None): - """ - Streams NotificationInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode log: The log - :param date message_date_before: The message_date - :param date message_date: The message_date - :param date message_date_after: The message_date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.call.notification.NotificationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - log=log, - message_date_before=message_date_before, - message_date=message_date, - message_date_after=message_date_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, log=values.unset, message_date_before=values.unset, - message_date=values.unset, message_date_after=values.unset, limit=None, - page_size=None): - """ - Lists NotificationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode log: The log - :param date message_date_before: The message_date - :param date message_date: The message_date - :param date message_date_after: The message_date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.call.notification.NotificationInstance] - """ - return list(self.stream( - log=log, - message_date_before=message_date_before, - message_date=message_date, - message_date_after=message_date_after, - limit=limit, - page_size=page_size, - )) - - def page(self, log=values.unset, message_date_before=values.unset, - message_date=values.unset, message_date_after=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of NotificationInstance records from the API. - Request is executed immediately - - :param unicode log: The log - :param date message_date_before: The message_date - :param date message_date: The message_date - :param date message_date_after: The message_date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationPage - """ - params = values.of({ - 'Log': log, - 'MessageDate<': serialize.iso8601_date(message_date_before), - 'MessageDate': serialize.iso8601_date(message_date), - 'MessageDate>': serialize.iso8601_date(message_date_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return NotificationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of NotificationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return NotificationPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a NotificationContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationContext - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationContext - """ - return NotificationContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a NotificationContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationContext - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationContext - """ - return NotificationContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.NotificationList>' - - -class NotificationPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the NotificationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param call_sid: The call_sid - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationPage - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationPage - """ - super(NotificationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NotificationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationInstance - """ - return NotificationInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.NotificationPage>' - - -class NotificationContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, call_sid, sid): - """ - Initialize the NotificationContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param call_sid: The call_sid - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationContext - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationContext - """ - super(NotificationContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Notifications/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a NotificationInstance - - :returns: Fetched NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return NotificationInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the NotificationInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.NotificationContext {}>'.format(context) - - -class NotificationInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, call_sid, sid=None): - """ - Initialize the NotificationInstance - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationInstance - """ - super(NotificationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'call_sid': payload['call_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'error_code': payload['error_code'], - 'log': payload['log'], - 'message_date': deserialize.rfc2822_datetime(payload['message_date']), - 'message_text': payload['message_text'], - 'more_info': payload['more_info'], - 'request_method': payload['request_method'], - 'request_url': payload['request_url'], - 'sid': payload['sid'], - 'uri': payload['uri'], - 'request_variables': payload.get('request_variables'), - 'response_body': payload.get('response_body'), - 'response_headers': payload.get('response_headers'), - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'call_sid': call_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: NotificationContext for this NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationContext - """ - if self._context is None: - self._context = NotificationContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def call_sid(self): - """ - :returns: The call_sid - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def error_code(self): - """ - :returns: The error_code - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def log(self): - """ - :returns: The log - :rtype: unicode - """ - return self._properties['log'] - - @property - def message_date(self): - """ - :returns: The message_date - :rtype: datetime - """ - return self._properties['message_date'] - - @property - def message_text(self): - """ - :returns: The message_text - :rtype: unicode - """ - return self._properties['message_text'] - - @property - def more_info(self): - """ - :returns: The more_info - :rtype: unicode - """ - return self._properties['more_info'] - - @property - def request_method(self): - """ - :returns: The request_method - :rtype: unicode - """ - return self._properties['request_method'] - - @property - def request_url(self): - """ - :returns: The request_url - :rtype: unicode - """ - return self._properties['request_url'] - - @property - def request_variables(self): - """ - :returns: The request_variables - :rtype: unicode - """ - return self._properties['request_variables'] - - @property - def response_body(self): - """ - :returns: The response_body - :rtype: unicode - """ - return self._properties['response_body'] - - @property - def response_headers(self): - """ - :returns: The response_headers - :rtype: unicode - """ - return self._properties['response_headers'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a NotificationInstance - - :returns: Fetched NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the NotificationInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.NotificationInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/call/recording.py b/twilio/rest/api/v2010/account/call/recording.py deleted file mode 100644 index d2a8303..0000000 --- a/twilio/rest/api/v2010/account/call/recording.py +++ /dev/null @@ -1,530 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class RecordingList(ListResource): - """ """ - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the RecordingList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param call_sid: The call_sid - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingList - """ - super(RecordingList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json'.format(**self._solution) - - def stream(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, limit=None, page_size=None): - """ - Streams RecordingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param date date_created_before: The date_created - :param date date_created: The date_created - :param date date_created_after: The date_created - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.call.recording.RecordingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, limit=None, page_size=None): - """ - Lists RecordingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param date date_created_before: The date_created - :param date date_created: The date_created - :param date date_created_after: The date_created - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.call.recording.RecordingInstance] - """ - return list(self.stream( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - limit=limit, - page_size=page_size, - )) - - def page(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of RecordingInstance records from the API. - Request is executed immediately - - :param date date_created_before: The date_created - :param date date_created: The date_created - :param date date_created_after: The date_created - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingPage - """ - params = values.of({ - 'DateCreated<': serialize.iso8601_date(date_created_before), - 'DateCreated': serialize.iso8601_date(date_created), - 'DateCreated>': serialize.iso8601_date(date_created_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return RecordingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RecordingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RecordingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RecordingContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingContext - """ - return RecordingContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a RecordingContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingContext - """ - return RecordingContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.RecordingList>' - - -class RecordingPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the RecordingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param call_sid: The call_sid - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingPage - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingPage - """ - super(RecordingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RecordingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance - """ - return RecordingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.RecordingPage>' - - -class RecordingContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, call_sid, sid): - """ - Initialize the RecordingContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param call_sid: The call_sid - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingContext - """ - super(RecordingContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Recordings/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a RecordingInstance - - :returns: Fetched RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return RecordingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the RecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.RecordingContext {}>'.format(context) - - -class RecordingInstance(InstanceResource): - """ """ - - class Status(object): - IN_PROGRESS = "in-progress" - PAUSED = "paused" - STOPPED = "stopped" - PROCESSING = "processing" - COMPLETED = "completed" - FAILED = "failed" - - class Source(object): - DIALVERB = "DialVerb" - CONFERENCE = "Conference" - OUTBOUNDAPI = "OutboundAPI" - TRUNKING = "Trunking" - RECORDVERB = "RecordVerb" - STARTCALLRECORDINGAPI = "StartCallRecordingAPI" - STARTCONFERENCERECORDINGAPI = "StartConferenceRecordingAPI" - - def __init__(self, version, payload, account_sid, call_sid, sid=None): - """ - Initialize the RecordingInstance - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance - """ - super(RecordingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'call_sid': payload['call_sid'], - 'conference_sid': payload['conference_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'duration': payload['duration'], - 'sid': payload['sid'], - 'price': deserialize.decimal(payload['price']), - 'uri': payload['uri'], - 'encryption_details': payload['encryption_details'], - 'price_unit': payload['price_unit'], - 'status': payload['status'], - 'channels': deserialize.integer(payload['channels']), - 'source': payload['source'], - 'error_code': deserialize.integer(payload['error_code']), - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'call_sid': call_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RecordingContext for this RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingContext - """ - if self._context is None: - self._context = RecordingContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def call_sid(self): - """ - :returns: The call_sid - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def conference_sid(self): - """ - :returns: The conference_sid - :rtype: unicode - """ - return self._properties['conference_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def duration(self): - """ - :returns: The duration - :rtype: unicode - """ - return self._properties['duration'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def price(self): - """ - :returns: The price - :rtype: unicode - """ - return self._properties['price'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def encryption_details(self): - """ - :returns: The encryption_details - :rtype: dict - """ - return self._properties['encryption_details'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def status(self): - """ - :returns: The status - :rtype: RecordingInstance.Status - """ - return self._properties['status'] - - @property - def channels(self): - """ - :returns: The channels - :rtype: unicode - """ - return self._properties['channels'] - - @property - def source(self): - """ - :returns: The source - :rtype: RecordingInstance.Source - """ - return self._properties['source'] - - @property - def error_code(self): - """ - :returns: The error_code - :rtype: unicode - """ - return self._properties['error_code'] - - def fetch(self): - """ - Fetch a RecordingInstance - - :returns: Fetched RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the RecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.RecordingInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/conference/__init__.py b/twilio/rest/api/v2010/account/conference/__init__.py deleted file mode 100644 index 38a1ddd..0000000 --- a/twilio/rest/api/v2010/account/conference/__init__.py +++ /dev/null @@ -1,535 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.conference.participant import ParticipantList - - -class ConferenceList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the ConferenceList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.conference.ConferenceList - :rtype: twilio.rest.api.v2010.account.conference.ConferenceList - """ - super(ConferenceList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Conferences.json'.format(**self._solution) - - def stream(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, date_updated_before=values.unset, - date_updated=values.unset, date_updated_after=values.unset, - friendly_name=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Streams ConferenceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param date date_created_before: Filter by date created - :param date date_created: Filter by date created - :param date date_created_after: Filter by date created - :param date date_updated_before: Filter by date updated - :param date date_updated: Filter by date updated - :param date date_updated_after: Filter by date updated - :param unicode friendly_name: Filter by friendly name - :param ConferenceInstance.Status status: The status of the conference - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.conference.ConferenceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - date_updated_before=date_updated_before, - date_updated=date_updated, - date_updated_after=date_updated_after, - friendly_name=friendly_name, - status=status, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, date_updated_before=values.unset, - date_updated=values.unset, date_updated_after=values.unset, - friendly_name=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Lists ConferenceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param date date_created_before: Filter by date created - :param date date_created: Filter by date created - :param date date_created_after: Filter by date created - :param date date_updated_before: Filter by date updated - :param date date_updated: Filter by date updated - :param date date_updated_after: Filter by date updated - :param unicode friendly_name: Filter by friendly name - :param ConferenceInstance.Status status: The status of the conference - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.conference.ConferenceInstance] - """ - return list(self.stream( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - date_updated_before=date_updated_before, - date_updated=date_updated, - date_updated_after=date_updated_after, - friendly_name=friendly_name, - status=status, - limit=limit, - page_size=page_size, - )) - - def page(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, date_updated_before=values.unset, - date_updated=values.unset, date_updated_after=values.unset, - friendly_name=values.unset, status=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ConferenceInstance records from the API. - Request is executed immediately - - :param date date_created_before: Filter by date created - :param date date_created: Filter by date created - :param date date_created_after: Filter by date created - :param date date_updated_before: Filter by date updated - :param date date_updated: Filter by date updated - :param date date_updated_after: Filter by date updated - :param unicode friendly_name: Filter by friendly name - :param ConferenceInstance.Status status: The status of the conference - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferencePage - """ - params = values.of({ - 'DateCreated<': serialize.iso8601_date(date_created_before), - 'DateCreated': serialize.iso8601_date(date_created), - 'DateCreated>': serialize.iso8601_date(date_created_after), - 'DateUpdated<': serialize.iso8601_date(date_updated_before), - 'DateUpdated': serialize.iso8601_date(date_updated), - 'DateUpdated>': serialize.iso8601_date(date_updated_after), - 'FriendlyName': friendly_name, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ConferencePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ConferenceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferencePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ConferencePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ConferenceContext - - :param sid: Fetch by unique conference Sid - - :returns: twilio.rest.api.v2010.account.conference.ConferenceContext - :rtype: twilio.rest.api.v2010.account.conference.ConferenceContext - """ - return ConferenceContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ConferenceContext - - :param sid: Fetch by unique conference Sid - - :returns: twilio.rest.api.v2010.account.conference.ConferenceContext - :rtype: twilio.rest.api.v2010.account.conference.ConferenceContext - """ - return ConferenceContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ConferenceList>' - - -class ConferencePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ConferencePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.conference.ConferencePage - :rtype: twilio.rest.api.v2010.account.conference.ConferencePage - """ - super(ConferencePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ConferenceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.conference.ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance - """ - return ConferenceInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ConferencePage>' - - -class ConferenceContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the ConferenceContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique conference Sid - - :returns: twilio.rest.api.v2010.account.conference.ConferenceContext - :rtype: twilio.rest.api.v2010.account.conference.ConferenceContext - """ - super(ConferenceContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Conferences/{sid}.json'.format(**self._solution) - - # Dependents - self._participants = None - - def fetch(self): - """ - Fetch a ConferenceInstance - - :returns: Fetched ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ConferenceInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, status=values.unset, announce_url=values.unset, - announce_method=values.unset): - """ - Update the ConferenceInstance - - :param ConferenceInstance.UpdateStatus status: The status - :param unicode announce_url: The announce_url - :param unicode announce_method: The announce_method - - :returns: Updated ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance - """ - data = values.of({'Status': status, 'AnnounceUrl': announce_url, 'AnnounceMethod': announce_method, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ConferenceInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantList - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantList - """ - if self._participants is None: - self._participants = ParticipantList( - self._version, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['sid'], - ) - return self._participants - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.ConferenceContext {}>'.format(context) - - -class ConferenceInstance(InstanceResource): - """ """ - - class Status(object): - INIT = "init" - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - - class UpdateStatus(object): - COMPLETED = "completed" - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the ConferenceInstance - - :returns: twilio.rest.api.v2010.account.conference.ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance - """ - super(ConferenceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'api_version': payload['api_version'], - 'friendly_name': payload['friendly_name'], - 'region': payload['region'], - 'sid': payload['sid'], - 'status': payload['status'], - 'uri': payload['uri'], - 'subresource_uris': payload['subresource_uris'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ConferenceContext for this ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceContext - """ - if self._context is None: - self._context = ConferenceContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def region(self): - """ - :returns: The region - :rtype: unicode - """ - return self._properties['region'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this conference - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status of the conference - :rtype: ConferenceInstance.Status - """ - return self._properties['status'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - def fetch(self): - """ - Fetch a ConferenceInstance - - :returns: Fetched ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance - """ - return self._proxy.fetch() - - def update(self, status=values.unset, announce_url=values.unset, - announce_method=values.unset): - """ - Update the ConferenceInstance - - :param ConferenceInstance.UpdateStatus status: The status - :param unicode announce_url: The announce_url - :param unicode announce_method: The announce_method - - :returns: Updated ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance - """ - return self._proxy.update(status=status, announce_url=announce_url, announce_method=announce_method, ) - - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantList - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantList - """ - return self._proxy.participants - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.ConferenceInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/conference/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/conference/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 9e51875..0000000 Binary files a/twilio/rest/api/v2010/account/conference/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/conference/__pycache__/participant.cpython-36.pyc b/twilio/rest/api/v2010/account/conference/__pycache__/participant.cpython-36.pyc deleted file mode 100644 index 7a69ca4..0000000 Binary files a/twilio/rest/api/v2010/account/conference/__pycache__/participant.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/conference/participant.py b/twilio/rest/api/v2010/account/conference/participant.py deleted file mode 100644 index 7d60cd5..0000000 --- a/twilio/rest/api/v2010/account/conference/participant.py +++ /dev/null @@ -1,633 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class ParticipantList(ListResource): - """ """ - - def __init__(self, version, account_sid, conference_sid): - """ - Initialize the ParticipantList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - :param conference_sid: A string that uniquely identifies this conference - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantList - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantList - """ - super(ParticipantList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'conference_sid': conference_sid, } - self._uri = '/Accounts/{account_sid}/Conferences/{conference_sid}/Participants.json'.format(**self._solution) - - def create(self, from_, to, status_callback=values.unset, - status_callback_method=values.unset, - status_callback_event=values.unset, timeout=values.unset, - record=values.unset, muted=values.unset, beep=values.unset, - start_conference_on_enter=values.unset, - end_conference_on_exit=values.unset, wait_url=values.unset, - wait_method=values.unset, early_media=values.unset, - max_participants=values.unset, conference_record=values.unset, - conference_trim=values.unset, - conference_status_callback=values.unset, - conference_status_callback_method=values.unset, - conference_status_callback_event=values.unset, - recording_channels=values.unset, - recording_status_callback=values.unset, - recording_status_callback_method=values.unset, - sip_auth_username=values.unset, sip_auth_password=values.unset, - region=values.unset, - conference_recording_status_callback=values.unset, - conference_recording_status_callback_method=values.unset, - recording_status_callback_event=values.unset, - conference_recording_status_callback_event=values.unset): - """ - Create a new ParticipantInstance - - :param unicode from_: The from - :param unicode to: The to - :param unicode status_callback: The status_callback - :param unicode status_callback_method: The status_callback_method - :param unicode status_callback_event: The status_callback_event - :param unicode timeout: The timeout - :param bool record: The record - :param bool muted: The muted - :param unicode beep: The beep - :param bool start_conference_on_enter: The start_conference_on_enter - :param bool end_conference_on_exit: The end_conference_on_exit - :param unicode wait_url: The wait_url - :param unicode wait_method: The wait_method - :param bool early_media: The early_media - :param unicode max_participants: The max_participants - :param unicode conference_record: The conference_record - :param unicode conference_trim: The conference_trim - :param unicode conference_status_callback: The conference_status_callback - :param unicode conference_status_callback_method: The conference_status_callback_method - :param unicode conference_status_callback_event: The conference_status_callback_event - :param unicode recording_channels: The recording_channels - :param unicode recording_status_callback: The recording_status_callback - :param unicode recording_status_callback_method: The recording_status_callback_method - :param unicode sip_auth_username: The sip_auth_username - :param unicode sip_auth_password: The sip_auth_password - :param unicode region: The region - :param unicode conference_recording_status_callback: The conference_recording_status_callback - :param unicode conference_recording_status_callback_method: The conference_recording_status_callback_method - :param unicode recording_status_callback_event: The recording_status_callback_event - :param unicode conference_recording_status_callback_event: The conference_recording_status_callback_event - - :returns: Newly created ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ - data = values.of({ - 'From': from_, - 'To': to, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'StatusCallbackEvent': serialize.map(status_callback_event, lambda e: e), - 'Timeout': timeout, - 'Record': record, - 'Muted': muted, - 'Beep': beep, - 'StartConferenceOnEnter': start_conference_on_enter, - 'EndConferenceOnExit': end_conference_on_exit, - 'WaitUrl': wait_url, - 'WaitMethod': wait_method, - 'EarlyMedia': early_media, - 'MaxParticipants': max_participants, - 'ConferenceRecord': conference_record, - 'ConferenceTrim': conference_trim, - 'ConferenceStatusCallback': conference_status_callback, - 'ConferenceStatusCallbackMethod': conference_status_callback_method, - 'ConferenceStatusCallbackEvent': serialize.map(conference_status_callback_event, lambda e: e), - 'RecordingChannels': recording_channels, - 'RecordingStatusCallback': recording_status_callback, - 'RecordingStatusCallbackMethod': recording_status_callback_method, - 'SipAuthUsername': sip_auth_username, - 'SipAuthPassword': sip_auth_password, - 'Region': region, - 'ConferenceRecordingStatusCallback': conference_recording_status_callback, - 'ConferenceRecordingStatusCallbackMethod': conference_recording_status_callback_method, - 'RecordingStatusCallbackEvent': serialize.map(recording_status_callback_event, lambda e: e), - 'ConferenceRecordingStatusCallbackEvent': serialize.map(conference_recording_status_callback_event, lambda e: e), - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ParticipantInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - ) - - def stream(self, muted=values.unset, hold=values.unset, limit=None, - page_size=None): - """ - Streams ParticipantInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param bool muted: Filter by muted participants - :param bool hold: The hold - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.conference.participant.ParticipantInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(muted=muted, hold=hold, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, muted=values.unset, hold=values.unset, limit=None, - page_size=None): - """ - Lists ParticipantInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param bool muted: Filter by muted participants - :param bool hold: The hold - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.conference.participant.ParticipantInstance] - """ - return list(self.stream(muted=muted, hold=hold, limit=limit, page_size=page_size, )) - - def page(self, muted=values.unset, hold=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ParticipantInstance records from the API. - Request is executed immediately - - :param bool muted: Filter by muted participants - :param bool hold: The hold - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantPage - """ - params = values.of({ - 'Muted': muted, - 'Hold': hold, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ParticipantPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ParticipantInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ParticipantPage(self._version, response, self._solution) - - def get(self, call_sid): - """ - Constructs a ParticipantContext - - :param call_sid: The call_sid - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - call_sid=call_sid, - ) - - def __call__(self, call_sid): - """ - Constructs a ParticipantContext - - :param call_sid: The call_sid - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - call_sid=call_sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ParticipantList>' - - -class ParticipantPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ParticipantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - :param conference_sid: A string that uniquely identifies this conference - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantPage - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantPage - """ - super(ParticipantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ParticipantInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ - return ParticipantInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ParticipantPage>' - - -class ParticipantContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, conference_sid, call_sid): - """ - Initialize the ParticipantContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param conference_sid: The string that uniquely identifies this conference - :param call_sid: The call_sid - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - """ - super(ParticipantContext, self).__init__(version) - - # Path Solution - self._solution = { - 'account_sid': account_sid, - 'conference_sid': conference_sid, - 'call_sid': call_sid, - } - self._uri = '/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a ParticipantInstance - - :returns: Fetched ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ParticipantInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - call_sid=self._solution['call_sid'], - ) - - def update(self, muted=values.unset, hold=values.unset, hold_url=values.unset, - hold_method=values.unset, announce_url=values.unset, - announce_method=values.unset): - """ - Update the ParticipantInstance - - :param bool muted: Indicates if the participant should be muted - :param bool hold: The hold - :param unicode hold_url: The hold_url - :param unicode hold_method: The hold_method - :param unicode announce_url: The announce_url - :param unicode announce_method: The announce_method - - :returns: Updated ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ - data = values.of({ - 'Muted': muted, - 'Hold': hold, - 'HoldUrl': hold_url, - 'HoldMethod': hold_method, - 'AnnounceUrl': announce_url, - 'AnnounceMethod': announce_method, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ParticipantInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - call_sid=self._solution['call_sid'], - ) - - def delete(self): - """ - Deletes the ParticipantInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.ParticipantContext {}>'.format(context) - - -class ParticipantInstance(InstanceResource): - """ """ - - class Status(object): - QUEUED = "queued" - CONNECTING = "connecting" - RINGING = "ringing" - CONNECTED = "connected" - COMPLETE = "complete" - FAILED = "failed" - - def __init__(self, version, payload, account_sid, conference_sid, - call_sid=None): - """ - Initialize the ParticipantInstance - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ - super(ParticipantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'call_sid': payload['call_sid'], - 'conference_sid': payload['conference_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'end_conference_on_exit': payload['end_conference_on_exit'], - 'muted': payload['muted'], - 'hold': payload['hold'], - 'start_conference_on_enter': payload['start_conference_on_enter'], - 'status': payload['status'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'conference_sid': conference_sid, - 'call_sid': call_sid or self._properties['call_sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ParticipantContext for this ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - """ - if self._context is None: - self._context = ParticipantContext( - self._version, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - call_sid=self._solution['call_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def call_sid(self): - """ - :returns: A string that uniquely identifies this call - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def conference_sid(self): - """ - :returns: A string that uniquely identifies this conference - :rtype: unicode - """ - return self._properties['conference_sid'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def end_conference_on_exit(self): - """ - :returns: Indicates if the endConferenceOnExit was set - :rtype: bool - """ - return self._properties['end_conference_on_exit'] - - @property - def muted(self): - """ - :returns: Indicates if the participant is muted - :rtype: bool - """ - return self._properties['muted'] - - @property - def hold(self): - """ - :returns: The hold - :rtype: bool - """ - return self._properties['hold'] - - @property - def start_conference_on_enter(self): - """ - :returns: Indicates if the startConferenceOnEnter attribute was set - :rtype: bool - """ - return self._properties['start_conference_on_enter'] - - @property - def status(self): - """ - :returns: The status - :rtype: ParticipantInstance.Status - """ - return self._properties['status'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a ParticipantInstance - - :returns: Fetched ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ - return self._proxy.fetch() - - def update(self, muted=values.unset, hold=values.unset, hold_url=values.unset, - hold_method=values.unset, announce_url=values.unset, - announce_method=values.unset): - """ - Update the ParticipantInstance - - :param bool muted: Indicates if the participant should be muted - :param bool hold: The hold - :param unicode hold_url: The hold_url - :param unicode hold_method: The hold_method - :param unicode announce_url: The announce_url - :param unicode announce_method: The announce_method - - :returns: Updated ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ - return self._proxy.update( - muted=muted, - hold=hold, - hold_url=hold_url, - hold_method=hold_method, - announce_url=announce_url, - announce_method=announce_method, - ) - - def delete(self): - """ - Deletes the ParticipantInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.ParticipantInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/connect_app.py b/twilio/rest/api/v2010/account/connect_app.py deleted file mode 100644 index d2827b5..0000000 --- a/twilio/rest/api/v2010/account/connect_app.py +++ /dev/null @@ -1,474 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class ConnectAppList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the ConnectAppList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppList - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppList - """ - super(ConnectAppList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/ConnectApps.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ConnectAppInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.connect_app.ConnectAppInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ConnectAppInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.connect_app.ConnectAppInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ConnectAppInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ConnectAppPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ConnectAppInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ConnectAppPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ConnectAppContext - - :param sid: Fetch by unique connect-app Sid - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - """ - return ConnectAppContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ConnectAppContext - - :param sid: Fetch by unique connect-app Sid - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - """ - return ConnectAppContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ConnectAppList>' - - -class ConnectAppPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ConnectAppPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppPage - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppPage - """ - super(ConnectAppPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ConnectAppInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - """ - return ConnectAppInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ConnectAppPage>' - - -class ConnectAppContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the ConnectAppContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique connect-app Sid - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - """ - super(ConnectAppContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/ConnectApps/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a ConnectAppInstance - - :returns: Fetched ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ConnectAppInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, authorize_redirect_url=values.unset, company_name=values.unset, - deauthorize_callback_method=values.unset, - deauthorize_callback_url=values.unset, description=values.unset, - friendly_name=values.unset, homepage_url=values.unset, - permissions=values.unset): - """ - Update the ConnectAppInstance - - :param unicode authorize_redirect_url: URIL Twilio sends requests when users authorize - :param unicode company_name: The company name set for this Connect App. - :param unicode deauthorize_callback_method: HTTP method Twilio WIll use making requests to the url - :param unicode deauthorize_callback_url: URL Twilio will send a request when a user de-authorizes this app - :param unicode description: A more detailed human readable description - :param unicode friendly_name: A human readable name for the Connect App. - :param unicode homepage_url: The URL users can obtain more information - :param ConnectAppInstance.Permission permissions: The set of permissions that your ConnectApp requests. - - :returns: Updated ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - """ - data = values.of({ - 'AuthorizeRedirectUrl': authorize_redirect_url, - 'CompanyName': company_name, - 'DeauthorizeCallbackMethod': deauthorize_callback_method, - 'DeauthorizeCallbackUrl': deauthorize_callback_url, - 'Description': description, - 'FriendlyName': friendly_name, - 'HomepageUrl': homepage_url, - 'Permissions': serialize.map(permissions, lambda e: e), - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ConnectAppInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.ConnectAppContext {}>'.format(context) - - -class ConnectAppInstance(InstanceResource): - """ """ - - class Permission(object): - GET_ALL = "get-all" - POST_ALL = "post-all" - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the ConnectAppInstance - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - """ - super(ConnectAppInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'authorize_redirect_url': payload['authorize_redirect_url'], - 'company_name': payload['company_name'], - 'deauthorize_callback_method': payload['deauthorize_callback_method'], - 'deauthorize_callback_url': payload['deauthorize_callback_url'], - 'description': payload['description'], - 'friendly_name': payload['friendly_name'], - 'homepage_url': payload['homepage_url'], - 'permissions': payload['permissions'], - 'sid': payload['sid'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ConnectAppContext for this ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - """ - if self._context is None: - self._context = ConnectAppContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def authorize_redirect_url(self): - """ - :returns: URIL Twilio sends requests when users authorize - :rtype: unicode - """ - return self._properties['authorize_redirect_url'] - - @property - def company_name(self): - """ - :returns: The company name set for this Connect App. - :rtype: unicode - """ - return self._properties['company_name'] - - @property - def deauthorize_callback_method(self): - """ - :returns: HTTP method Twilio WIll use making requests to the url - :rtype: unicode - """ - return self._properties['deauthorize_callback_method'] - - @property - def deauthorize_callback_url(self): - """ - :returns: URL Twilio will send a request when a user de-authorizes this app - :rtype: unicode - """ - return self._properties['deauthorize_callback_url'] - - @property - def description(self): - """ - :returns: A more detailed human readable description - :rtype: unicode - """ - return self._properties['description'] - - @property - def friendly_name(self): - """ - :returns: A human readable name for the Connect App. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def homepage_url(self): - """ - :returns: The URL users can obtain more information - :rtype: unicode - """ - return self._properties['homepage_url'] - - @property - def permissions(self): - """ - :returns: The set of permissions that your ConnectApp requests. - :rtype: ConnectAppInstance.Permission - """ - return self._properties['permissions'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this connect-apps - :rtype: unicode - """ - return self._properties['sid'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a ConnectAppInstance - - :returns: Fetched ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - """ - return self._proxy.fetch() - - def update(self, authorize_redirect_url=values.unset, company_name=values.unset, - deauthorize_callback_method=values.unset, - deauthorize_callback_url=values.unset, description=values.unset, - friendly_name=values.unset, homepage_url=values.unset, - permissions=values.unset): - """ - Update the ConnectAppInstance - - :param unicode authorize_redirect_url: URIL Twilio sends requests when users authorize - :param unicode company_name: The company name set for this Connect App. - :param unicode deauthorize_callback_method: HTTP method Twilio WIll use making requests to the url - :param unicode deauthorize_callback_url: URL Twilio will send a request when a user de-authorizes this app - :param unicode description: A more detailed human readable description - :param unicode friendly_name: A human readable name for the Connect App. - :param unicode homepage_url: The URL users can obtain more information - :param ConnectAppInstance.Permission permissions: The set of permissions that your ConnectApp requests. - - :returns: Updated ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - """ - return self._proxy.update( - authorize_redirect_url=authorize_redirect_url, - company_name=company_name, - deauthorize_callback_method=deauthorize_callback_method, - deauthorize_callback_url=deauthorize_callback_url, - description=description, - friendly_name=friendly_name, - homepage_url=homepage_url, - permissions=permissions, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.ConnectAppInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py deleted file mode 100644 index 1d721f8..0000000 --- a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py +++ /dev/null @@ -1,939 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on import AssignedAddOnList -from twilio.rest.api.v2010.account.incoming_phone_number.local import LocalList -from twilio.rest.api.v2010.account.incoming_phone_number.mobile import MobileList -from twilio.rest.api.v2010.account.incoming_phone_number.toll_free import TollFreeList - - -class IncomingPhoneNumberList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the IncomingPhoneNumberList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - """ - super(IncomingPhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers.json'.format(**self._solution) - - # Components - self._local = None - self._mobile = None - self._toll_free = None - - def stream(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Streams IncomingPhoneNumberInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param bool beta: Include new phone numbers - :param unicode friendly_name: Filter by friendly name - :param unicode phone_number: Filter by incoming phone number - :param unicode origin: The origin - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Lists IncomingPhoneNumberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param bool beta: Include new phone numbers - :param unicode friendly_name: Filter by friendly name - :param unicode phone_number: Filter by incoming phone number - :param unicode origin: The origin - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance] - """ - return list(self.stream( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - limit=limit, - page_size=page_size, - )) - - def page(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of IncomingPhoneNumberInstance records from the API. - Request is executed immediately - - :param bool beta: Include new phone numbers - :param unicode friendly_name: Filter by friendly name - :param unicode phone_number: Filter by incoming phone number - :param unicode origin: The origin - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberPage - """ - params = values.of({ - 'Beta': beta, - 'FriendlyName': friendly_name, - 'PhoneNumber': phone_number, - 'Origin': origin, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return IncomingPhoneNumberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of IncomingPhoneNumberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return IncomingPhoneNumberPage(self._version, response, self._solution) - - def create(self, api_version=values.unset, friendly_name=values.unset, - sms_application_sid=values.unset, sms_fallback_method=values.unset, - sms_fallback_url=values.unset, sms_method=values.unset, - sms_url=values.unset, status_callback=values.unset, - status_callback_method=values.unset, - voice_application_sid=values.unset, - voice_caller_id_lookup=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_url=values.unset, - emergency_status=values.unset, emergency_address_sid=values.unset, - trunk_sid=values.unset, identity_sid=values.unset, - address_sid=values.unset, phone_number=values.unset, - area_code=values.unset): - """ - Create a new IncomingPhoneNumberInstance - - :param unicode api_version: The Twilio Rest API version to use - :param unicode friendly_name: A human readable description of this resource - :param unicode sms_application_sid: Unique string that identifies the application - :param unicode sms_fallback_method: HTTP method used with sms fallback url - :param unicode sms_fallback_url: URL Twilio will request if an error occurs in executing TwiML - :param unicode sms_method: HTTP method to use with sms url - :param unicode sms_url: URL Twilio will request when receiving an SMS - :param unicode status_callback: URL Twilio will use to pass status parameters - :param unicode status_callback_method: HTTP method twilio will use with status callback - :param unicode voice_application_sid: The unique sid of the application to handle this number - :param bool voice_caller_id_lookup: Look up the caller's caller-ID - :param unicode voice_fallback_method: HTTP method used with fallback_url - :param unicode voice_fallback_url: URL Twilio will request when an error occurs in TwiML - :param unicode voice_method: HTTP method used with the voice url - :param unicode voice_url: URL Twilio will request when receiving a call - :param IncomingPhoneNumberInstance.EmergencyStatus emergency_status: The emergency_status - :param unicode emergency_address_sid: The emergency_address_sid - :param unicode trunk_sid: Unique string to identify the trunk - :param unicode identity_sid: Unique string that identifies the identity associated with number - :param unicode address_sid: Unique string that identifies the address associated with number - :param unicode phone_number: The phone number - :param unicode area_code: The desired area code for the new number - - :returns: Newly created IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - """ - data = values.of({ - 'PhoneNumber': phone_number, - 'AreaCode': area_code, - 'ApiVersion': api_version, - 'FriendlyName': friendly_name, - 'SmsApplicationSid': sms_application_sid, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'VoiceApplicationSid': voice_application_sid, - 'VoiceCallerIdLookup': voice_caller_id_lookup, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, - 'EmergencyStatus': emergency_status, - 'EmergencyAddressSid': emergency_address_sid, - 'TrunkSid': trunk_sid, - 'IdentitySid': identity_sid, - 'AddressSid': address_sid, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return IncomingPhoneNumberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ) - - @property - def local(self): - """ - Access the local - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalList - """ - if self._local is None: - self._local = LocalList(self._version, account_sid=self._solution['account_sid'], ) - return self._local - - @property - def mobile(self): - """ - Access the mobile - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileList - """ - if self._mobile is None: - self._mobile = MobileList(self._version, account_sid=self._solution['account_sid'], ) - return self._mobile - - @property - def toll_free(self): - """ - Access the toll_free - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeList - """ - if self._toll_free is None: - self._toll_free = TollFreeList(self._version, account_sid=self._solution['account_sid'], ) - return self._toll_free - - def get(self, sid): - """ - Constructs a IncomingPhoneNumberContext - - :param sid: Fetch by unique incoming-phone-number Sid - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - """ - return IncomingPhoneNumberContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a IncomingPhoneNumberContext - - :param sid: Fetch by unique incoming-phone-number Sid - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - """ - return IncomingPhoneNumberContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.IncomingPhoneNumberList>' - - -class IncomingPhoneNumberPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the IncomingPhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberPage - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberPage - """ - super(IncomingPhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of IncomingPhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - """ - return IncomingPhoneNumberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.IncomingPhoneNumberPage>' - - -class IncomingPhoneNumberContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the IncomingPhoneNumberContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique incoming-phone-number Sid - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - """ - super(IncomingPhoneNumberContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/{sid}.json'.format(**self._solution) - - # Dependents - self._assigned_add_ons = None - - def update(self, account_sid=values.unset, api_version=values.unset, - friendly_name=values.unset, sms_application_sid=values.unset, - sms_fallback_method=values.unset, sms_fallback_url=values.unset, - sms_method=values.unset, sms_url=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - voice_application_sid=values.unset, - voice_caller_id_lookup=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_url=values.unset, - emergency_status=values.unset, emergency_address_sid=values.unset, - trunk_sid=values.unset, voice_receive_mode=values.unset, - identity_sid=values.unset, address_sid=values.unset): - """ - Update the IncomingPhoneNumberInstance - - :param unicode account_sid: The new owner of the phone number - :param unicode api_version: The Twilio REST API version to use - :param unicode friendly_name: A human readable description of this resource - :param unicode sms_application_sid: Unique string that identifies the application - :param unicode sms_fallback_method: HTTP method used with sms fallback url - :param unicode sms_fallback_url: URL Twilio will request if an error occurs in executing TwiML - :param unicode sms_method: HTTP method to use with sms url - :param unicode sms_url: URL Twilio will request when receiving an SMS - :param unicode status_callback: URL Twilio will use to pass status parameters - :param unicode status_callback_method: HTTP method twilio will use with status callback - :param unicode voice_application_sid: The unique sid of the application to handle this number - :param bool voice_caller_id_lookup: Look up the caller's caller-ID - :param unicode voice_fallback_method: HTTP method used with fallback_url - :param unicode voice_fallback_url: URL Twilio will request when an error occurs in TwiML - :param unicode voice_method: HTTP method used with the voice url - :param unicode voice_url: URL Twilio will request when receiving a call - :param IncomingPhoneNumberInstance.EmergencyStatus emergency_status: The emergency_status - :param unicode emergency_address_sid: The emergency_address_sid - :param unicode trunk_sid: Unique string to identify the trunk - :param IncomingPhoneNumberInstance.VoiceReceiveMode voice_receive_mode: The voice_receive_mode - :param unicode identity_sid: Unique string that identifies the identity associated with number - :param unicode address_sid: Unique string that identifies the address associated with number - - :returns: Updated IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - """ - data = values.of({ - 'AccountSid': account_sid, - 'ApiVersion': api_version, - 'FriendlyName': friendly_name, - 'SmsApplicationSid': sms_application_sid, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'VoiceApplicationSid': voice_application_sid, - 'VoiceCallerIdLookup': voice_caller_id_lookup, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, - 'EmergencyStatus': emergency_status, - 'EmergencyAddressSid': emergency_address_sid, - 'TrunkSid': trunk_sid, - 'VoiceReceiveMode': voice_receive_mode, - 'IdentitySid': identity_sid, - 'AddressSid': address_sid, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return IncomingPhoneNumberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def fetch(self): - """ - Fetch a IncomingPhoneNumberInstance - - :returns: Fetched IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return IncomingPhoneNumberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the IncomingPhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def assigned_add_ons(self): - """ - Access the assigned_add_ons - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnList - """ - if self._assigned_add_ons is None: - self._assigned_add_ons = AssignedAddOnList( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['sid'], - ) - return self._assigned_add_ons - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.IncomingPhoneNumberContext {}>'.format(context) - - -class IncomingPhoneNumberInstance(InstanceResource): - """ """ - - class AddressRequirement(object): - NONE = "none" - ANY = "any" - LOCAL = "local" - FOREIGN = "foreign" - - class EmergencyStatus(object): - ACTIVE = "Active" - INACTIVE = "Inactive" - - class VoiceReceiveMode(object): - VOICE = "voice" - FAX = "fax" - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the IncomingPhoneNumberInstance - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - """ - super(IncomingPhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'address_sid': payload['address_sid'], - 'address_requirements': payload['address_requirements'], - 'api_version': payload['api_version'], - 'beta': payload['beta'], - 'capabilities': payload['capabilities'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'identity_sid': payload['identity_sid'], - 'phone_number': payload['phone_number'], - 'origin': payload['origin'], - 'sid': payload['sid'], - 'sms_application_sid': payload['sms_application_sid'], - 'sms_fallback_method': payload['sms_fallback_method'], - 'sms_fallback_url': payload['sms_fallback_url'], - 'sms_method': payload['sms_method'], - 'sms_url': payload['sms_url'], - 'status_callback': payload['status_callback'], - 'status_callback_method': payload['status_callback_method'], - 'trunk_sid': payload['trunk_sid'], - 'uri': payload['uri'], - 'voice_application_sid': payload['voice_application_sid'], - 'voice_caller_id_lookup': payload['voice_caller_id_lookup'], - 'voice_fallback_method': payload['voice_fallback_method'], - 'voice_fallback_url': payload['voice_fallback_url'], - 'voice_method': payload['voice_method'], - 'voice_url': payload['voice_url'], - 'emergency_status': payload['emergency_status'], - 'emergency_address_sid': payload['emergency_address_sid'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: IncomingPhoneNumberContext for this IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - """ - if self._context is None: - self._context = IncomingPhoneNumberContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def address_sid(self): - """ - :returns: Unique string that identifies the address associated with number - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def address_requirements(self): - """ - :returns: Indicates if the customer requires an address - :rtype: IncomingPhoneNumberInstance.AddressRequirement - """ - return self._properties['address_requirements'] - - @property - def api_version(self): - """ - :returns: The Twilio REST API version to use - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def beta(self): - """ - :returns: Indicates if the phone number is a beta number - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: Indicate if a phone can receive calls or messages - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resouce - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def identity_sid(self): - """ - :returns: Unique string that identifies the identity associated with number - :rtype: unicode - """ - return self._properties['identity_sid'] - - @property - def phone_number(self): - """ - :returns: The incoming phone number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def origin(self): - """ - :returns: The origin - :rtype: unicode - """ - return self._properties['origin'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_application_sid(self): - """ - :returns: Unique string that identifies the application - :rtype: unicode - """ - return self._properties['sms_application_sid'] - - @property - def sms_fallback_method(self): - """ - :returns: HTTP method used with sms fallback url - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: URL Twilio will request if an error occurs in executing TwiML - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: HTTP method to use with sms url - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: URL Twilio will request when receiving an SMS - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def status_callback(self): - """ - :returns: URL Twilio will use to pass status parameters - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: HTTP method twilio will use with status callback - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def trunk_sid(self): - """ - :returns: Unique string to identify the trunk - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - @property - def voice_application_sid(self): - """ - :returns: The unique sid of the application to handle this number - :rtype: unicode - """ - return self._properties['voice_application_sid'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: Look up the caller's caller-ID - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def voice_fallback_method(self): - """ - :returns: HTTP method used with fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: URL Twilio will request when an error occurs in TwiML - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: HTTP method used with the voice url - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: URL Twilio will request when receiving a call - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def emergency_status(self): - """ - :returns: The emergency_status - :rtype: IncomingPhoneNumberInstance.EmergencyStatus - """ - return self._properties['emergency_status'] - - @property - def emergency_address_sid(self): - """ - :returns: The emergency_address_sid - :rtype: unicode - """ - return self._properties['emergency_address_sid'] - - def update(self, account_sid=values.unset, api_version=values.unset, - friendly_name=values.unset, sms_application_sid=values.unset, - sms_fallback_method=values.unset, sms_fallback_url=values.unset, - sms_method=values.unset, sms_url=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - voice_application_sid=values.unset, - voice_caller_id_lookup=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_url=values.unset, - emergency_status=values.unset, emergency_address_sid=values.unset, - trunk_sid=values.unset, voice_receive_mode=values.unset, - identity_sid=values.unset, address_sid=values.unset): - """ - Update the IncomingPhoneNumberInstance - - :param unicode account_sid: The new owner of the phone number - :param unicode api_version: The Twilio REST API version to use - :param unicode friendly_name: A human readable description of this resource - :param unicode sms_application_sid: Unique string that identifies the application - :param unicode sms_fallback_method: HTTP method used with sms fallback url - :param unicode sms_fallback_url: URL Twilio will request if an error occurs in executing TwiML - :param unicode sms_method: HTTP method to use with sms url - :param unicode sms_url: URL Twilio will request when receiving an SMS - :param unicode status_callback: URL Twilio will use to pass status parameters - :param unicode status_callback_method: HTTP method twilio will use with status callback - :param unicode voice_application_sid: The unique sid of the application to handle this number - :param bool voice_caller_id_lookup: Look up the caller's caller-ID - :param unicode voice_fallback_method: HTTP method used with fallback_url - :param unicode voice_fallback_url: URL Twilio will request when an error occurs in TwiML - :param unicode voice_method: HTTP method used with the voice url - :param unicode voice_url: URL Twilio will request when receiving a call - :param IncomingPhoneNumberInstance.EmergencyStatus emergency_status: The emergency_status - :param unicode emergency_address_sid: The emergency_address_sid - :param unicode trunk_sid: Unique string to identify the trunk - :param IncomingPhoneNumberInstance.VoiceReceiveMode voice_receive_mode: The voice_receive_mode - :param unicode identity_sid: Unique string that identifies the identity associated with number - :param unicode address_sid: Unique string that identifies the address associated with number - - :returns: Updated IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - """ - return self._proxy.update( - account_sid=account_sid, - api_version=api_version, - friendly_name=friendly_name, - sms_application_sid=sms_application_sid, - sms_fallback_method=sms_fallback_method, - sms_fallback_url=sms_fallback_url, - sms_method=sms_method, - sms_url=sms_url, - status_callback=status_callback, - status_callback_method=status_callback_method, - voice_application_sid=voice_application_sid, - voice_caller_id_lookup=voice_caller_id_lookup, - voice_fallback_method=voice_fallback_method, - voice_fallback_url=voice_fallback_url, - voice_method=voice_method, - voice_url=voice_url, - emergency_status=emergency_status, - emergency_address_sid=emergency_address_sid, - trunk_sid=trunk_sid, - voice_receive_mode=voice_receive_mode, - identity_sid=identity_sid, - address_sid=address_sid, - ) - - def fetch(self): - """ - Fetch a IncomingPhoneNumberInstance - - :returns: Fetched IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the IncomingPhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def assigned_add_ons(self): - """ - Access the assigned_add_ons - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnList - """ - return self._proxy.assigned_add_ons - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.IncomingPhoneNumberInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/incoming_phone_number/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index ed557e2..0000000 Binary files a/twilio/rest/api/v2010/account/incoming_phone_number/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/__pycache__/local.cpython-36.pyc b/twilio/rest/api/v2010/account/incoming_phone_number/__pycache__/local.cpython-36.pyc deleted file mode 100644 index af686bf..0000000 Binary files a/twilio/rest/api/v2010/account/incoming_phone_number/__pycache__/local.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/__pycache__/mobile.cpython-36.pyc b/twilio/rest/api/v2010/account/incoming_phone_number/__pycache__/mobile.cpython-36.pyc deleted file mode 100644 index 0d92bca..0000000 Binary files a/twilio/rest/api/v2010/account/incoming_phone_number/__pycache__/mobile.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/__pycache__/toll_free.cpython-36.pyc b/twilio/rest/api/v2010/account/incoming_phone_number/__pycache__/toll_free.cpython-36.pyc deleted file mode 100644 index 2959ce5..0000000 Binary files a/twilio/rest/api/v2010/account/incoming_phone_number/__pycache__/toll_free.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py deleted file mode 100644 index a8a0649..0000000 --- a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py +++ /dev/null @@ -1,496 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension import AssignedAddOnExtensionList - - -class AssignedAddOnList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, account_sid, resource_sid): - """ - Initialize the AssignedAddOnList - - :param Version version: Version that contains the resource - :param account_sid: The Account id that has installed this Add-on - :param resource_sid: The Phone Number id that has installed this Add-on - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnList - """ - super(AssignedAddOnList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'resource_sid': resource_sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/{resource_sid}/AssignedAddOns.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AssignedAddOnInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AssignedAddOnInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AssignedAddOnInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AssignedAddOnPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AssignedAddOnInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AssignedAddOnPage(self._version, response, self._solution) - - def create(self, installed_add_on_sid): - """ - Create a new AssignedAddOnInstance - - :param unicode installed_add_on_sid: A string that uniquely identifies the Add-on installation - - :returns: Newly created AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance - """ - data = values.of({'InstalledAddOnSid': installed_add_on_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return AssignedAddOnInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - ) - - def get(self, sid): - """ - Constructs a AssignedAddOnContext - - :param sid: The unique Installed Add-on Sid - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - """ - return AssignedAddOnContext( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a AssignedAddOnContext - - :param sid: The unique Installed Add-on Sid - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - """ - return AssignedAddOnContext( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AssignedAddOnList>' - - -class AssignedAddOnPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the AssignedAddOnPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The Account id that has installed this Add-on - :param resource_sid: The Phone Number id that has installed this Add-on - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnPage - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnPage - """ - super(AssignedAddOnPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AssignedAddOnInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance - """ - return AssignedAddOnInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AssignedAddOnPage>' - - -class AssignedAddOnContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, account_sid, resource_sid, sid): - """ - Initialize the AssignedAddOnContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param resource_sid: The resource_sid - :param sid: The unique Installed Add-on Sid - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - """ - super(AssignedAddOnContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'resource_sid': resource_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/{resource_sid}/AssignedAddOns/{sid}.json'.format(**self._solution) - - # Dependents - self._extensions = None - - def fetch(self): - """ - Fetch a AssignedAddOnInstance - - :returns: Fetched AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return AssignedAddOnInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the AssignedAddOnInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def extensions(self): - """ - Access the extensions - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionList - """ - if self._extensions is None: - self._extensions = AssignedAddOnExtensionList( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - assigned_add_on_sid=self._solution['sid'], - ) - return self._extensions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AssignedAddOnContext {}>'.format(context) - - -class AssignedAddOnInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, account_sid, resource_sid, sid=None): - """ - Initialize the AssignedAddOnInstance - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance - """ - super(AssignedAddOnInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'resource_sid': payload['resource_sid'], - 'friendly_name': payload['friendly_name'], - 'description': payload['description'], - 'configuration': payload['configuration'], - 'unique_name': payload['unique_name'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'uri': payload['uri'], - 'subresource_uris': payload['subresource_uris'], - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'resource_sid': resource_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AssignedAddOnContext for this AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - """ - if self._context is None: - self._context = AssignedAddOnContext( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this assigned Add-on installation - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The Account id that has installed this Add-on - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def resource_sid(self): - """ - :returns: The Phone Number id that has installed this Add-on - :rtype: unicode - """ - return self._properties['resource_sid'] - - @property - def friendly_name(self): - """ - :returns: A description of this Add-on installation - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def description(self): - """ - :returns: A short description of the Add-on functionality - :rtype: unicode - """ - return self._properties['description'] - - @property - def configuration(self): - """ - :returns: The JSON object representing the current configuration - :rtype: dict - """ - return self._properties['configuration'] - - @property - def unique_name(self): - """ - :returns: The string that uniquely identifies this Add-on installation - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def date_created(self): - """ - :returns: The date this Add-on was installed - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Add-on installation was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - def fetch(self): - """ - Fetch a AssignedAddOnInstance - - :returns: Fetched AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the AssignedAddOnInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def extensions(self): - """ - Access the extensions - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionList - """ - return self._proxy.extensions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AssignedAddOnInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 3e704e6..0000000 Binary files a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__pycache__/assigned_add_on_extension.cpython-36.pyc b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__pycache__/assigned_add_on_extension.cpython-36.pyc deleted file mode 100644 index f40c359..0000000 Binary files a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__pycache__/assigned_add_on_extension.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py deleted file mode 100644 index 9b0937e..0000000 --- a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py +++ /dev/null @@ -1,424 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class AssignedAddOnExtensionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, account_sid, resource_sid, assigned_add_on_sid): - """ - Initialize the AssignedAddOnExtensionList - - :param Version version: Version that contains the resource - :param account_sid: The Account id that has installed this Add-on - :param resource_sid: The Phone Number id that has installed this Add-on - :param assigned_add_on_sid: A string that uniquely identifies the assigned Add-on installation - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionList - """ - super(AssignedAddOnExtensionList, self).__init__(version) - - # Path Solution - self._solution = { - 'account_sid': account_sid, - 'resource_sid': resource_sid, - 'assigned_add_on_sid': assigned_add_on_sid, - } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/{resource_sid}/AssignedAddOns/{assigned_add_on_sid}/Extensions.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AssignedAddOnExtensionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AssignedAddOnExtensionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AssignedAddOnExtensionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AssignedAddOnExtensionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AssignedAddOnExtensionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AssignedAddOnExtensionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AssignedAddOnExtensionContext - - :param sid: The unique Extension Sid - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - """ - return AssignedAddOnExtensionContext( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - assigned_add_on_sid=self._solution['assigned_add_on_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a AssignedAddOnExtensionContext - - :param sid: The unique Extension Sid - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - """ - return AssignedAddOnExtensionContext( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - assigned_add_on_sid=self._solution['assigned_add_on_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AssignedAddOnExtensionList>' - - -class AssignedAddOnExtensionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the AssignedAddOnExtensionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The Account id that has installed this Add-on - :param resource_sid: The Phone Number id that has installed this Add-on - :param assigned_add_on_sid: A string that uniquely identifies the assigned Add-on installation - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionPage - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionPage - """ - super(AssignedAddOnExtensionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AssignedAddOnExtensionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance - """ - return AssignedAddOnExtensionInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - assigned_add_on_sid=self._solution['assigned_add_on_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AssignedAddOnExtensionPage>' - - -class AssignedAddOnExtensionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, account_sid, resource_sid, assigned_add_on_sid, - sid): - """ - Initialize the AssignedAddOnExtensionContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param resource_sid: The resource_sid - :param assigned_add_on_sid: The assigned_add_on_sid - :param sid: The unique Extension Sid - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - """ - super(AssignedAddOnExtensionContext, self).__init__(version) - - # Path Solution - self._solution = { - 'account_sid': account_sid, - 'resource_sid': resource_sid, - 'assigned_add_on_sid': assigned_add_on_sid, - 'sid': sid, - } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/{resource_sid}/AssignedAddOns/{assigned_add_on_sid}/Extensions/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a AssignedAddOnExtensionInstance - - :returns: Fetched AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return AssignedAddOnExtensionInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - assigned_add_on_sid=self._solution['assigned_add_on_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AssignedAddOnExtensionContext {}>'.format(context) - - -class AssignedAddOnExtensionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, account_sid, resource_sid, - assigned_add_on_sid, sid=None): - """ - Initialize the AssignedAddOnExtensionInstance - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance - """ - super(AssignedAddOnExtensionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'resource_sid': payload['resource_sid'], - 'assigned_add_on_sid': payload['assigned_add_on_sid'], - 'friendly_name': payload['friendly_name'], - 'product_name': payload['product_name'], - 'unique_name': payload['unique_name'], - 'uri': payload['uri'], - 'enabled': payload['enabled'], - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'resource_sid': resource_sid, - 'assigned_add_on_sid': assigned_add_on_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AssignedAddOnExtensionContext for this AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - """ - if self._context is None: - self._context = AssignedAddOnExtensionContext( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - assigned_add_on_sid=self._solution['assigned_add_on_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Extension - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The Account id that has installed this Add-on - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def resource_sid(self): - """ - :returns: The Phone Number id that has installed this Add-on - :rtype: unicode - """ - return self._properties['resource_sid'] - - @property - def assigned_add_on_sid(self): - """ - :returns: A string that uniquely identifies the assigned Add-on installation - :rtype: unicode - """ - return self._properties['assigned_add_on_sid'] - - @property - def friendly_name(self): - """ - :returns: A human-readable description of this Extension - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def product_name(self): - """ - :returns: A human-readable description of the Extension's Product - :rtype: unicode - """ - return self._properties['product_name'] - - @property - def unique_name(self): - """ - :returns: The string that uniquely identifies this Extension - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def enabled(self): - """ - :returns: A Boolean indicating if the Extension will be invoked - :rtype: bool - """ - return self._properties['enabled'] - - def fetch(self): - """ - Fetch a AssignedAddOnExtensionInstance - - :returns: Fetched AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AssignedAddOnExtensionInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/local.py b/twilio/rest/api/v2010/account/incoming_phone_number/local.py deleted file mode 100644 index 719f039..0000000 --- a/twilio/rest/api/v2010/account/incoming_phone_number/local.py +++ /dev/null @@ -1,554 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class LocalList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the LocalList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalList - """ - super(LocalList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/Local.json'.format(**self._solution) - - def stream(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Streams LocalInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param bool beta: The beta - :param unicode friendly_name: The friendly_name - :param unicode phone_number: The phone_number - :param unicode origin: The origin - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Lists LocalInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param bool beta: The beta - :param unicode friendly_name: The friendly_name - :param unicode phone_number: The phone_number - :param unicode origin: The origin - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance] - """ - return list(self.stream( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - limit=limit, - page_size=page_size, - )) - - def page(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of LocalInstance records from the API. - Request is executed immediately - - :param bool beta: The beta - :param unicode friendly_name: The friendly_name - :param unicode phone_number: The phone_number - :param unicode origin: The origin - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of LocalInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalPage - """ - params = values.of({ - 'Beta': beta, - 'FriendlyName': friendly_name, - 'PhoneNumber': phone_number, - 'Origin': origin, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return LocalPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of LocalInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of LocalInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return LocalPage(self._version, response, self._solution) - - def create(self, phone_number, api_version=values.unset, - friendly_name=values.unset, sms_application_sid=values.unset, - sms_fallback_method=values.unset, sms_fallback_url=values.unset, - sms_method=values.unset, sms_url=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - voice_application_sid=values.unset, - voice_caller_id_lookup=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_url=values.unset, - identity_sid=values.unset, address_sid=values.unset): - """ - Create a new LocalInstance - - :param unicode phone_number: The phone_number - :param unicode api_version: The api_version - :param unicode friendly_name: The friendly_name - :param unicode sms_application_sid: The sms_application_sid - :param unicode sms_fallback_method: The sms_fallback_method - :param unicode sms_fallback_url: The sms_fallback_url - :param unicode sms_method: The sms_method - :param unicode sms_url: The sms_url - :param unicode status_callback: The status_callback - :param unicode status_callback_method: The status_callback_method - :param unicode voice_application_sid: The voice_application_sid - :param bool voice_caller_id_lookup: The voice_caller_id_lookup - :param unicode voice_fallback_method: The voice_fallback_method - :param unicode voice_fallback_url: The voice_fallback_url - :param unicode voice_method: The voice_method - :param unicode voice_url: The voice_url - :param unicode identity_sid: The identity_sid - :param unicode address_sid: The address_sid - - :returns: Newly created LocalInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance - """ - data = values.of({ - 'PhoneNumber': phone_number, - 'ApiVersion': api_version, - 'FriendlyName': friendly_name, - 'SmsApplicationSid': sms_application_sid, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'VoiceApplicationSid': voice_application_sid, - 'VoiceCallerIdLookup': voice_caller_id_lookup, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, - 'IdentitySid': identity_sid, - 'AddressSid': address_sid, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return LocalInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.LocalList>' - - -class LocalPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the LocalPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalPage - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalPage - """ - super(LocalPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of LocalInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance - """ - return LocalInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.LocalPage>' - - -class LocalInstance(InstanceResource): - """ """ - - class AddressRequirement(object): - NONE = "none" - ANY = "any" - LOCAL = "local" - FOREIGN = "foreign" - - def __init__(self, version, payload, account_sid): - """ - Initialize the LocalInstance - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance - """ - super(LocalInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'address_sid': payload['address_sid'], - 'address_requirements': payload['address_requirements'], - 'api_version': payload['api_version'], - 'beta': payload['beta'], - 'capabilities': payload['capabilities'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'identity_sid': payload['identity_sid'], - 'phone_number': payload['phone_number'], - 'origin': payload['origin'], - 'sid': payload['sid'], - 'sms_application_sid': payload['sms_application_sid'], - 'sms_fallback_method': payload['sms_fallback_method'], - 'sms_fallback_url': payload['sms_fallback_url'], - 'sms_method': payload['sms_method'], - 'sms_url': payload['sms_url'], - 'status_callback': payload['status_callback'], - 'status_callback_method': payload['status_callback_method'], - 'trunk_sid': payload['trunk_sid'], - 'uri': payload['uri'], - 'voice_application_sid': payload['voice_application_sid'], - 'voice_caller_id_lookup': payload['voice_caller_id_lookup'], - 'voice_fallback_method': payload['voice_fallback_method'], - 'voice_fallback_url': payload['voice_fallback_url'], - 'voice_method': payload['voice_method'], - 'voice_url': payload['voice_url'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def address_sid(self): - """ - :returns: The address_sid - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def address_requirements(self): - """ - :returns: The address_requirements - :rtype: LocalInstance.AddressRequirement - """ - return self._properties['address_requirements'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def beta(self): - """ - :returns: The beta - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def identity_sid(self): - """ - :returns: The identity_sid - :rtype: unicode - """ - return self._properties['identity_sid'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def origin(self): - """ - :returns: The origin - :rtype: unicode - """ - return self._properties['origin'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_application_sid(self): - """ - :returns: The sms_application_sid - :rtype: unicode - """ - return self._properties['sms_application_sid'] - - @property - def sms_fallback_method(self): - """ - :returns: The sms_fallback_method - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The sms_method - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The sms_url - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def status_callback(self): - """ - :returns: The status_callback - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The status_callback_method - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def trunk_sid(self): - """ - :returns: The trunk_sid - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def voice_application_sid(self): - """ - :returns: The voice_application_sid - :rtype: unicode - """ - return self._properties['voice_application_sid'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: The voice_caller_id_lookup - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def voice_fallback_method(self): - """ - :returns: The voice_fallback_method - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The voice_method - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: The voice_url - :rtype: unicode - """ - return self._properties['voice_url'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.LocalInstance>' diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py deleted file mode 100644 index 54c4d77..0000000 --- a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py +++ /dev/null @@ -1,554 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MobileList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the MobileList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileList - """ - super(MobileList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/Mobile.json'.format(**self._solution) - - def stream(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Streams MobileInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param bool beta: The beta - :param unicode friendly_name: The friendly_name - :param unicode phone_number: The phone_number - :param unicode origin: The origin - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Lists MobileInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param bool beta: The beta - :param unicode friendly_name: The friendly_name - :param unicode phone_number: The phone_number - :param unicode origin: The origin - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileInstance] - """ - return list(self.stream( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - limit=limit, - page_size=page_size, - )) - - def page(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of MobileInstance records from the API. - Request is executed immediately - - :param bool beta: The beta - :param unicode friendly_name: The friendly_name - :param unicode phone_number: The phone_number - :param unicode origin: The origin - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MobileInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobilePage - """ - params = values.of({ - 'Beta': beta, - 'FriendlyName': friendly_name, - 'PhoneNumber': phone_number, - 'Origin': origin, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MobilePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MobileInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MobileInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobilePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MobilePage(self._version, response, self._solution) - - def create(self, phone_number, api_version=values.unset, - friendly_name=values.unset, sms_application_sid=values.unset, - sms_fallback_method=values.unset, sms_fallback_url=values.unset, - sms_method=values.unset, sms_url=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - voice_application_sid=values.unset, - voice_caller_id_lookup=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_url=values.unset, - identity_sid=values.unset, address_sid=values.unset): - """ - Create a new MobileInstance - - :param unicode phone_number: The phone_number - :param unicode api_version: The api_version - :param unicode friendly_name: The friendly_name - :param unicode sms_application_sid: The sms_application_sid - :param unicode sms_fallback_method: The sms_fallback_method - :param unicode sms_fallback_url: The sms_fallback_url - :param unicode sms_method: The sms_method - :param unicode sms_url: The sms_url - :param unicode status_callback: The status_callback - :param unicode status_callback_method: The status_callback_method - :param unicode voice_application_sid: The voice_application_sid - :param bool voice_caller_id_lookup: The voice_caller_id_lookup - :param unicode voice_fallback_method: The voice_fallback_method - :param unicode voice_fallback_url: The voice_fallback_url - :param unicode voice_method: The voice_method - :param unicode voice_url: The voice_url - :param unicode identity_sid: The identity_sid - :param unicode address_sid: The address_sid - - :returns: Newly created MobileInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileInstance - """ - data = values.of({ - 'PhoneNumber': phone_number, - 'ApiVersion': api_version, - 'FriendlyName': friendly_name, - 'SmsApplicationSid': sms_application_sid, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'VoiceApplicationSid': voice_application_sid, - 'VoiceCallerIdLookup': voice_caller_id_lookup, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, - 'IdentitySid': identity_sid, - 'AddressSid': address_sid, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return MobileInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MobileList>' - - -class MobilePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MobilePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobilePage - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobilePage - """ - super(MobilePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MobileInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileInstance - """ - return MobileInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MobilePage>' - - -class MobileInstance(InstanceResource): - """ """ - - class AddressRequirement(object): - NONE = "none" - ANY = "any" - LOCAL = "local" - FOREIGN = "foreign" - - def __init__(self, version, payload, account_sid): - """ - Initialize the MobileInstance - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileInstance - """ - super(MobileInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'address_sid': payload['address_sid'], - 'address_requirements': payload['address_requirements'], - 'api_version': payload['api_version'], - 'beta': payload['beta'], - 'capabilities': payload['capabilities'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'identity_sid': payload['identity_sid'], - 'phone_number': payload['phone_number'], - 'origin': payload['origin'], - 'sid': payload['sid'], - 'sms_application_sid': payload['sms_application_sid'], - 'sms_fallback_method': payload['sms_fallback_method'], - 'sms_fallback_url': payload['sms_fallback_url'], - 'sms_method': payload['sms_method'], - 'sms_url': payload['sms_url'], - 'status_callback': payload['status_callback'], - 'status_callback_method': payload['status_callback_method'], - 'trunk_sid': payload['trunk_sid'], - 'uri': payload['uri'], - 'voice_application_sid': payload['voice_application_sid'], - 'voice_caller_id_lookup': payload['voice_caller_id_lookup'], - 'voice_fallback_method': payload['voice_fallback_method'], - 'voice_fallback_url': payload['voice_fallback_url'], - 'voice_method': payload['voice_method'], - 'voice_url': payload['voice_url'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def address_sid(self): - """ - :returns: The address_sid - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def address_requirements(self): - """ - :returns: The address_requirements - :rtype: MobileInstance.AddressRequirement - """ - return self._properties['address_requirements'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def beta(self): - """ - :returns: The beta - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def identity_sid(self): - """ - :returns: The identity_sid - :rtype: unicode - """ - return self._properties['identity_sid'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def origin(self): - """ - :returns: The origin - :rtype: unicode - """ - return self._properties['origin'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_application_sid(self): - """ - :returns: The sms_application_sid - :rtype: unicode - """ - return self._properties['sms_application_sid'] - - @property - def sms_fallback_method(self): - """ - :returns: The sms_fallback_method - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The sms_method - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The sms_url - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def status_callback(self): - """ - :returns: The status_callback - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The status_callback_method - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def trunk_sid(self): - """ - :returns: The trunk_sid - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def voice_application_sid(self): - """ - :returns: The voice_application_sid - :rtype: unicode - """ - return self._properties['voice_application_sid'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: The voice_caller_id_lookup - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def voice_fallback_method(self): - """ - :returns: The voice_fallback_method - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The voice_method - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: The voice_url - :rtype: unicode - """ - return self._properties['voice_url'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MobileInstance>' diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py b/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py deleted file mode 100644 index 1023cce..0000000 --- a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py +++ /dev/null @@ -1,554 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TollFreeList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the TollFreeList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeList - """ - super(TollFreeList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/TollFree.json'.format(**self._solution) - - def stream(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Streams TollFreeInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param bool beta: The beta - :param unicode friendly_name: The friendly_name - :param unicode phone_number: The phone_number - :param unicode origin: The origin - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Lists TollFreeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param bool beta: The beta - :param unicode friendly_name: The friendly_name - :param unicode phone_number: The phone_number - :param unicode origin: The origin - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeInstance] - """ - return list(self.stream( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - limit=limit, - page_size=page_size, - )) - - def page(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TollFreeInstance records from the API. - Request is executed immediately - - :param bool beta: The beta - :param unicode friendly_name: The friendly_name - :param unicode phone_number: The phone_number - :param unicode origin: The origin - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TollFreeInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreePage - """ - params = values.of({ - 'Beta': beta, - 'FriendlyName': friendly_name, - 'PhoneNumber': phone_number, - 'Origin': origin, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return TollFreePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TollFreeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TollFreeInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TollFreePage(self._version, response, self._solution) - - def create(self, phone_number, api_version=values.unset, - friendly_name=values.unset, sms_application_sid=values.unset, - sms_fallback_method=values.unset, sms_fallback_url=values.unset, - sms_method=values.unset, sms_url=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - voice_application_sid=values.unset, - voice_caller_id_lookup=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_url=values.unset, - identity_sid=values.unset, address_sid=values.unset): - """ - Create a new TollFreeInstance - - :param unicode phone_number: The phone_number - :param unicode api_version: The api_version - :param unicode friendly_name: The friendly_name - :param unicode sms_application_sid: The sms_application_sid - :param unicode sms_fallback_method: The sms_fallback_method - :param unicode sms_fallback_url: The sms_fallback_url - :param unicode sms_method: The sms_method - :param unicode sms_url: The sms_url - :param unicode status_callback: The status_callback - :param unicode status_callback_method: The status_callback_method - :param unicode voice_application_sid: The voice_application_sid - :param bool voice_caller_id_lookup: The voice_caller_id_lookup - :param unicode voice_fallback_method: The voice_fallback_method - :param unicode voice_fallback_url: The voice_fallback_url - :param unicode voice_method: The voice_method - :param unicode voice_url: The voice_url - :param unicode identity_sid: The identity_sid - :param unicode address_sid: The address_sid - - :returns: Newly created TollFreeInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeInstance - """ - data = values.of({ - 'PhoneNumber': phone_number, - 'ApiVersion': api_version, - 'FriendlyName': friendly_name, - 'SmsApplicationSid': sms_application_sid, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'VoiceApplicationSid': voice_application_sid, - 'VoiceCallerIdLookup': voice_caller_id_lookup, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, - 'IdentitySid': identity_sid, - 'AddressSid': address_sid, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return TollFreeInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TollFreeList>' - - -class TollFreePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TollFreePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreePage - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreePage - """ - super(TollFreePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TollFreeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeInstance - """ - return TollFreeInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TollFreePage>' - - -class TollFreeInstance(InstanceResource): - """ """ - - class AddressRequirement(object): - NONE = "none" - ANY = "any" - LOCAL = "local" - FOREIGN = "foreign" - - def __init__(self, version, payload, account_sid): - """ - Initialize the TollFreeInstance - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeInstance - """ - super(TollFreeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'address_sid': payload['address_sid'], - 'address_requirements': payload['address_requirements'], - 'api_version': payload['api_version'], - 'beta': payload['beta'], - 'capabilities': payload['capabilities'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'identity_sid': payload['identity_sid'], - 'phone_number': payload['phone_number'], - 'origin': payload['origin'], - 'sid': payload['sid'], - 'sms_application_sid': payload['sms_application_sid'], - 'sms_fallback_method': payload['sms_fallback_method'], - 'sms_fallback_url': payload['sms_fallback_url'], - 'sms_method': payload['sms_method'], - 'sms_url': payload['sms_url'], - 'status_callback': payload['status_callback'], - 'status_callback_method': payload['status_callback_method'], - 'trunk_sid': payload['trunk_sid'], - 'uri': payload['uri'], - 'voice_application_sid': payload['voice_application_sid'], - 'voice_caller_id_lookup': payload['voice_caller_id_lookup'], - 'voice_fallback_method': payload['voice_fallback_method'], - 'voice_fallback_url': payload['voice_fallback_url'], - 'voice_method': payload['voice_method'], - 'voice_url': payload['voice_url'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def address_sid(self): - """ - :returns: The address_sid - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def address_requirements(self): - """ - :returns: The address_requirements - :rtype: TollFreeInstance.AddressRequirement - """ - return self._properties['address_requirements'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def beta(self): - """ - :returns: The beta - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def identity_sid(self): - """ - :returns: The identity_sid - :rtype: unicode - """ - return self._properties['identity_sid'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def origin(self): - """ - :returns: The origin - :rtype: unicode - """ - return self._properties['origin'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_application_sid(self): - """ - :returns: The sms_application_sid - :rtype: unicode - """ - return self._properties['sms_application_sid'] - - @property - def sms_fallback_method(self): - """ - :returns: The sms_fallback_method - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The sms_method - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The sms_url - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def status_callback(self): - """ - :returns: The status_callback - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The status_callback_method - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def trunk_sid(self): - """ - :returns: The trunk_sid - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def voice_application_sid(self): - """ - :returns: The voice_application_sid - :rtype: unicode - """ - return self._properties['voice_application_sid'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: The voice_caller_id_lookup - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def voice_fallback_method(self): - """ - :returns: The voice_fallback_method - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The voice_method - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: The voice_url - :rtype: unicode - """ - return self._properties['voice_url'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TollFreeInstance>' diff --git a/twilio/rest/api/v2010/account/key.py b/twilio/rest/api/v2010/account/key.py deleted file mode 100644 index 3089eae..0000000 --- a/twilio/rest/api/v2010/account/key.py +++ /dev/null @@ -1,385 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class KeyList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the KeyList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.key.KeyList - :rtype: twilio.rest.api.v2010.account.key.KeyList - """ - super(KeyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Keys.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams KeyInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.key.KeyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists KeyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.key.KeyInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of KeyInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return KeyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of KeyInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return KeyPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a KeyContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.key.KeyContext - :rtype: twilio.rest.api.v2010.account.key.KeyContext - """ - return KeyContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a KeyContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.key.KeyContext - :rtype: twilio.rest.api.v2010.account.key.KeyContext - """ - return KeyContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.KeyList>' - - -class KeyPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the KeyPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.key.KeyPage - :rtype: twilio.rest.api.v2010.account.key.KeyPage - """ - super(KeyPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of KeyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.key.KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyInstance - """ - return KeyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.KeyPage>' - - -class KeyContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the KeyContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.key.KeyContext - :rtype: twilio.rest.api.v2010.account.key.KeyContext - """ - super(KeyContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Keys/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a KeyInstance - - :returns: Fetched KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return KeyInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset): - """ - Update the KeyInstance - - :param unicode friendly_name: The friendly_name - - :returns: Updated KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return KeyInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the KeyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.KeyContext {}>'.format(context) - - -class KeyInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the KeyInstance - - :returns: twilio.rest.api.v2010.account.key.KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyInstance - """ - super(KeyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: KeyContext for this KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyContext - """ - if self._context is None: - self._context = KeyContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - def fetch(self): - """ - Fetch a KeyInstance - - :returns: Fetched KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset): - """ - Update the KeyInstance - - :param unicode friendly_name: The friendly_name - - :returns: Updated KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) - - def delete(self): - """ - Deletes the KeyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.KeyInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py deleted file mode 100644 index cb651ed..0000000 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ /dev/null @@ -1,716 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.message.feedback import FeedbackList -from twilio.rest.api.v2010.account.message.media import MediaList - - -class MessageList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the MessageList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.message.MessageList - :rtype: twilio.rest.api.v2010.account.message.MessageList - """ - super(MessageList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Messages.json'.format(**self._solution) - - def create(self, to, status_callback=values.unset, application_sid=values.unset, - max_price=values.unset, provide_feedback=values.unset, - validity_period=values.unset, max_rate=values.unset, - force_delivery=values.unset, provider_sid=values.unset, - content_retention=values.unset, address_retention=values.unset, - smart_encoded=values.unset, from_=values.unset, - messaging_service_sid=values.unset, body=values.unset, - media_url=values.unset): - """ - Create a new MessageInstance - - :param unicode to: The phone number to receive the message - :param unicode status_callback: URL Twilio will request when the status changes - :param unicode application_sid: The application to use for callbacks - :param unicode max_price: The max_price - :param bool provide_feedback: The provide_feedback - :param unicode validity_period: The validity_period - :param unicode max_rate: The max_rate - :param bool force_delivery: The force_delivery - :param unicode provider_sid: The provider_sid - :param MessageInstance.ContentRetention content_retention: The content_retention - :param MessageInstance.AddressRetention address_retention: The address_retention - :param bool smart_encoded: The smart_encoded - :param unicode from_: The phone number that initiated the message - :param unicode messaging_service_sid: The messaging_service_sid - :param unicode body: The body - :param unicode media_url: The media_url - - :returns: Newly created MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance - """ - data = values.of({ - 'To': to, - 'From': from_, - 'MessagingServiceSid': messaging_service_sid, - 'Body': body, - 'MediaUrl': serialize.map(media_url, lambda e: e), - 'StatusCallback': status_callback, - 'ApplicationSid': application_sid, - 'MaxPrice': max_price, - 'ProvideFeedback': provide_feedback, - 'ValidityPeriod': validity_period, - 'MaxRate': max_rate, - 'ForceDelivery': force_delivery, - 'ProviderSid': provider_sid, - 'ContentRetention': content_retention, - 'AddressRetention': address_retention, - 'SmartEncoded': smart_encoded, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return MessageInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def stream(self, to=values.unset, from_=values.unset, - date_sent_before=values.unset, date_sent=values.unset, - date_sent_after=values.unset, limit=None, page_size=None): - """ - Streams MessageInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode to: Filter by messages to this number - :param unicode from_: Filter by from number - :param datetime date_sent_before: Filter by date sent - :param datetime date_sent: Filter by date sent - :param datetime date_sent_after: Filter by date sent - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.message.MessageInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - to=to, - from_=from_, - date_sent_before=date_sent_before, - date_sent=date_sent, - date_sent_after=date_sent_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, to=values.unset, from_=values.unset, - date_sent_before=values.unset, date_sent=values.unset, - date_sent_after=values.unset, limit=None, page_size=None): - """ - Lists MessageInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode to: Filter by messages to this number - :param unicode from_: Filter by from number - :param datetime date_sent_before: Filter by date sent - :param datetime date_sent: Filter by date sent - :param datetime date_sent_after: Filter by date sent - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.message.MessageInstance] - """ - return list(self.stream( - to=to, - from_=from_, - date_sent_before=date_sent_before, - date_sent=date_sent, - date_sent_after=date_sent_after, - limit=limit, - page_size=page_size, - )) - - def page(self, to=values.unset, from_=values.unset, - date_sent_before=values.unset, date_sent=values.unset, - date_sent_after=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MessageInstance records from the API. - Request is executed immediately - - :param unicode to: Filter by messages to this number - :param unicode from_: Filter by from number - :param datetime date_sent_before: Filter by date sent - :param datetime date_sent: Filter by date sent - :param datetime date_sent_after: Filter by date sent - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessagePage - """ - params = values.of({ - 'To': to, - 'From': from_, - 'DateSent<': serialize.iso8601_datetime(date_sent_before), - 'DateSent': serialize.iso8601_datetime(date_sent), - 'DateSent>': serialize.iso8601_datetime(date_sent_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MessagePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessageInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessagePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessagePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MessageContext - - :param sid: Fetch by unique message Sid - - :returns: twilio.rest.api.v2010.account.message.MessageContext - :rtype: twilio.rest.api.v2010.account.message.MessageContext - """ - return MessageContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a MessageContext - - :param sid: Fetch by unique message Sid - - :returns: twilio.rest.api.v2010.account.message.MessageContext - :rtype: twilio.rest.api.v2010.account.message.MessageContext - """ - return MessageContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MessageList>' - - -class MessagePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MessagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.message.MessagePage - :rtype: twilio.rest.api.v2010.account.message.MessagePage - """ - super(MessagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessageInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.message.MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance - """ - return MessageInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MessagePage>' - - -class MessageContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the MessageContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique message Sid - - :returns: twilio.rest.api.v2010.account.message.MessageContext - :rtype: twilio.rest.api.v2010.account.message.MessageContext - """ - super(MessageContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Messages/{sid}.json'.format(**self._solution) - - # Dependents - self._media = None - self._feedback = None - - def delete(self): - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a MessageInstance - - :returns: Fetched MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return MessageInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, body): - """ - Update the MessageInstance - - :param unicode body: The body - - :returns: Updated MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance - """ - data = values.of({'Body': body, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return MessageInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - @property - def media(self): - """ - Access the media - - :returns: twilio.rest.api.v2010.account.message.media.MediaList - :rtype: twilio.rest.api.v2010.account.message.media.MediaList - """ - if self._media is None: - self._media = MediaList( - self._version, - account_sid=self._solution['account_sid'], - message_sid=self._solution['sid'], - ) - return self._media - - @property - def feedback(self): - """ - Access the feedback - - :returns: twilio.rest.api.v2010.account.message.feedback.FeedbackList - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackList - """ - if self._feedback is None: - self._feedback = FeedbackList( - self._version, - account_sid=self._solution['account_sid'], - message_sid=self._solution['sid'], - ) - return self._feedback - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.MessageContext {}>'.format(context) - - -class MessageInstance(InstanceResource): - """ """ - - class Status(object): - QUEUED = "queued" - SENDING = "sending" - SENT = "sent" - FAILED = "failed" - DELIVERED = "delivered" - UNDELIVERED = "undelivered" - RECEIVING = "receiving" - RECEIVED = "received" - ACCEPTED = "accepted" - - class Direction(object): - INBOUND = "inbound" - OUTBOUND_API = "outbound-api" - OUTBOUND_CALL = "outbound-call" - OUTBOUND_REPLY = "outbound-reply" - - class ContentRetention(object): - RETAIN = "retain" - DISCARD = "discard" - - class AddressRetention(object): - RETAIN = "retain" - DISCARD = "discard" - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the MessageInstance - - :returns: twilio.rest.api.v2010.account.message.MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance - """ - super(MessageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'body': payload['body'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'date_sent': deserialize.rfc2822_datetime(payload['date_sent']), - 'direction': payload['direction'], - 'error_code': deserialize.integer(payload['error_code']), - 'error_message': payload['error_message'], - 'from_': payload['from'], - 'messaging_service_sid': payload['messaging_service_sid'], - 'num_media': payload['num_media'], - 'num_segments': payload['num_segments'], - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'sid': payload['sid'], - 'status': payload['status'], - 'subresource_uris': payload['subresource_uris'], - 'to': payload['to'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessageContext for this MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageContext - """ - if self._context is None: - self._context = MessageContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The version of the Twilio API used to process the message. - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def body(self): - """ - :returns: The text body of the message. Up to 1600 characters long. - :rtype: unicode - """ - return self._properties['body'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def date_sent(self): - """ - :returns: The date the message was sent - :rtype: datetime - """ - return self._properties['date_sent'] - - @property - def direction(self): - """ - :returns: The direction of the message - :rtype: MessageInstance.Direction - """ - return self._properties['direction'] - - @property - def error_code(self): - """ - :returns: The error code associated with the message - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def error_message(self): - """ - :returns: Human readable description of the ErrorCode - :rtype: unicode - """ - return self._properties['error_message'] - - @property - def from_(self): - """ - :returns: The phone number that initiated the message - :rtype: unicode - """ - return self._properties['from_'] - - @property - def messaging_service_sid(self): - """ - :returns: The messaging_service_sid - :rtype: unicode - """ - return self._properties['messaging_service_sid'] - - @property - def num_media(self): - """ - :returns: Number of media files associated with the message - :rtype: unicode - """ - return self._properties['num_media'] - - @property - def num_segments(self): - """ - :returns: Indicates number of messages used to delivery the body - :rtype: unicode - """ - return self._properties['num_segments'] - - @property - def price(self): - """ - :returns: The amount billed for the message - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which Price is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this message - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status of this message - :rtype: MessageInstance.Status - """ - return self._properties['status'] - - @property - def subresource_uris(self): - """ - :returns: The URI for any subresources - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def to(self): - """ - :returns: The phone number that received the message - :rtype: unicode - """ - return self._properties['to'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - def delete(self): - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a MessageInstance - - :returns: Fetched MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance - """ - return self._proxy.fetch() - - def update(self, body): - """ - Update the MessageInstance - - :param unicode body: The body - - :returns: Updated MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance - """ - return self._proxy.update(body, ) - - @property - def media(self): - """ - Access the media - - :returns: twilio.rest.api.v2010.account.message.media.MediaList - :rtype: twilio.rest.api.v2010.account.message.media.MediaList - """ - return self._proxy.media - - @property - def feedback(self): - """ - Access the feedback - - :returns: twilio.rest.api.v2010.account.message.feedback.FeedbackList - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackList - """ - return self._proxy.feedback - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.MessageInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/message/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/message/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 7f1bbfd..0000000 Binary files a/twilio/rest/api/v2010/account/message/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/message/__pycache__/feedback.cpython-36.pyc b/twilio/rest/api/v2010/account/message/__pycache__/feedback.cpython-36.pyc deleted file mode 100644 index 339cd72..0000000 Binary files a/twilio/rest/api/v2010/account/message/__pycache__/feedback.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/message/__pycache__/media.cpython-36.pyc b/twilio/rest/api/v2010/account/message/__pycache__/media.cpython-36.pyc deleted file mode 100644 index 5242868..0000000 Binary files a/twilio/rest/api/v2010/account/message/__pycache__/media.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/message/feedback.py b/twilio/rest/api/v2010/account/message/feedback.py deleted file mode 100644 index 73dbe49..0000000 --- a/twilio/rest/api/v2010/account/message/feedback.py +++ /dev/null @@ -1,201 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class FeedbackList(ListResource): - """ """ - - def __init__(self, version, account_sid, message_sid): - """ - Initialize the FeedbackList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param message_sid: The message_sid - - :returns: twilio.rest.api.v2010.account.message.feedback.FeedbackList - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackList - """ - super(FeedbackList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'message_sid': message_sid, } - self._uri = '/Accounts/{account_sid}/Messages/{message_sid}/Feedback.json'.format(**self._solution) - - def create(self, outcome=values.unset): - """ - Create a new FeedbackInstance - - :param FeedbackInstance.Outcome outcome: The outcome - - :returns: Newly created FeedbackInstance - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackInstance - """ - data = values.of({'Outcome': outcome, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.FeedbackList>' - - -class FeedbackPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the FeedbackPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param message_sid: The message_sid - - :returns: twilio.rest.api.v2010.account.message.feedback.FeedbackPage - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackPage - """ - super(FeedbackPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FeedbackInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.message.feedback.FeedbackInstance - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackInstance - """ - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.FeedbackPage>' - - -class FeedbackInstance(InstanceResource): - """ """ - - class Outcome(object): - CONFIRMED = "confirmed" - UMCONFIRMED = "umconfirmed" - - def __init__(self, version, payload, account_sid, message_sid): - """ - Initialize the FeedbackInstance - - :returns: twilio.rest.api.v2010.account.message.feedback.FeedbackInstance - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackInstance - """ - super(FeedbackInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'message_sid': payload['message_sid'], - 'outcome': payload['outcome'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'message_sid': message_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def message_sid(self): - """ - :returns: The message_sid - :rtype: unicode - """ - return self._properties['message_sid'] - - @property - def outcome(self): - """ - :returns: The outcome - :rtype: FeedbackInstance.Outcome - """ - return self._properties['outcome'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.FeedbackInstance>' diff --git a/twilio/rest/api/v2010/account/message/media.py b/twilio/rest/api/v2010/account/message/media.py deleted file mode 100644 index 60b6df5..0000000 --- a/twilio/rest/api/v2010/account/message/media.py +++ /dev/null @@ -1,432 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class MediaList(ListResource): - """ """ - - def __init__(self, version, account_sid, message_sid): - """ - Initialize the MediaList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - :param message_sid: A string that uniquely identifies this message - - :returns: twilio.rest.api.v2010.account.message.media.MediaList - :rtype: twilio.rest.api.v2010.account.message.media.MediaList - """ - super(MediaList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'message_sid': message_sid, } - self._uri = '/Accounts/{account_sid}/Messages/{message_sid}/Media.json'.format(**self._solution) - - def stream(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, limit=None, page_size=None): - """ - Streams MediaInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param datetime date_created_before: Filter by date created - :param datetime date_created: Filter by date created - :param datetime date_created_after: Filter by date created - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.message.media.MediaInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, limit=None, page_size=None): - """ - Lists MediaInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime date_created_before: Filter by date created - :param datetime date_created: Filter by date created - :param datetime date_created_after: Filter by date created - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.message.media.MediaInstance] - """ - return list(self.stream( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - limit=limit, - page_size=page_size, - )) - - def page(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MediaInstance records from the API. - Request is executed immediately - - :param datetime date_created_before: Filter by date created - :param datetime date_created: Filter by date created - :param datetime date_created_after: Filter by date created - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaPage - """ - params = values.of({ - 'DateCreated<': serialize.iso8601_datetime(date_created_before), - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateCreated>': serialize.iso8601_datetime(date_created_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MediaPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MediaInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MediaPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MediaContext - - :param sid: Fetch by unique media Sid - - :returns: twilio.rest.api.v2010.account.message.media.MediaContext - :rtype: twilio.rest.api.v2010.account.message.media.MediaContext - """ - return MediaContext( - self._version, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MediaContext - - :param sid: Fetch by unique media Sid - - :returns: twilio.rest.api.v2010.account.message.media.MediaContext - :rtype: twilio.rest.api.v2010.account.message.media.MediaContext - """ - return MediaContext( - self._version, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MediaList>' - - -class MediaPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MediaPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - :param message_sid: A string that uniquely identifies this message - - :returns: twilio.rest.api.v2010.account.message.media.MediaPage - :rtype: twilio.rest.api.v2010.account.message.media.MediaPage - """ - super(MediaPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MediaInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.message.media.MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaInstance - """ - return MediaInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MediaPage>' - - -class MediaContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, message_sid, sid): - """ - Initialize the MediaContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param message_sid: The message_sid - :param sid: Fetch by unique media Sid - - :returns: twilio.rest.api.v2010.account.message.media.MediaContext - :rtype: twilio.rest.api.v2010.account.message.media.MediaContext - """ - super(MediaContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'message_sid': message_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Messages/{message_sid}/Media/{sid}.json'.format(**self._solution) - - def delete(self): - """ - Deletes the MediaInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a MediaInstance - - :returns: Fetched MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return MediaInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.MediaContext {}>'.format(context) - - -class MediaInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, message_sid, sid=None): - """ - Initialize the MediaInstance - - :returns: twilio.rest.api.v2010.account.message.media.MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaInstance - """ - super(MediaInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'content_type': payload['content_type'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'parent_sid': payload['parent_sid'], - 'sid': payload['sid'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'message_sid': message_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MediaContext for this MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaContext - """ - if self._context is None: - self._context = MediaContext( - self._version, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def content_type(self): - """ - :returns: The default mime-type of the media - :rtype: unicode - """ - return self._properties['content_type'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def parent_sid(self): - """ - :returns: The unique id of the resource that created the media. - :rtype: unicode - """ - return self._properties['parent_sid'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this media - :rtype: unicode - """ - return self._properties['sid'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - def delete(self): - """ - Deletes the MediaInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a MediaInstance - - :returns: Fetched MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.MediaInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/new_key.py b/twilio/rest/api/v2010/account/new_key.py deleted file mode 100644 index f3271fd..0000000 --- a/twilio/rest/api/v2010/account/new_key.py +++ /dev/null @@ -1,176 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NewKeyList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the NewKeyList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.new_key.NewKeyList - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList - """ - super(NewKeyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Keys.json'.format(**self._solution) - - def create(self, friendly_name=values.unset): - """ - Create a new NewKeyInstance - - :param unicode friendly_name: The friendly_name - - :returns: Newly created NewKeyInstance - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return NewKeyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.NewKeyList>' - - -class NewKeyPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the NewKeyPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.new_key.NewKeyPage - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyPage - """ - super(NewKeyPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NewKeyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.new_key.NewKeyInstance - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyInstance - """ - return NewKeyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.NewKeyPage>' - - -class NewKeyInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid): - """ - Initialize the NewKeyInstance - - :returns: twilio.rest.api.v2010.account.new_key.NewKeyInstance - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyInstance - """ - super(NewKeyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'secret': payload['secret'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def secret(self): - """ - :returns: The secret - :rtype: unicode - """ - return self._properties['secret'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.NewKeyInstance>' diff --git a/twilio/rest/api/v2010/account/new_signing_key.py b/twilio/rest/api/v2010/account/new_signing_key.py deleted file mode 100644 index eec5e86..0000000 --- a/twilio/rest/api/v2010/account/new_signing_key.py +++ /dev/null @@ -1,176 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NewSigningKeyList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the NewSigningKeyList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - """ - super(NewSigningKeyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/SigningKeys.json'.format(**self._solution) - - def create(self, friendly_name=values.unset): - """ - Create a new NewSigningKeyInstance - - :param unicode friendly_name: The friendly_name - - :returns: Newly created NewSigningKeyInstance - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return NewSigningKeyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.NewSigningKeyList>' - - -class NewSigningKeyPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the NewSigningKeyPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyPage - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyPage - """ - super(NewSigningKeyPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NewSigningKeyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyInstance - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyInstance - """ - return NewSigningKeyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.NewSigningKeyPage>' - - -class NewSigningKeyInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid): - """ - Initialize the NewSigningKeyInstance - - :returns: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyInstance - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyInstance - """ - super(NewSigningKeyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'secret': payload['secret'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def secret(self): - """ - :returns: The secret - :rtype: unicode - """ - return self._properties['secret'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.NewSigningKeyInstance>' diff --git a/twilio/rest/api/v2010/account/notification.py b/twilio/rest/api/v2010/account/notification.py deleted file mode 100644 index 5c81aba..0000000 --- a/twilio/rest/api/v2010/account/notification.py +++ /dev/null @@ -1,507 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class NotificationList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the NotificationList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.notification.NotificationList - :rtype: twilio.rest.api.v2010.account.notification.NotificationList - """ - super(NotificationList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Notifications.json'.format(**self._solution) - - def stream(self, log=values.unset, message_date_before=values.unset, - message_date=values.unset, message_date_after=values.unset, - limit=None, page_size=None): - """ - Streams NotificationInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode log: Filter by log level - :param date message_date_before: Filter by date - :param date message_date: Filter by date - :param date message_date_after: Filter by date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.notification.NotificationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - log=log, - message_date_before=message_date_before, - message_date=message_date, - message_date_after=message_date_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, log=values.unset, message_date_before=values.unset, - message_date=values.unset, message_date_after=values.unset, limit=None, - page_size=None): - """ - Lists NotificationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode log: Filter by log level - :param date message_date_before: Filter by date - :param date message_date: Filter by date - :param date message_date_after: Filter by date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.notification.NotificationInstance] - """ - return list(self.stream( - log=log, - message_date_before=message_date_before, - message_date=message_date, - message_date_after=message_date_after, - limit=limit, - page_size=page_size, - )) - - def page(self, log=values.unset, message_date_before=values.unset, - message_date=values.unset, message_date_after=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of NotificationInstance records from the API. - Request is executed immediately - - :param unicode log: Filter by log level - :param date message_date_before: Filter by date - :param date message_date: Filter by date - :param date message_date_after: Filter by date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationPage - """ - params = values.of({ - 'Log': log, - 'MessageDate<': serialize.iso8601_date(message_date_before), - 'MessageDate': serialize.iso8601_date(message_date), - 'MessageDate>': serialize.iso8601_date(message_date_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return NotificationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of NotificationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return NotificationPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a NotificationContext - - :param sid: Fetch by unique notification Sid - - :returns: twilio.rest.api.v2010.account.notification.NotificationContext - :rtype: twilio.rest.api.v2010.account.notification.NotificationContext - """ - return NotificationContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a NotificationContext - - :param sid: Fetch by unique notification Sid - - :returns: twilio.rest.api.v2010.account.notification.NotificationContext - :rtype: twilio.rest.api.v2010.account.notification.NotificationContext - """ - return NotificationContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.NotificationList>' - - -class NotificationPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the NotificationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.notification.NotificationPage - :rtype: twilio.rest.api.v2010.account.notification.NotificationPage - """ - super(NotificationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NotificationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.notification.NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationInstance - """ - return NotificationInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.NotificationPage>' - - -class NotificationContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the NotificationContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique notification Sid - - :returns: twilio.rest.api.v2010.account.notification.NotificationContext - :rtype: twilio.rest.api.v2010.account.notification.NotificationContext - """ - super(NotificationContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Notifications/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a NotificationInstance - - :returns: Fetched NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return NotificationInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the NotificationInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.NotificationContext {}>'.format(context) - - -class NotificationInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the NotificationInstance - - :returns: twilio.rest.api.v2010.account.notification.NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationInstance - """ - super(NotificationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'call_sid': payload['call_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'error_code': payload['error_code'], - 'log': payload['log'], - 'message_date': deserialize.rfc2822_datetime(payload['message_date']), - 'message_text': payload['message_text'], - 'more_info': payload['more_info'], - 'request_method': payload['request_method'], - 'request_url': payload['request_url'], - 'sid': payload['sid'], - 'uri': payload['uri'], - 'request_variables': payload.get('request_variables'), - 'response_body': payload.get('response_body'), - 'response_headers': payload.get('response_headers'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: NotificationContext for this NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationContext - """ - if self._context is None: - self._context = NotificationContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The version of the Twilio API in use - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def call_sid(self): - """ - :returns: The string that uniquely identifies the call - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def error_code(self): - """ - :returns: A unique error code corresponding to the notification - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def log(self): - """ - :returns: An integer log level - :rtype: unicode - """ - return self._properties['log'] - - @property - def message_date(self): - """ - :returns: The date the notification was generated - :rtype: datetime - """ - return self._properties['message_date'] - - @property - def message_text(self): - """ - :returns: The text of the notification. - :rtype: unicode - """ - return self._properties['message_text'] - - @property - def more_info(self): - """ - :returns: A URL for more information about the error code - :rtype: unicode - """ - return self._properties['more_info'] - - @property - def request_method(self): - """ - :returns: HTTP method used with the request url - :rtype: unicode - """ - return self._properties['request_method'] - - @property - def request_url(self): - """ - :returns: URL of the resource that generated the notification - :rtype: unicode - """ - return self._properties['request_url'] - - @property - def request_variables(self): - """ - :returns: Twilio-generated HTTP variables sent to the server - :rtype: unicode - """ - return self._properties['request_variables'] - - @property - def response_body(self): - """ - :returns: The HTTP body returned by your server. - :rtype: unicode - """ - return self._properties['response_body'] - - @property - def response_headers(self): - """ - :returns: The HTTP headers returned by your server. - :rtype: unicode - """ - return self._properties['response_headers'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this notification - :rtype: unicode - """ - return self._properties['sid'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a NotificationInstance - - :returns: Fetched NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the NotificationInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.NotificationInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/outgoing_caller_id.py b/twilio/rest/api/v2010/account/outgoing_caller_id.py deleted file mode 100644 index 5a0aeb0..0000000 --- a/twilio/rest/api/v2010/account/outgoing_caller_id.py +++ /dev/null @@ -1,436 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class OutgoingCallerIdList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the OutgoingCallerIdList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - """ - super(OutgoingCallerIdList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/OutgoingCallerIds.json'.format(**self._solution) - - def stream(self, phone_number=values.unset, friendly_name=values.unset, - limit=None, page_size=None): - """ - Streams OutgoingCallerIdInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode phone_number: Filter by phone number - :param unicode friendly_name: Filter by friendly name - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - phone_number=phone_number, - friendly_name=friendly_name, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, phone_number=values.unset, friendly_name=values.unset, - limit=None, page_size=None): - """ - Lists OutgoingCallerIdInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode phone_number: Filter by phone number - :param unicode friendly_name: Filter by friendly name - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance] - """ - return list(self.stream( - phone_number=phone_number, - friendly_name=friendly_name, - limit=limit, - page_size=page_size, - )) - - def page(self, phone_number=values.unset, friendly_name=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of OutgoingCallerIdInstance records from the API. - Request is executed immediately - - :param unicode phone_number: Filter by phone number - :param unicode friendly_name: Filter by friendly name - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdPage - """ - params = values.of({ - 'PhoneNumber': phone_number, - 'FriendlyName': friendly_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return OutgoingCallerIdPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of OutgoingCallerIdInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return OutgoingCallerIdPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a OutgoingCallerIdContext - - :param sid: Fetch by unique outgoing-caller-id Sid - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - """ - return OutgoingCallerIdContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a OutgoingCallerIdContext - - :param sid: Fetch by unique outgoing-caller-id Sid - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - """ - return OutgoingCallerIdContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.OutgoingCallerIdList>' - - -class OutgoingCallerIdPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the OutgoingCallerIdPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdPage - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdPage - """ - super(OutgoingCallerIdPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of OutgoingCallerIdInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - """ - return OutgoingCallerIdInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.OutgoingCallerIdPage>' - - -class OutgoingCallerIdContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the OutgoingCallerIdContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique outgoing-caller-id Sid - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - """ - super(OutgoingCallerIdContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/OutgoingCallerIds/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a OutgoingCallerIdInstance - - :returns: Fetched OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return OutgoingCallerIdInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset): - """ - Update the OutgoingCallerIdInstance - - :param unicode friendly_name: A human readable description of the caller ID - - :returns: Updated OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return OutgoingCallerIdInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the OutgoingCallerIdInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.OutgoingCallerIdContext {}>'.format(context) - - -class OutgoingCallerIdInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the OutgoingCallerIdInstance - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - """ - super(OutgoingCallerIdInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'account_sid': payload['account_sid'], - 'phone_number': payload['phone_number'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: OutgoingCallerIdContext for this OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - """ - if self._context is None: - self._context = OutgoingCallerIdContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this outgoing-caller-ids - :rtype: unicode - """ - return self._properties['sid'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: A human readable description for this resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def phone_number(self): - """ - :returns: The incoming phone number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a OutgoingCallerIdInstance - - :returns: Fetched OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset): - """ - Update the OutgoingCallerIdInstance - - :param unicode friendly_name: A human readable description of the caller ID - - :returns: Updated OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) - - def delete(self): - """ - Deletes the OutgoingCallerIdInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.OutgoingCallerIdInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/queue/__init__.py b/twilio/rest/api/v2010/account/queue/__init__.py deleted file mode 100644 index 3975a91..0000000 --- a/twilio/rest/api/v2010/account/queue/__init__.py +++ /dev/null @@ -1,482 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.queue.member import MemberList - - -class QueueList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the QueueList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - - :returns: twilio.rest.api.v2010.account.queue.QueueList - :rtype: twilio.rest.api.v2010.account.queue.QueueList - """ - super(QueueList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Queues.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams QueueInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.queue.QueueInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists QueueInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.queue.QueueInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of QueueInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueuePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return QueuePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of QueueInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueuePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return QueuePage(self._version, response, self._solution) - - def create(self, friendly_name, max_size=values.unset): - """ - Create a new QueueInstance - - :param unicode friendly_name: A user-provided string that identifies this queue. - :param unicode max_size: The max number of calls allowed in the queue - - :returns: Newly created QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance - """ - data = values.of({'FriendlyName': friendly_name, 'MaxSize': max_size, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return QueueInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def get(self, sid): - """ - Constructs a QueueContext - - :param sid: Fetch by unique queue Sid - - :returns: twilio.rest.api.v2010.account.queue.QueueContext - :rtype: twilio.rest.api.v2010.account.queue.QueueContext - """ - return QueueContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a QueueContext - - :param sid: Fetch by unique queue Sid - - :returns: twilio.rest.api.v2010.account.queue.QueueContext - :rtype: twilio.rest.api.v2010.account.queue.QueueContext - """ - return QueueContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.QueueList>' - - -class QueuePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the QueuePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - - :returns: twilio.rest.api.v2010.account.queue.QueuePage - :rtype: twilio.rest.api.v2010.account.queue.QueuePage - """ - super(QueuePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of QueueInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.queue.QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance - """ - return QueueInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.QueuePage>' - - -class QueueContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the QueueContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique queue Sid - - :returns: twilio.rest.api.v2010.account.queue.QueueContext - :rtype: twilio.rest.api.v2010.account.queue.QueueContext - """ - super(QueueContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Queues/{sid}.json'.format(**self._solution) - - # Dependents - self._members = None - - def fetch(self): - """ - Fetch a QueueInstance - - :returns: Fetched QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return QueueInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, max_size=values.unset): - """ - Update the QueueInstance - - :param unicode friendly_name: A human readable description of the queue - :param unicode max_size: The max number of members allowed in the queue - - :returns: Updated QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance - """ - data = values.of({'FriendlyName': friendly_name, 'MaxSize': max_size, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return QueueInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the QueueInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def members(self): - """ - Access the members - - :returns: twilio.rest.api.v2010.account.queue.member.MemberList - :rtype: twilio.rest.api.v2010.account.queue.member.MemberList - """ - if self._members is None: - self._members = MemberList( - self._version, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['sid'], - ) - return self._members - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.QueueContext {}>'.format(context) - - -class QueueInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the QueueInstance - - :returns: twilio.rest.api.v2010.account.queue.QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance - """ - super(QueueInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'average_wait_time': deserialize.integer(payload['average_wait_time']), - 'current_size': deserialize.integer(payload['current_size']), - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'max_size': deserialize.integer(payload['max_size']), - 'sid': payload['sid'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: QueueContext for this QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueContext - """ - if self._context is None: - self._context = QueueContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def average_wait_time(self): - """ - :returns: Average wait time of members in the queue - :rtype: unicode - """ - return self._properties['average_wait_time'] - - @property - def current_size(self): - """ - :returns: The count of calls currently in the queue. - :rtype: unicode - """ - return self._properties['current_size'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: A user-provided string that identifies this queue. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def max_size(self): - """ - :returns: The max number of calls allowed in the queue - :rtype: unicode - """ - return self._properties['max_size'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this queue - :rtype: unicode - """ - return self._properties['sid'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a QueueInstance - - :returns: Fetched QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, max_size=values.unset): - """ - Update the QueueInstance - - :param unicode friendly_name: A human readable description of the queue - :param unicode max_size: The max number of members allowed in the queue - - :returns: Updated QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance - """ - return self._proxy.update(friendly_name=friendly_name, max_size=max_size, ) - - def delete(self): - """ - Deletes the QueueInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def members(self): - """ - Access the members - - :returns: twilio.rest.api.v2010.account.queue.member.MemberList - :rtype: twilio.rest.api.v2010.account.queue.member.MemberList - """ - return self._proxy.members - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.QueueInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/queue/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/queue/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 35410c0..0000000 Binary files a/twilio/rest/api/v2010/account/queue/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/queue/__pycache__/member.cpython-36.pyc b/twilio/rest/api/v2010/account/queue/__pycache__/member.cpython-36.pyc deleted file mode 100644 index 5dbbc91..0000000 Binary files a/twilio/rest/api/v2010/account/queue/__pycache__/member.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/queue/member.py b/twilio/rest/api/v2010/account/queue/member.py deleted file mode 100644 index e5dec61..0000000 --- a/twilio/rest/api/v2010/account/queue/member.py +++ /dev/null @@ -1,403 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class MemberList(ListResource): - """ """ - - def __init__(self, version, account_sid, queue_sid): - """ - Initialize the MemberList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param queue_sid: A string that uniquely identifies this queue - - :returns: twilio.rest.api.v2010.account.queue.member.MemberList - :rtype: twilio.rest.api.v2010.account.queue.member.MemberList - """ - super(MemberList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'queue_sid': queue_sid, } - self._uri = '/Accounts/{account_sid}/Queues/{queue_sid}/Members.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams MemberInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.queue.member.MemberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists MemberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.queue.member.MemberInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of MemberInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MemberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MemberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MemberPage(self._version, response, self._solution) - - def get(self, call_sid): - """ - Constructs a MemberContext - - :param call_sid: The call_sid - - :returns: twilio.rest.api.v2010.account.queue.member.MemberContext - :rtype: twilio.rest.api.v2010.account.queue.member.MemberContext - """ - return MemberContext( - self._version, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['queue_sid'], - call_sid=call_sid, - ) - - def __call__(self, call_sid): - """ - Constructs a MemberContext - - :param call_sid: The call_sid - - :returns: twilio.rest.api.v2010.account.queue.member.MemberContext - :rtype: twilio.rest.api.v2010.account.queue.member.MemberContext - """ - return MemberContext( - self._version, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['queue_sid'], - call_sid=call_sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MemberList>' - - -class MemberPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MemberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param queue_sid: A string that uniquely identifies this queue - - :returns: twilio.rest.api.v2010.account.queue.member.MemberPage - :rtype: twilio.rest.api.v2010.account.queue.member.MemberPage - """ - super(MemberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MemberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.queue.member.MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberInstance - """ - return MemberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MemberPage>' - - -class MemberContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, queue_sid, call_sid): - """ - Initialize the MemberContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param queue_sid: The Queue in which to find the members - :param call_sid: The call_sid - - :returns: twilio.rest.api.v2010.account.queue.member.MemberContext - :rtype: twilio.rest.api.v2010.account.queue.member.MemberContext - """ - super(MemberContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'queue_sid': queue_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Queues/{queue_sid}/Members/{call_sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a MemberInstance - - :returns: Fetched MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return MemberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['queue_sid'], - call_sid=self._solution['call_sid'], - ) - - def update(self, url, method): - """ - Update the MemberInstance - - :param unicode url: The url - :param unicode method: The method - - :returns: Updated MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberInstance - """ - data = values.of({'Url': url, 'Method': method, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return MemberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['queue_sid'], - call_sid=self._solution['call_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.MemberContext {}>'.format(context) - - -class MemberInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, queue_sid, call_sid=None): - """ - Initialize the MemberInstance - - :returns: twilio.rest.api.v2010.account.queue.member.MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberInstance - """ - super(MemberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'call_sid': payload['call_sid'], - 'date_enqueued': deserialize.rfc2822_datetime(payload['date_enqueued']), - 'position': deserialize.integer(payload['position']), - 'uri': payload['uri'], - 'wait_time': deserialize.integer(payload['wait_time']), - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'queue_sid': queue_sid, - 'call_sid': call_sid or self._properties['call_sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MemberContext for this MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberContext - """ - if self._context is None: - self._context = MemberContext( - self._version, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['queue_sid'], - call_sid=self._solution['call_sid'], - ) - return self._context - - @property - def call_sid(self): - """ - :returns: Unique string that identifies this resource - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def date_enqueued(self): - """ - :returns: The date the member was enqueued - :rtype: datetime - """ - return self._properties['date_enqueued'] - - @property - def position(self): - """ - :returns: This member's current position in the queue. - :rtype: unicode - """ - return self._properties['position'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def wait_time(self): - """ - :returns: The number of seconds the member has been in the queue. - :rtype: unicode - """ - return self._properties['wait_time'] - - def fetch(self): - """ - Fetch a MemberInstance - - :returns: Fetched MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberInstance - """ - return self._proxy.fetch() - - def update(self, url, method): - """ - Update the MemberInstance - - :param unicode url: The url - :param unicode method: The method - - :returns: Updated MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberInstance - """ - return self._proxy.update(url, method, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.MemberInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/recording/__init__.py b/twilio/rest/api/v2010/account/recording/__init__.py deleted file mode 100644 index 2beccee..0000000 --- a/twilio/rest/api/v2010/account/recording/__init__.py +++ /dev/null @@ -1,588 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.recording.add_on_result import AddOnResultList -from twilio.rest.api.v2010.account.recording.transcription import TranscriptionList - - -class RecordingList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the RecordingList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.recording.RecordingList - """ - super(RecordingList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Recordings.json'.format(**self._solution) - - def stream(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, call_sid=values.unset, - conference_sid=values.unset, limit=None, page_size=None): - """ - Streams RecordingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param datetime date_created_before: Filter by date created - :param datetime date_created: Filter by date created - :param datetime date_created_after: Filter by date created - :param unicode call_sid: Filter by call_sid - :param unicode conference_sid: The conference_sid - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.recording.RecordingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - call_sid=call_sid, - conference_sid=conference_sid, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, call_sid=values.unset, - conference_sid=values.unset, limit=None, page_size=None): - """ - Lists RecordingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime date_created_before: Filter by date created - :param datetime date_created: Filter by date created - :param datetime date_created_after: Filter by date created - :param unicode call_sid: Filter by call_sid - :param unicode conference_sid: The conference_sid - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.recording.RecordingInstance] - """ - return list(self.stream( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - call_sid=call_sid, - conference_sid=conference_sid, - limit=limit, - page_size=page_size, - )) - - def page(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, call_sid=values.unset, - conference_sid=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of RecordingInstance records from the API. - Request is executed immediately - - :param datetime date_created_before: Filter by date created - :param datetime date_created: Filter by date created - :param datetime date_created_after: Filter by date created - :param unicode call_sid: Filter by call_sid - :param unicode conference_sid: The conference_sid - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingPage - """ - params = values.of({ - 'DateCreated<': serialize.iso8601_datetime(date_created_before), - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateCreated>': serialize.iso8601_datetime(date_created_after), - 'CallSid': call_sid, - 'ConferenceSid': conference_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return RecordingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RecordingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RecordingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RecordingContext - - :param sid: Fetch by unique recording Sid - - :returns: twilio.rest.api.v2010.account.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.recording.RecordingContext - """ - return RecordingContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RecordingContext - - :param sid: Fetch by unique recording Sid - - :returns: twilio.rest.api.v2010.account.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.recording.RecordingContext - """ - return RecordingContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.RecordingList>' - - -class RecordingPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the RecordingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.recording.RecordingPage - :rtype: twilio.rest.api.v2010.account.recording.RecordingPage - """ - super(RecordingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RecordingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.recording.RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingInstance - """ - return RecordingInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.RecordingPage>' - - -class RecordingContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the RecordingContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique recording Sid - - :returns: twilio.rest.api.v2010.account.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.recording.RecordingContext - """ - super(RecordingContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Recordings/{sid}.json'.format(**self._solution) - - # Dependents - self._transcriptions = None - self._add_on_results = None - - def fetch(self): - """ - Fetch a RecordingInstance - - :returns: Fetched RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return RecordingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the RecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def transcriptions(self): - """ - Access the transcriptions - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionList - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionList - """ - if self._transcriptions is None: - self._transcriptions = TranscriptionList( - self._version, - account_sid=self._solution['account_sid'], - recording_sid=self._solution['sid'], - ) - return self._transcriptions - - @property - def add_on_results(self): - """ - Access the add_on_results - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList - """ - if self._add_on_results is None: - self._add_on_results = AddOnResultList( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['sid'], - ) - return self._add_on_results - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.RecordingContext {}>'.format(context) - - -class RecordingInstance(InstanceResource): - """ """ - - class Status(object): - IN_PROGRESS = "in-progress" - PAUSED = "paused" - STOPPED = "stopped" - PROCESSING = "processing" - COMPLETED = "completed" - FAILED = "failed" - - class Source(object): - DIALVERB = "DialVerb" - CONFERENCE = "Conference" - OUTBOUNDAPI = "OutboundAPI" - TRUNKING = "Trunking" - RECORDVERB = "RecordVerb" - STARTCALLRECORDINGAPI = "StartCallRecordingAPI" - STARTCONFERENCERECORDINGAPI = "StartConferenceRecordingAPI" - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the RecordingInstance - - :returns: twilio.rest.api.v2010.account.recording.RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingInstance - """ - super(RecordingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'call_sid': payload['call_sid'], - 'conference_sid': payload['conference_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'duration': payload['duration'], - 'sid': payload['sid'], - 'price': payload['price'], - 'price_unit': payload['price_unit'], - 'status': payload['status'], - 'channels': deserialize.integer(payload['channels']), - 'source': payload['source'], - 'error_code': deserialize.integer(payload['error_code']), - 'uri': payload['uri'], - 'encryption_details': payload['encryption_details'], - 'subresource_uris': payload['subresource_uris'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RecordingContext for this RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingContext - """ - if self._context is None: - self._context = RecordingContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The version of the API in use during the recording. - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def call_sid(self): - """ - :returns: The unique id for the call leg that corresponds to the recording. - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def conference_sid(self): - """ - :returns: The unique id for the conference associated with the recording, if a conference recording. - :rtype: unicode - """ - return self._properties['conference_sid'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def duration(self): - """ - :returns: The length of the recording, in seconds. - :rtype: unicode - """ - return self._properties['duration'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this recording - :rtype: unicode - """ - return self._properties['sid'] - - @property - def price(self): - """ - :returns: The one-time cost of creating this recording. - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency used in the Price property. - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def status(self): - """ - :returns: The status of the recording. - :rtype: RecordingInstance.Status - """ - return self._properties['status'] - - @property - def channels(self): - """ - :returns: The number of channels in the final recording file as an integer. - :rtype: unicode - """ - return self._properties['channels'] - - @property - def source(self): - """ - :returns: The way in which this recording was created. - :rtype: RecordingInstance.Source - """ - return self._properties['source'] - - @property - def error_code(self): - """ - :returns: More information about the recording failure, if Status is failed. - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - @property - def encryption_details(self): - """ - :returns: The encryption_details - :rtype: dict - """ - return self._properties['encryption_details'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - def fetch(self): - """ - Fetch a RecordingInstance - - :returns: Fetched RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the RecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def transcriptions(self): - """ - Access the transcriptions - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionList - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionList - """ - return self._proxy.transcriptions - - @property - def add_on_results(self): - """ - Access the add_on_results - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList - """ - return self._proxy.add_on_results - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.RecordingInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/recording/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/recording/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 3886dba..0000000 Binary files a/twilio/rest/api/v2010/account/recording/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/recording/__pycache__/transcription.cpython-36.pyc b/twilio/rest/api/v2010/account/recording/__pycache__/transcription.cpython-36.pyc deleted file mode 100644 index e658b34..0000000 Binary files a/twilio/rest/api/v2010/account/recording/__pycache__/transcription.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py b/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py deleted file mode 100644 index 1fe05aa..0000000 --- a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py +++ /dev/null @@ -1,469 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.recording.add_on_result.payload import PayloadList - - -class AddOnResultList(ListResource): - """ """ - - def __init__(self, version, account_sid, reference_sid): - """ - Initialize the AddOnResultList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - :param reference_sid: A string that uniquely identifies the recording. - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList - """ - super(AddOnResultList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'reference_sid': reference_sid, } - self._uri = '/Accounts/{account_sid}/Recordings/{reference_sid}/AddOnResults.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AddOnResultInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AddOnResultInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AddOnResultInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AddOnResultPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AddOnResultInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AddOnResultPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AddOnResultContext - - :param sid: Fetch by unique result Sid - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - """ - return AddOnResultContext( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a AddOnResultContext - - :param sid: Fetch by unique result Sid - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - """ - return AddOnResultContext( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AddOnResultList>' - - -class AddOnResultPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the AddOnResultPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - :param reference_sid: A string that uniquely identifies the recording. - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultPage - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultPage - """ - super(AddOnResultPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AddOnResultInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance - """ - return AddOnResultInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AddOnResultPage>' - - -class AddOnResultContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, reference_sid, sid): - """ - Initialize the AddOnResultContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param reference_sid: The reference_sid - :param sid: Fetch by unique result Sid - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - """ - super(AddOnResultContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'reference_sid': reference_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Recordings/{reference_sid}/AddOnResults/{sid}.json'.format(**self._solution) - - # Dependents - self._payloads = None - - def fetch(self): - """ - Fetch a AddOnResultInstance - - :returns: Fetched AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return AddOnResultInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the AddOnResultInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def payloads(self): - """ - Access the payloads - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList - """ - if self._payloads is None: - self._payloads = PayloadList( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - add_on_result_sid=self._solution['sid'], - ) - return self._payloads - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AddOnResultContext {}>'.format(context) - - -class AddOnResultInstance(InstanceResource): - """ """ - - class Status(object): - CANCELED = "canceled" - COMPLETED = "completed" - DELETED = "deleted" - FAILED = "failed" - IN_PROGRESS = "in-progress" - INIT = "init" - PROCESSING = "processing" - QUEUED = "queued" - - def __init__(self, version, payload, account_sid, reference_sid, sid=None): - """ - Initialize the AddOnResultInstance - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance - """ - super(AddOnResultInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'status': payload['status'], - 'add_on_sid': payload['add_on_sid'], - 'add_on_configuration_sid': payload['add_on_configuration_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'date_completed': deserialize.rfc2822_datetime(payload['date_completed']), - 'reference_sid': payload['reference_sid'], - 'subresource_uris': payload['subresource_uris'], - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'reference_sid': reference_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AddOnResultContext for this AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - """ - if self._context is None: - self._context = AddOnResultContext( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this result - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def status(self): - """ - :returns: The status of this result. - :rtype: AddOnResultInstance.Status - """ - return self._properties['status'] - - @property - def add_on_sid(self): - """ - :returns: A string that uniquely identifies the Add-on. - :rtype: unicode - """ - return self._properties['add_on_sid'] - - @property - def add_on_configuration_sid(self): - """ - :returns: A string that uniquely identifies the Add-on configuration. - :rtype: unicode - """ - return self._properties['add_on_configuration_sid'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def date_completed(self): - """ - :returns: The date this result was completed. - :rtype: datetime - """ - return self._properties['date_completed'] - - @property - def reference_sid(self): - """ - :returns: A string that uniquely identifies the recording. - :rtype: unicode - """ - return self._properties['reference_sid'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - def fetch(self): - """ - Fetch a AddOnResultInstance - - :returns: Fetched AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the AddOnResultInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def payloads(self): - """ - Access the payloads - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList - """ - return self._proxy.payloads - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.AddOnResultInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/recording/add_on_result/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index bd93c1b..0000000 Binary files a/twilio/rest/api/v2010/account/recording/add_on_result/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py b/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py deleted file mode 100644 index 92dd4bf..0000000 --- a/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py +++ /dev/null @@ -1,456 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class PayloadList(ListResource): - """ """ - - def __init__(self, version, account_sid, reference_sid, add_on_result_sid): - """ - Initialize the PayloadList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - :param reference_sid: A string that uniquely identifies the recording. - :param add_on_result_sid: A string that uniquely identifies the result - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList - """ - super(PayloadList, self).__init__(version) - - # Path Solution - self._solution = { - 'account_sid': account_sid, - 'reference_sid': reference_sid, - 'add_on_result_sid': add_on_result_sid, - } - self._uri = '/Accounts/{account_sid}/Recordings/{reference_sid}/AddOnResults/{add_on_result_sid}/Payloads.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams PayloadInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PayloadInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PayloadInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return PayloadPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PayloadInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PayloadPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a PayloadContext - - :param sid: Fetch by unique payload Sid - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - """ - return PayloadContext( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - add_on_result_sid=self._solution['add_on_result_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a PayloadContext - - :param sid: Fetch by unique payload Sid - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - """ - return PayloadContext( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - add_on_result_sid=self._solution['add_on_result_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.PayloadList>' - - -class PayloadPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the PayloadPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - :param reference_sid: A string that uniquely identifies the recording. - :param add_on_result_sid: A string that uniquely identifies the result - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadPage - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadPage - """ - super(PayloadPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PayloadInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance - """ - return PayloadInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - add_on_result_sid=self._solution['add_on_result_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.PayloadPage>' - - -class PayloadContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, reference_sid, add_on_result_sid, sid): - """ - Initialize the PayloadContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param reference_sid: The reference_sid - :param add_on_result_sid: The add_on_result_sid - :param sid: Fetch by unique payload Sid - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - """ - super(PayloadContext, self).__init__(version) - - # Path Solution - self._solution = { - 'account_sid': account_sid, - 'reference_sid': reference_sid, - 'add_on_result_sid': add_on_result_sid, - 'sid': sid, - } - self._uri = '/Accounts/{account_sid}/Recordings/{reference_sid}/AddOnResults/{add_on_result_sid}/Payloads/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a PayloadInstance - - :returns: Fetched PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return PayloadInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - add_on_result_sid=self._solution['add_on_result_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the PayloadInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.PayloadContext {}>'.format(context) - - -class PayloadInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, reference_sid, - add_on_result_sid, sid=None): - """ - Initialize the PayloadInstance - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance - """ - super(PayloadInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'add_on_result_sid': payload['add_on_result_sid'], - 'account_sid': payload['account_sid'], - 'label': payload['label'], - 'add_on_sid': payload['add_on_sid'], - 'add_on_configuration_sid': payload['add_on_configuration_sid'], - 'content_type': payload['content_type'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'reference_sid': payload['reference_sid'], - 'subresource_uris': payload['subresource_uris'], - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'reference_sid': reference_sid, - 'add_on_result_sid': add_on_result_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PayloadContext for this PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - """ - if self._context is None: - self._context = PayloadContext( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - add_on_result_sid=self._solution['add_on_result_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this payload - :rtype: unicode - """ - return self._properties['sid'] - - @property - def add_on_result_sid(self): - """ - :returns: A string that uniquely identifies the result - :rtype: unicode - """ - return self._properties['add_on_result_sid'] - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def label(self): - """ - :returns: A string that describes the payload. - :rtype: unicode - """ - return self._properties['label'] - - @property - def add_on_sid(self): - """ - :returns: A string that uniquely identifies the Add-on. - :rtype: unicode - """ - return self._properties['add_on_sid'] - - @property - def add_on_configuration_sid(self): - """ - :returns: A string that uniquely identifies the Add-on configuration. - :rtype: unicode - """ - return self._properties['add_on_configuration_sid'] - - @property - def content_type(self): - """ - :returns: The MIME type of the payload. - :rtype: unicode - """ - return self._properties['content_type'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def reference_sid(self): - """ - :returns: A string that uniquely identifies the recording. - :rtype: unicode - """ - return self._properties['reference_sid'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - def fetch(self): - """ - Fetch a PayloadInstance - - :returns: Fetched PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the PayloadInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.PayloadInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/payload/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/recording/add_on_result/payload/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 10befae..0000000 Binary files a/twilio/rest/api/v2010/account/recording/add_on_result/payload/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/recording/transcription.py b/twilio/rest/api/v2010/account/recording/transcription.py deleted file mode 100644 index 8fc27dd..0000000 --- a/twilio/rest/api/v2010/account/recording/transcription.py +++ /dev/null @@ -1,460 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class TranscriptionList(ListResource): - """ """ - - def __init__(self, version, account_sid, recording_sid): - """ - Initialize the TranscriptionList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param recording_sid: The recording_sid - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionList - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionList - """ - super(TranscriptionList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'recording_sid': recording_sid, } - self._uri = '/Accounts/{account_sid}/Recordings/{recording_sid}/Transcriptions.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams TranscriptionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists TranscriptionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TranscriptionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return TranscriptionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TranscriptionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TranscriptionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a TranscriptionContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - """ - return TranscriptionContext( - self._version, - account_sid=self._solution['account_sid'], - recording_sid=self._solution['recording_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a TranscriptionContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - """ - return TranscriptionContext( - self._version, - account_sid=self._solution['account_sid'], - recording_sid=self._solution['recording_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TranscriptionList>' - - -class TranscriptionPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TranscriptionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param recording_sid: The recording_sid - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionPage - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionPage - """ - super(TranscriptionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TranscriptionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance - """ - return TranscriptionInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - recording_sid=self._solution['recording_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TranscriptionPage>' - - -class TranscriptionContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, recording_sid, sid): - """ - Initialize the TranscriptionContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param recording_sid: The recording_sid - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - """ - super(TranscriptionContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'recording_sid': recording_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Recordings/{recording_sid}/Transcriptions/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a TranscriptionInstance - - :returns: Fetched TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return TranscriptionInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - recording_sid=self._solution['recording_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the TranscriptionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.TranscriptionContext {}>'.format(context) - - -class TranscriptionInstance(InstanceResource): - """ """ - - class Status(object): - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - FAILED = "failed" - - def __init__(self, version, payload, account_sid, recording_sid, sid=None): - """ - Initialize the TranscriptionInstance - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance - """ - super(TranscriptionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'duration': payload['duration'], - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'recording_sid': payload['recording_sid'], - 'sid': payload['sid'], - 'status': payload['status'], - 'transcription_text': payload['transcription_text'], - 'type': payload['type'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'recording_sid': recording_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TranscriptionContext for this TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - """ - if self._context is None: - self._context = TranscriptionContext( - self._version, - account_sid=self._solution['account_sid'], - recording_sid=self._solution['recording_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def duration(self): - """ - :returns: The duration - :rtype: unicode - """ - return self._properties['duration'] - - @property - def price(self): - """ - :returns: The price - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def recording_sid(self): - """ - :returns: The recording_sid - :rtype: unicode - """ - return self._properties['recording_sid'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: TranscriptionInstance.Status - """ - return self._properties['status'] - - @property - def transcription_text(self): - """ - :returns: The transcription_text - :rtype: unicode - """ - return self._properties['transcription_text'] - - @property - def type(self): - """ - :returns: The type - :rtype: unicode - """ - return self._properties['type'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a TranscriptionInstance - - :returns: Fetched TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the TranscriptionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.TranscriptionInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/short_code.py b/twilio/rest/api/v2010/account/short_code.py deleted file mode 100644 index fcc605d..0000000 --- a/twilio/rest/api/v2010/account/short_code.py +++ /dev/null @@ -1,487 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class ShortCodeList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the ShortCodeList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeList - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeList - """ - super(ShortCodeList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/SMS/ShortCodes.json'.format(**self._solution) - - def stream(self, friendly_name=values.unset, short_code=values.unset, - limit=None, page_size=None): - """ - Streams ShortCodeInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode friendly_name: Filter by friendly name - :param unicode short_code: Filter by ShortCode - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.short_code.ShortCodeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, short_code=short_code, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, friendly_name=values.unset, short_code=values.unset, limit=None, - page_size=None): - """ - Lists ShortCodeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: Filter by friendly name - :param unicode short_code: Filter by ShortCode - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.short_code.ShortCodeInstance] - """ - return list(self.stream( - friendly_name=friendly_name, - short_code=short_code, - limit=limit, - page_size=page_size, - )) - - def page(self, friendly_name=values.unset, short_code=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ShortCodeInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: Filter by friendly name - :param unicode short_code: Filter by ShortCode - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodePage - """ - params = values.of({ - 'FriendlyName': friendly_name, - 'ShortCode': short_code, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ShortCodePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ShortCodeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ShortCodePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ShortCodeContext - - :param sid: Fetch by unique short-code Sid - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeContext - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ShortCodeContext - - :param sid: Fetch by unique short-code Sid - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeContext - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ShortCodeList>' - - -class ShortCodePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ShortCodePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodePage - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodePage - """ - super(ShortCodePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ShortCodeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - """ - return ShortCodeInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ShortCodePage>' - - -class ShortCodeContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the ShortCodeContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique short-code Sid - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeContext - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeContext - """ - super(ShortCodeContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SMS/ShortCodes/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a ShortCodeInstance - - :returns: Fetched ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ShortCodeInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, api_version=values.unset, - sms_url=values.unset, sms_method=values.unset, - sms_fallback_url=values.unset, sms_fallback_method=values.unset): - """ - Update the ShortCodeInstance - - :param unicode friendly_name: A human readable description of this resource - :param unicode api_version: The API version to use - :param unicode sms_url: URL Twilio will request when receiving an SMS - :param unicode sms_method: HTTP method to use when requesting the sms url - :param unicode sms_fallback_url: URL Twilio will request if an error occurs in executing TwiML - :param unicode sms_fallback_method: HTTP method Twilio will use with sms fallback url - - :returns: Updated ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'ApiVersion': api_version, - 'SmsUrl': sms_url, - 'SmsMethod': sms_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsFallbackMethod': sms_fallback_method, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ShortCodeInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.ShortCodeContext {}>'.format(context) - - -class ShortCodeInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the ShortCodeInstance - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - """ - super(ShortCodeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'short_code': payload['short_code'], - 'sid': payload['sid'], - 'sms_fallback_method': payload['sms_fallback_method'], - 'sms_fallback_url': payload['sms_fallback_url'], - 'sms_method': payload['sms_method'], - 'sms_url': payload['sms_url'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ShortCodeContext for this ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeContext - """ - if self._context is None: - self._context = ShortCodeContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version to use - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def short_code(self): - """ - :returns: The short code. e.g., 894546. - :rtype: unicode - """ - return self._properties['short_code'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this short-codes - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_fallback_method(self): - """ - :returns: HTTP method Twilio will use with sms fallback url - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: URL Twilio will request if an error occurs in executing TwiML - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: HTTP method to use when requesting the sms url - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: URL Twilio will request when receiving an SMS - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a ShortCodeInstance - - :returns: Fetched ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, api_version=values.unset, - sms_url=values.unset, sms_method=values.unset, - sms_fallback_url=values.unset, sms_fallback_method=values.unset): - """ - Update the ShortCodeInstance - - :param unicode friendly_name: A human readable description of this resource - :param unicode api_version: The API version to use - :param unicode sms_url: URL Twilio will request when receiving an SMS - :param unicode sms_method: HTTP method to use when requesting the sms url - :param unicode sms_fallback_url: URL Twilio will request if an error occurs in executing TwiML - :param unicode sms_fallback_method: HTTP method Twilio will use with sms fallback url - - :returns: Updated ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - api_version=api_version, - sms_url=sms_url, - sms_method=sms_method, - sms_fallback_url=sms_fallback_url, - sms_fallback_method=sms_fallback_method, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.ShortCodeInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/signing_key.py b/twilio/rest/api/v2010/account/signing_key.py deleted file mode 100644 index 03d1cc3..0000000 --- a/twilio/rest/api/v2010/account/signing_key.py +++ /dev/null @@ -1,385 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class SigningKeyList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the SigningKeyList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyList - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyList - """ - super(SigningKeyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/SigningKeys.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SigningKeyInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.signing_key.SigningKeyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SigningKeyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.signing_key.SigningKeyInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SigningKeyInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SigningKeyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SigningKeyInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SigningKeyPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SigningKeyContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - """ - return SigningKeyContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SigningKeyContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - """ - return SigningKeyContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.SigningKeyList>' - - -class SigningKeyPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the SigningKeyPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyPage - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyPage - """ - super(SigningKeyPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SigningKeyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - """ - return SigningKeyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.SigningKeyPage>' - - -class SigningKeyContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the SigningKeyContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - """ - super(SigningKeyContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SigningKeys/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a SigningKeyInstance - - :returns: Fetched SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SigningKeyInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset): - """ - Update the SigningKeyInstance - - :param unicode friendly_name: The friendly_name - - :returns: Updated SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SigningKeyInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the SigningKeyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.SigningKeyContext {}>'.format(context) - - -class SigningKeyInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the SigningKeyInstance - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - """ - super(SigningKeyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SigningKeyContext for this SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - """ - if self._context is None: - self._context = SigningKeyContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - def fetch(self): - """ - Fetch a SigningKeyInstance - - :returns: Fetched SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset): - """ - Update the SigningKeyInstance - - :param unicode friendly_name: The friendly_name - - :returns: Updated SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) - - def delete(self): - """ - Deletes the SigningKeyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.SigningKeyInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/sip/__init__.py b/twilio/rest/api/v2010/account/sip/__init__.py deleted file mode 100644 index 261e90f..0000000 --- a/twilio/rest/api/v2010/account/sip/__init__.py +++ /dev/null @@ -1,156 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.sip.credential_list import CredentialListList -from twilio.rest.api.v2010.account.sip.domain import DomainList -from twilio.rest.api.v2010.account.sip.ip_access_control_list import IpAccessControlListList - - -class SipList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the SipList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.sip.SipList - :rtype: twilio.rest.api.v2010.account.sip.SipList - """ - super(SipList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - - # Components - self._domains = None - self._regions = None - self._ip_access_control_lists = None - self._credential_lists = None - - @property - def domains(self): - """ - Access the domains - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainList - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainList - """ - if self._domains is None: - self._domains = DomainList(self._version, account_sid=self._solution['account_sid'], ) - return self._domains - - @property - def ip_access_control_lists(self): - """ - Access the ip_access_control_lists - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListList - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListList - """ - if self._ip_access_control_lists is None: - self._ip_access_control_lists = IpAccessControlListList( - self._version, - account_sid=self._solution['account_sid'], - ) - return self._ip_access_control_lists - - @property - def credential_lists(self): - """ - Access the credential_lists - - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListList - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListList - """ - if self._credential_lists is None: - self._credential_lists = CredentialListList( - self._version, - account_sid=self._solution['account_sid'], - ) - return self._credential_lists - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.SipList>' - - -class SipPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the SipPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.sip.SipPage - :rtype: twilio.rest.api.v2010.account.sip.SipPage - """ - super(SipPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SipInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.SipInstance - :rtype: twilio.rest.api.v2010.account.sip.SipInstance - """ - return SipInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.SipPage>' - - -class SipInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid): - """ - Initialize the SipInstance - - :returns: twilio.rest.api.v2010.account.sip.SipInstance - :rtype: twilio.rest.api.v2010.account.sip.SipInstance - """ - super(SipInstance, self).__init__(version) - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.SipInstance>' diff --git a/twilio/rest/api/v2010/account/sip/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/sip/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 6289428..0000000 Binary files a/twilio/rest/api/v2010/account/sip/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py deleted file mode 100644 index 7b2d10a..0000000 --- a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py +++ /dev/null @@ -1,461 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.sip.credential_list.credential import CredentialList - - -class CredentialListList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the CredentialListList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListList - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListList - """ - super(CredentialListList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/SIP/CredentialLists.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialListInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialListInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CredentialListPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialListInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialListPage(self._version, response, self._solution) - - def create(self, friendly_name): - """ - Create a new CredentialListInstance - - :param unicode friendly_name: The friendly_name - - :returns: Newly created CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CredentialListInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def get(self, sid): - """ - Constructs a CredentialListContext - - :param sid: Fetch by unique credential Sid - - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext - """ - return CredentialListContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CredentialListContext - - :param sid: Fetch by unique credential Sid - - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext - """ - return CredentialListContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.CredentialListList>' - - -class CredentialListPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the CredentialListPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListPage - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListPage - """ - super(CredentialListPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialListInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - """ - return CredentialListInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.CredentialListPage>' - - -class CredentialListContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the CredentialListContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique credential Sid - - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext - """ - super(CredentialListContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SIP/CredentialLists/{sid}.json'.format(**self._solution) - - # Dependents - self._credentials = None - - def fetch(self): - """ - Fetch a CredentialListInstance - - :returns: Fetched CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CredentialListInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name): - """ - Update the CredentialListInstance - - :param unicode friendly_name: The friendly_name - - :returns: Updated CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return CredentialListInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the CredentialListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def credentials(self): - """ - Access the credentials - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialList - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialList - """ - if self._credentials is None: - self._credentials = CredentialList( - self._version, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['sid'], - ) - return self._credentials - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.CredentialListContext {}>'.format(context) - - -class CredentialListInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the CredentialListInstance - - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - """ - super(CredentialListInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'sid': payload['sid'], - 'subresource_uris': payload['subresource_uris'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialListContext for this CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext - """ - if self._context is None: - self._context = CredentialListContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this credential - :rtype: unicode - """ - return self._properties['sid'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a CredentialListInstance - - :returns: Fetched CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name): - """ - Update the CredentialListInstance - - :param unicode friendly_name: The friendly_name - - :returns: Updated CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - """ - return self._proxy.update(friendly_name, ) - - def delete(self): - """ - Deletes the CredentialListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def credentials(self): - """ - Access the credentials - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialList - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialList - """ - return self._proxy.credentials - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.CredentialListInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/sip/credential_list/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/sip/credential_list/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 7e3bca7..0000000 Binary files a/twilio/rest/api/v2010/account/sip/credential_list/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/sip/credential_list/__pycache__/credential.cpython-36.pyc b/twilio/rest/api/v2010/account/sip/credential_list/__pycache__/credential.cpython-36.pyc deleted file mode 100644 index 9f375fd..0000000 Binary files a/twilio/rest/api/v2010/account/sip/credential_list/__pycache__/credential.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/sip/credential_list/credential.py b/twilio/rest/api/v2010/account/sip/credential_list/credential.py deleted file mode 100644 index 12073aa..0000000 --- a/twilio/rest/api/v2010/account/sip/credential_list/credential.py +++ /dev/null @@ -1,467 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class CredentialList(ListResource): - """ """ - - def __init__(self, version, account_sid, credential_list_sid): - """ - Initialize the CredentialList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param credential_list_sid: The credential_list_sid - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialList - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialList - """ - super(CredentialList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'credential_list_sid': credential_list_sid, } - self._uri = '/Accounts/{account_sid}/SIP/CredentialLists/{credential_list_sid}/Credentials.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CredentialPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialPage(self._version, response, self._solution) - - def create(self, username, password): - """ - Create a new CredentialInstance - - :param unicode username: The username - :param unicode password: The password - - :returns: Newly created CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - """ - data = values.of({'Username': username, 'Password': password, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CredentialInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - ) - - def get(self, sid): - """ - Constructs a CredentialContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - """ - return CredentialContext( - self._version, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a CredentialContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - """ - return CredentialContext( - self._version, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.CredentialList>' - - -class CredentialPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the CredentialPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param credential_list_sid: The credential_list_sid - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialPage - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialPage - """ - super(CredentialPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - """ - return CredentialInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.CredentialPage>' - - -class CredentialContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, credential_list_sid, sid): - """ - Initialize the CredentialContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param credential_list_sid: The credential_list_sid - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - """ - super(CredentialContext, self).__init__(version) - - # Path Solution - self._solution = { - 'account_sid': account_sid, - 'credential_list_sid': credential_list_sid, - 'sid': sid, - } - self._uri = '/Accounts/{account_sid}/SIP/CredentialLists/{credential_list_sid}/Credentials/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a CredentialInstance - - :returns: Fetched CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CredentialInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - sid=self._solution['sid'], - ) - - def update(self, password=values.unset): - """ - Update the CredentialInstance - - :param unicode password: The password - - :returns: Updated CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - """ - data = values.of({'Password': password, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return CredentialInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.CredentialContext {}>'.format(context) - - -class CredentialInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, credential_list_sid, - sid=None): - """ - Initialize the CredentialInstance - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - """ - super(CredentialInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'credential_list_sid': payload['credential_list_sid'], - 'username': payload['username'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'credential_list_sid': credential_list_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialContext for this CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - """ - if self._context is None: - self._context = CredentialContext( - self._version, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def credential_list_sid(self): - """ - :returns: The credential_list_sid - :rtype: unicode - """ - return self._properties['credential_list_sid'] - - @property - def username(self): - """ - :returns: The username - :rtype: unicode - """ - return self._properties['username'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a CredentialInstance - - :returns: Fetched CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - """ - return self._proxy.fetch() - - def update(self, password=values.unset): - """ - Update the CredentialInstance - - :param unicode password: The password - - :returns: Updated CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - """ - return self._proxy.update(password=password, ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.CredentialInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/sip/domain/__init__.py b/twilio/rest/api/v2010/account/sip/domain/__init__.py deleted file mode 100644 index d205373..0000000 --- a/twilio/rest/api/v2010/account/sip/domain/__init__.py +++ /dev/null @@ -1,649 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.sip.domain.credential_list_mapping import CredentialListMappingList -from twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping import IpAccessControlListMappingList - - -class DomainList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the DomainList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainList - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainList - """ - super(DomainList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DomainInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.domain.DomainInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DomainInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.domain.DomainInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DomainInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return DomainPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DomainInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DomainPage(self._version, response, self._solution) - - def create(self, domain_name, friendly_name=values.unset, - auth_type=values.unset, voice_url=values.unset, - voice_method=values.unset, voice_fallback_url=values.unset, - voice_fallback_method=values.unset, - voice_status_callback_url=values.unset, - voice_status_callback_method=values.unset, - sip_registration=values.unset): - """ - Create a new DomainInstance - - :param unicode domain_name: The unique address on Twilio to route SIP traffic - :param unicode friendly_name: A user-specified, human-readable name for the trigger. - :param unicode auth_type: The types of authentication mapped to the domain - :param unicode voice_url: URL Twilio will request when receiving a call - :param unicode voice_method: HTTP method to use with voice_url - :param unicode voice_fallback_url: URL Twilio will request if an error occurs in executing TwiML - :param unicode voice_fallback_method: HTTP method used with voice_fallback_url - :param unicode voice_status_callback_url: URL that Twilio will request with status updates - :param unicode voice_status_callback_method: The voice_status_callback_method - :param bool sip_registration: The sip_registration - - :returns: Newly created DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance - """ - data = values.of({ - 'DomainName': domain_name, - 'FriendlyName': friendly_name, - 'AuthType': auth_type, - 'VoiceUrl': voice_url, - 'VoiceMethod': voice_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceStatusCallbackUrl': voice_status_callback_url, - 'VoiceStatusCallbackMethod': voice_status_callback_method, - 'SipRegistration': sip_registration, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return DomainInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def get(self, sid): - """ - Constructs a DomainContext - - :param sid: Fetch by unique Domain Sid - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainContext - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainContext - """ - return DomainContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a DomainContext - - :param sid: Fetch by unique Domain Sid - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainContext - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainContext - """ - return DomainContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.DomainList>' - - -class DomainPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the DomainPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainPage - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainPage - """ - super(DomainPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DomainInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance - """ - return DomainInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.DomainPage>' - - -class DomainContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the DomainContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique Domain Sid - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainContext - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainContext - """ - super(DomainContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{sid}.json'.format(**self._solution) - - # Dependents - self._ip_access_control_list_mappings = None - self._credential_list_mappings = None - - def fetch(self): - """ - Fetch a DomainInstance - - :returns: Fetched DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return DomainInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, auth_type=values.unset, friendly_name=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_status_callback_method=values.unset, - voice_status_callback_url=values.unset, voice_url=values.unset, - sip_registration=values.unset): - """ - Update the DomainInstance - - :param unicode auth_type: The auth_type - :param unicode friendly_name: A user-specified, human-readable name for the trigger. - :param unicode voice_fallback_method: The voice_fallback_method - :param unicode voice_fallback_url: The voice_fallback_url - :param unicode voice_method: HTTP method to use with voice_url - :param unicode voice_status_callback_method: The voice_status_callback_method - :param unicode voice_status_callback_url: The voice_status_callback_url - :param unicode voice_url: The voice_url - :param bool sip_registration: The sip_registration - - :returns: Updated DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance - """ - data = values.of({ - 'AuthType': auth_type, - 'FriendlyName': friendly_name, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceStatusCallbackMethod': voice_status_callback_method, - 'VoiceStatusCallbackUrl': voice_status_callback_url, - 'VoiceUrl': voice_url, - 'SipRegistration': sip_registration, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return DomainInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the DomainInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def ip_access_control_list_mappings(self): - """ - Access the ip_access_control_list_mappings - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingList - """ - if self._ip_access_control_list_mappings is None: - self._ip_access_control_list_mappings = IpAccessControlListMappingList( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['sid'], - ) - return self._ip_access_control_list_mappings - - @property - def credential_list_mappings(self): - """ - Access the credential_list_mappings - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingList - """ - if self._credential_list_mappings is None: - self._credential_list_mappings = CredentialListMappingList( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['sid'], - ) - return self._credential_list_mappings - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.DomainContext {}>'.format(context) - - -class DomainInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the DomainInstance - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance - """ - super(DomainInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'auth_type': payload['auth_type'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'domain_name': payload['domain_name'], - 'friendly_name': payload['friendly_name'], - 'sid': payload['sid'], - 'uri': payload['uri'], - 'voice_fallback_method': payload['voice_fallback_method'], - 'voice_fallback_url': payload['voice_fallback_url'], - 'voice_method': payload['voice_method'], - 'voice_status_callback_method': payload['voice_status_callback_method'], - 'voice_status_callback_url': payload['voice_status_callback_url'], - 'voice_url': payload['voice_url'], - 'subresource_uris': payload['subresource_uris'], - 'sip_registration': payload['sip_registration'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DomainContext for this DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainContext - """ - if self._context is None: - self._context = DomainContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique id of the account that sent the message - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The Twilio API version used to process the message - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def auth_type(self): - """ - :returns: The types of authentication mapped to the domain - :rtype: unicode - """ - return self._properties['auth_type'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def domain_name(self): - """ - :returns: The unique address on Twilio to route SIP traffic - :rtype: unicode - """ - return self._properties['domain_name'] - - @property - def friendly_name(self): - """ - :returns: A user-specified, human-readable name for the trigger. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies the SIP Domain - :rtype: unicode - """ - return self._properties['sid'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - @property - def voice_fallback_method(self): - """ - :returns: HTTP method used with voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: URL Twilio will request if an error occurs in executing TwiML - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: HTTP method to use with voice_url - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_status_callback_method(self): - """ - :returns: The voice_status_callback_method - :rtype: unicode - """ - return self._properties['voice_status_callback_method'] - - @property - def voice_status_callback_url(self): - """ - :returns: URL that Twilio will request with status updates - :rtype: unicode - """ - return self._properties['voice_status_callback_url'] - - @property - def voice_url(self): - """ - :returns: URL Twilio will request when receiving a call - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def sip_registration(self): - """ - :returns: If SIP registration is allowed - :rtype: bool - """ - return self._properties['sip_registration'] - - def fetch(self): - """ - Fetch a DomainInstance - - :returns: Fetched DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance - """ - return self._proxy.fetch() - - def update(self, auth_type=values.unset, friendly_name=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_status_callback_method=values.unset, - voice_status_callback_url=values.unset, voice_url=values.unset, - sip_registration=values.unset): - """ - Update the DomainInstance - - :param unicode auth_type: The auth_type - :param unicode friendly_name: A user-specified, human-readable name for the trigger. - :param unicode voice_fallback_method: The voice_fallback_method - :param unicode voice_fallback_url: The voice_fallback_url - :param unicode voice_method: HTTP method to use with voice_url - :param unicode voice_status_callback_method: The voice_status_callback_method - :param unicode voice_status_callback_url: The voice_status_callback_url - :param unicode voice_url: The voice_url - :param bool sip_registration: The sip_registration - - :returns: Updated DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance - """ - return self._proxy.update( - auth_type=auth_type, - friendly_name=friendly_name, - voice_fallback_method=voice_fallback_method, - voice_fallback_url=voice_fallback_url, - voice_method=voice_method, - voice_status_callback_method=voice_status_callback_method, - voice_status_callback_url=voice_status_callback_url, - voice_url=voice_url, - sip_registration=sip_registration, - ) - - def delete(self): - """ - Deletes the DomainInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def ip_access_control_list_mappings(self): - """ - Access the ip_access_control_list_mappings - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingList - """ - return self._proxy.ip_access_control_list_mappings - - @property - def credential_list_mappings(self): - """ - Access the credential_list_mappings - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingList - """ - return self._proxy.credential_list_mappings - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.DomainInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/sip/domain/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/sip/domain/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 5e323c9..0000000 Binary files a/twilio/rest/api/v2010/account/sip/domain/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/sip/domain/__pycache__/credential_list_mapping.cpython-36.pyc b/twilio/rest/api/v2010/account/sip/domain/__pycache__/credential_list_mapping.cpython-36.pyc deleted file mode 100644 index 25522bb..0000000 Binary files a/twilio/rest/api/v2010/account/sip/domain/__pycache__/credential_list_mapping.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/sip/domain/__pycache__/ip_access_control_list_mapping.cpython-36.pyc b/twilio/rest/api/v2010/account/sip/domain/__pycache__/ip_access_control_list_mapping.cpython-36.pyc deleted file mode 100644 index 1b1581f..0000000 Binary files a/twilio/rest/api/v2010/account/sip/domain/__pycache__/ip_access_control_list_mapping.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py deleted file mode 100644 index 5a9c7be..0000000 --- a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py +++ /dev/null @@ -1,425 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class CredentialListMappingList(ListResource): - """ """ - - def __init__(self, version, account_sid, domain_sid): - """ - Initialize the CredentialListMappingList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param domain_sid: A string that uniquely identifies the SIP Domain - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingList - """ - super(CredentialListMappingList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/CredentialListMappings.json'.format(**self._solution) - - def create(self, credential_list_sid): - """ - Create a new CredentialListMappingInstance - - :param unicode credential_list_sid: The credential_list_sid - - :returns: Newly created CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - """ - data = values.of({'CredentialListSid': credential_list_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CredentialListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialListMappingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialListMappingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialListMappingInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CredentialListMappingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialListMappingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialListMappingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a CredentialListMappingContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - """ - return CredentialListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a CredentialListMappingContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - """ - return CredentialListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.CredentialListMappingList>' - - -class CredentialListMappingPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the CredentialListMappingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param domain_sid: A string that uniquely identifies the SIP Domain - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingPage - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingPage - """ - super(CredentialListMappingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialListMappingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - """ - return CredentialListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.CredentialListMappingPage>' - - -class CredentialListMappingContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, domain_sid, sid): - """ - Initialize the CredentialListMappingContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param domain_sid: The domain_sid - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - """ - super(CredentialListMappingContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/CredentialListMappings/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a CredentialListMappingInstance - - :returns: Fetched CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CredentialListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the CredentialListMappingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.CredentialListMappingContext {}>'.format(context) - - -class CredentialListMappingInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, domain_sid, sid=None): - """ - Initialize the CredentialListMappingInstance - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - """ - super(CredentialListMappingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'sid': payload['sid'], - 'uri': payload['uri'], - 'subresource_uris': payload['subresource_uris'], - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'domain_sid': domain_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialListMappingContext for this CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - """ - if self._context is None: - self._context = CredentialListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - def fetch(self): - """ - Fetch a CredentialListMappingInstance - - :returns: Fetched CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the CredentialListMappingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.CredentialListMappingInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py deleted file mode 100644 index ded6097..0000000 --- a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py +++ /dev/null @@ -1,425 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class IpAccessControlListMappingList(ListResource): - """ """ - - def __init__(self, version, account_sid, domain_sid): - """ - Initialize the IpAccessControlListMappingList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param domain_sid: A string that uniquely identifies the SIP Domain - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingList - """ - super(IpAccessControlListMappingList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/IpAccessControlListMappings.json'.format(**self._solution) - - def create(self, ip_access_control_list_sid): - """ - Create a new IpAccessControlListMappingInstance - - :param unicode ip_access_control_list_sid: The ip_access_control_list_sid - - :returns: Newly created IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - """ - data = values.of({'IpAccessControlListSid': ip_access_control_list_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return IpAccessControlListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams IpAccessControlListMappingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists IpAccessControlListMappingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of IpAccessControlListMappingInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return IpAccessControlListMappingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of IpAccessControlListMappingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return IpAccessControlListMappingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a IpAccessControlListMappingContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - """ - return IpAccessControlListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a IpAccessControlListMappingContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - """ - return IpAccessControlListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.IpAccessControlListMappingList>' - - -class IpAccessControlListMappingPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the IpAccessControlListMappingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param domain_sid: A string that uniquely identifies the SIP Domain - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingPage - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingPage - """ - super(IpAccessControlListMappingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of IpAccessControlListMappingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - """ - return IpAccessControlListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.IpAccessControlListMappingPage>' - - -class IpAccessControlListMappingContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, domain_sid, sid): - """ - Initialize the IpAccessControlListMappingContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param domain_sid: The domain_sid - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - """ - super(IpAccessControlListMappingContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/IpAccessControlListMappings/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a IpAccessControlListMappingInstance - - :returns: Fetched IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return IpAccessControlListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the IpAccessControlListMappingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.IpAccessControlListMappingContext {}>'.format(context) - - -class IpAccessControlListMappingInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, domain_sid, sid=None): - """ - Initialize the IpAccessControlListMappingInstance - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - """ - super(IpAccessControlListMappingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'sid': payload['sid'], - 'uri': payload['uri'], - 'subresource_uris': payload['subresource_uris'], - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'domain_sid': domain_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: IpAccessControlListMappingContext for this IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - """ - if self._context is None: - self._context = IpAccessControlListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - def fetch(self): - """ - Fetch a IpAccessControlListMappingInstance - - :returns: Fetched IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the IpAccessControlListMappingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.IpAccessControlListMappingInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py deleted file mode 100644 index 0a5c529..0000000 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py +++ /dev/null @@ -1,469 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address import IpAddressList - - -class IpAccessControlListList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the IpAccessControlListList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListList - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListList - """ - super(IpAccessControlListList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/SIP/IpAccessControlLists.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams IpAccessControlListInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists IpAccessControlListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of IpAccessControlListInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return IpAccessControlListPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of IpAccessControlListInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return IpAccessControlListPage(self._version, response, self._solution) - - def create(self, friendly_name): - """ - Create a new IpAccessControlListInstance - - :param unicode friendly_name: A human readable description of this resource - - :returns: Newly created IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return IpAccessControlListInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ) - - def get(self, sid): - """ - Constructs a IpAccessControlListContext - - :param sid: Fetch by unique ip-access-control-list Sid - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext - """ - return IpAccessControlListContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a IpAccessControlListContext - - :param sid: Fetch by unique ip-access-control-list Sid - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext - """ - return IpAccessControlListContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.IpAccessControlListList>' - - -class IpAccessControlListPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the IpAccessControlListPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListPage - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListPage - """ - super(IpAccessControlListPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of IpAccessControlListInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - """ - return IpAccessControlListInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.IpAccessControlListPage>' - - -class IpAccessControlListContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the IpAccessControlListContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique ip-access-control-list Sid - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext - """ - super(IpAccessControlListContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SIP/IpAccessControlLists/{sid}.json'.format(**self._solution) - - # Dependents - self._ip_addresses = None - - def fetch(self): - """ - Fetch a IpAccessControlListInstance - - :returns: Fetched IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return IpAccessControlListInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name): - """ - Update the IpAccessControlListInstance - - :param unicode friendly_name: A human readable description of this resource - - :returns: Updated IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return IpAccessControlListInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the IpAccessControlListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def ip_addresses(self): - """ - Access the ip_addresses - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList - """ - if self._ip_addresses is None: - self._ip_addresses = IpAddressList( - self._version, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['sid'], - ) - return self._ip_addresses - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.IpAccessControlListContext {}>'.format(context) - - -class IpAccessControlListInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the IpAccessControlListInstance - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - """ - super(IpAccessControlListInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'subresource_uris': payload['subresource_uris'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: IpAccessControlListContext for this IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext - """ - if self._context is None: - self._context = IpAccessControlListContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a IpAccessControlListInstance - - :returns: Fetched IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name): - """ - Update the IpAccessControlListInstance - - :param unicode friendly_name: A human readable description of this resource - - :returns: Updated IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - """ - return self._proxy.update(friendly_name, ) - - def delete(self): - """ - Deletes the IpAccessControlListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def ip_addresses(self): - """ - Access the ip_addresses - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList - """ - return self._proxy.ip_addresses - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.IpAccessControlListInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index c537fa3..0000000 Binary files a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__pycache__/ip_address.cpython-36.pyc b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__pycache__/ip_address.cpython-36.pyc deleted file mode 100644 index 62688c4..0000000 Binary files a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__pycache__/ip_address.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py deleted file mode 100644 index ccf6394..0000000 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py +++ /dev/null @@ -1,481 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class IpAddressList(ListResource): - """ """ - - def __init__(self, version, account_sid, ip_access_control_list_sid): - """ - Initialize the IpAddressList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param ip_access_control_list_sid: The ip_access_control_list_sid - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList - """ - super(IpAddressList, self).__init__(version) - - # Path Solution - self._solution = { - 'account_sid': account_sid, - 'ip_access_control_list_sid': ip_access_control_list_sid, - } - self._uri = '/Accounts/{account_sid}/SIP/IpAccessControlLists/{ip_access_control_list_sid}/IpAddresses.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams IpAddressInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists IpAddressInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of IpAddressInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return IpAddressPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of IpAddressInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return IpAddressPage(self._version, response, self._solution) - - def create(self, friendly_name, ip_address): - """ - Create a new IpAddressInstance - - :param unicode friendly_name: The friendly_name - :param unicode ip_address: The ip_address - - :returns: Newly created IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - """ - data = values.of({'FriendlyName': friendly_name, 'IpAddress': ip_address, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return IpAddressInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - ) - - def get(self, sid): - """ - Constructs a IpAddressContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - """ - return IpAddressContext( - self._version, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a IpAddressContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - """ - return IpAddressContext( - self._version, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.IpAddressList>' - - -class IpAddressPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the IpAddressPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param ip_access_control_list_sid: The ip_access_control_list_sid - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressPage - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressPage - """ - super(IpAddressPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of IpAddressInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - """ - return IpAddressInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.IpAddressPage>' - - -class IpAddressContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, ip_access_control_list_sid, sid): - """ - Initialize the IpAddressContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param ip_access_control_list_sid: The ip_access_control_list_sid - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - """ - super(IpAddressContext, self).__init__(version) - - # Path Solution - self._solution = { - 'account_sid': account_sid, - 'ip_access_control_list_sid': ip_access_control_list_sid, - 'sid': sid, - } - self._uri = '/Accounts/{account_sid}/SIP/IpAccessControlLists/{ip_access_control_list_sid}/IpAddresses/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a IpAddressInstance - - :returns: Fetched IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return IpAddressInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - sid=self._solution['sid'], - ) - - def update(self, ip_address=values.unset, friendly_name=values.unset): - """ - Update the IpAddressInstance - - :param unicode ip_address: The ip_address - :param unicode friendly_name: The friendly_name - - :returns: Updated IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - """ - data = values.of({'IpAddress': ip_address, 'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return IpAddressInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the IpAddressInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.IpAddressContext {}>'.format(context) - - -class IpAddressInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid, ip_access_control_list_sid, - sid=None): - """ - Initialize the IpAddressInstance - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - """ - super(IpAddressInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'ip_address': payload['ip_address'], - 'ip_access_control_list_sid': payload['ip_access_control_list_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'ip_access_control_list_sid': ip_access_control_list_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: IpAddressContext for this IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - """ - if self._context is None: - self._context = IpAddressContext( - self._version, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def ip_address(self): - """ - :returns: The ip_address - :rtype: unicode - """ - return self._properties['ip_address'] - - @property - def ip_access_control_list_sid(self): - """ - :returns: The ip_access_control_list_sid - :rtype: unicode - """ - return self._properties['ip_access_control_list_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a IpAddressInstance - - :returns: Fetched IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - """ - return self._proxy.fetch() - - def update(self, ip_address=values.unset, friendly_name=values.unset): - """ - Update the IpAddressInstance - - :param unicode ip_address: The ip_address - :param unicode friendly_name: The friendly_name - - :returns: Updated IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - """ - return self._proxy.update(ip_address=ip_address, friendly_name=friendly_name, ) - - def delete(self): - """ - Deletes the IpAddressInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.IpAddressInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/token.py b/twilio/rest/api/v2010/account/token.py deleted file mode 100644 index c0fa9a0..0000000 --- a/twilio/rest/api/v2010/account/token.py +++ /dev/null @@ -1,194 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TokenList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the TokenList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.token.TokenList - :rtype: twilio.rest.api.v2010.account.token.TokenList - """ - super(TokenList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Tokens.json'.format(**self._solution) - - def create(self, ttl=values.unset): - """ - Create a new TokenInstance - - :param unicode ttl: The duration in seconds the credentials are valid - - :returns: Newly created TokenInstance - :rtype: twilio.rest.api.v2010.account.token.TokenInstance - """ - data = values.of({'Ttl': ttl, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return TokenInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TokenList>' - - -class TokenPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TokenPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.token.TokenPage - :rtype: twilio.rest.api.v2010.account.token.TokenPage - """ - super(TokenPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TokenInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.token.TokenInstance - :rtype: twilio.rest.api.v2010.account.token.TokenInstance - """ - return TokenInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TokenPage>' - - -class TokenInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid): - """ - Initialize the TokenInstance - - :returns: twilio.rest.api.v2010.account.token.TokenInstance - :rtype: twilio.rest.api.v2010.account.token.TokenInstance - """ - super(TokenInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'ice_servers': payload['ice_servers'], - 'password': payload['password'], - 'ttl': payload['ttl'], - 'username': payload['username'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def ice_servers(self): - """ - :returns: An array representing the ephemeral credentials - :rtype: unicode - """ - return self._properties['ice_servers'] - - @property - def password(self): - """ - :returns: The temporary password used for authenticating - :rtype: unicode - """ - return self._properties['password'] - - @property - def ttl(self): - """ - :returns: The duration in seconds the credentials are valid - :rtype: unicode - """ - return self._properties['ttl'] - - @property - def username(self): - """ - :returns: The temporary username that uniquely identifies a Token. - :rtype: unicode - """ - return self._properties['username'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TokenInstance>' diff --git a/twilio/rest/api/v2010/account/transcription.py b/twilio/rest/api/v2010/account/transcription.py deleted file mode 100644 index 16d1f88..0000000 --- a/twilio/rest/api/v2010/account/transcription.py +++ /dev/null @@ -1,436 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class TranscriptionList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the TranscriptionList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionList - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionList - """ - super(TranscriptionList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Transcriptions.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams TranscriptionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.transcription.TranscriptionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists TranscriptionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.transcription.TranscriptionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TranscriptionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return TranscriptionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TranscriptionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TranscriptionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a TranscriptionContext - - :param sid: Fetch by unique transcription Sid - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionContext - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionContext - """ - return TranscriptionContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TranscriptionContext - - :param sid: Fetch by unique transcription Sid - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionContext - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionContext - """ - return TranscriptionContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TranscriptionList>' - - -class TranscriptionPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TranscriptionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionPage - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionPage - """ - super(TranscriptionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TranscriptionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionInstance - """ - return TranscriptionInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TranscriptionPage>' - - -class TranscriptionContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the TranscriptionContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique transcription Sid - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionContext - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionContext - """ - super(TranscriptionContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Transcriptions/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a TranscriptionInstance - - :returns: Fetched TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return TranscriptionInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the TranscriptionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.TranscriptionContext {}>'.format(context) - - -class TranscriptionInstance(InstanceResource): - """ """ - - class Status(object): - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - FAILED = "failed" - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the TranscriptionInstance - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionInstance - """ - super(TranscriptionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'duration': payload['duration'], - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'recording_sid': payload['recording_sid'], - 'sid': payload['sid'], - 'status': payload['status'], - 'transcription_text': payload['transcription_text'], - 'type': payload['type'], - 'uri': payload['uri'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TranscriptionContext for this TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionContext - """ - if self._context is None: - self._context = TranscriptionContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def duration(self): - """ - :returns: The duration of the transcribed audio, in seconds. - :rtype: unicode - """ - return self._properties['duration'] - - @property - def price(self): - """ - :returns: The charge for this transcription - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which Price is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def recording_sid(self): - """ - :returns: The string that uniquely identifies the recording - :rtype: unicode - """ - return self._properties['recording_sid'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this transcription - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status of the transcription - :rtype: TranscriptionInstance.Status - """ - return self._properties['status'] - - @property - def transcription_text(self): - """ - :returns: The text content of the transcription. - :rtype: unicode - """ - return self._properties['transcription_text'] - - @property - def type(self): - """ - :returns: The type - :rtype: unicode - """ - return self._properties['type'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch a TranscriptionInstance - - :returns: Fetched TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the TranscriptionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.TranscriptionInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/usage/__init__.py b/twilio/rest/api/v2010/account/usage/__init__.py deleted file mode 100644 index 78a3efa..0000000 --- a/twilio/rest/api/v2010/account/usage/__init__.py +++ /dev/null @@ -1,135 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.usage.record import RecordList -from twilio.rest.api.v2010.account.usage.trigger import TriggerList - - -class UsageList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the UsageList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.UsageList - :rtype: twilio.rest.api.v2010.account.usage.UsageList - """ - super(UsageList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - - # Components - self._records = None - self._triggers = None - - @property - def records(self): - """ - Access the records - - :returns: twilio.rest.api.v2010.account.usage.record.RecordList - :rtype: twilio.rest.api.v2010.account.usage.record.RecordList - """ - if self._records is None: - self._records = RecordList(self._version, account_sid=self._solution['account_sid'], ) - return self._records - - @property - def triggers(self): - """ - Access the triggers - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerList - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerList - """ - if self._triggers is None: - self._triggers = TriggerList(self._version, account_sid=self._solution['account_sid'], ) - return self._triggers - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.UsageList>' - - -class UsagePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the UsagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.UsagePage - :rtype: twilio.rest.api.v2010.account.usage.UsagePage - """ - super(UsagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UsageInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.UsageInstance - :rtype: twilio.rest.api.v2010.account.usage.UsageInstance - """ - return UsageInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.UsagePage>' - - -class UsageInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid): - """ - Initialize the UsageInstance - - :returns: twilio.rest.api.v2010.account.usage.UsageInstance - :rtype: twilio.rest.api.v2010.account.usage.UsageInstance - """ - super(UsageInstance, self).__init__(version) - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.UsageInstance>' diff --git a/twilio/rest/api/v2010/account/usage/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/usage/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index b2c5a09..0000000 Binary files a/twilio/rest/api/v2010/account/usage/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/usage/__pycache__/trigger.cpython-36.pyc b/twilio/rest/api/v2010/account/usage/__pycache__/trigger.cpython-36.pyc deleted file mode 100644 index 1ba09af..0000000 Binary files a/twilio/rest/api/v2010/account/usage/__pycache__/trigger.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/usage/record/__init__.py b/twilio/rest/api/v2010/account/usage/record/__init__.py deleted file mode 100644 index 13476fd..0000000 --- a/twilio/rest/api/v2010/account/usage/record/__init__.py +++ /dev/null @@ -1,694 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.usage.record.all_time import AllTimeList -from twilio.rest.api.v2010.account.usage.record.daily import DailyList -from twilio.rest.api.v2010.account.usage.record.last_month import LastMonthList -from twilio.rest.api.v2010.account.usage.record.monthly import MonthlyList -from twilio.rest.api.v2010.account.usage.record.this_month import ThisMonthList -from twilio.rest.api.v2010.account.usage.record.today import TodayList -from twilio.rest.api.v2010.account.usage.record.yearly import YearlyList -from twilio.rest.api.v2010.account.usage.record.yesterday import YesterdayList - - -class RecordList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the RecordList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.RecordList - :rtype: twilio.rest.api.v2010.account.usage.record.RecordList - """ - super(RecordList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records.json'.format(**self._solution) - - # Components - self._all_time = None - self._daily = None - self._last_month = None - self._monthly = None - self._this_month = None - self._today = None - self._yearly = None - self._yesterday = None - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Streams RecordInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param RecordInstance.Category category: Only include usage of a given category - :param date start_date: Filter by start date - :param date end_date: Filter by end date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.RecordInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Lists RecordInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param RecordInstance.Category category: Only include usage of a given category - :param date start_date: Filter by start date - :param date end_date: Filter by end date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.RecordInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of RecordInstance records from the API. - Request is executed immediately - - :param RecordInstance.Category category: Only include usage of a given category - :param date start_date: Filter by start date - :param date end_date: Filter by end date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RecordInstance - :rtype: twilio.rest.api.v2010.account.usage.record.RecordPage - """ - params = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return RecordPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RecordInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RecordInstance - :rtype: twilio.rest.api.v2010.account.usage.record.RecordPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RecordPage(self._version, response, self._solution) - - @property - def all_time(self): - """ - Access the all_time - - :returns: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeList - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeList - """ - if self._all_time is None: - self._all_time = AllTimeList(self._version, account_sid=self._solution['account_sid'], ) - return self._all_time - - @property - def daily(self): - """ - Access the daily - - :returns: twilio.rest.api.v2010.account.usage.record.daily.DailyList - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyList - """ - if self._daily is None: - self._daily = DailyList(self._version, account_sid=self._solution['account_sid'], ) - return self._daily - - @property - def last_month(self): - """ - Access the last_month - - :returns: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthList - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthList - """ - if self._last_month is None: - self._last_month = LastMonthList(self._version, account_sid=self._solution['account_sid'], ) - return self._last_month - - @property - def monthly(self): - """ - Access the monthly - - :returns: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyList - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyList - """ - if self._monthly is None: - self._monthly = MonthlyList(self._version, account_sid=self._solution['account_sid'], ) - return self._monthly - - @property - def this_month(self): - """ - Access the this_month - - :returns: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthList - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthList - """ - if self._this_month is None: - self._this_month = ThisMonthList(self._version, account_sid=self._solution['account_sid'], ) - return self._this_month - - @property - def today(self): - """ - Access the today - - :returns: twilio.rest.api.v2010.account.usage.record.today.TodayList - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayList - """ - if self._today is None: - self._today = TodayList(self._version, account_sid=self._solution['account_sid'], ) - return self._today - - @property - def yearly(self): - """ - Access the yearly - - :returns: twilio.rest.api.v2010.account.usage.record.yearly.YearlyList - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyList - """ - if self._yearly is None: - self._yearly = YearlyList(self._version, account_sid=self._solution['account_sid'], ) - return self._yearly - - @property - def yesterday(self): - """ - Access the yesterday - - :returns: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayList - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayList - """ - if self._yesterday is None: - self._yesterday = YesterdayList(self._version, account_sid=self._solution['account_sid'], ) - return self._yesterday - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.RecordList>' - - -class RecordPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the RecordPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.RecordPage - :rtype: twilio.rest.api.v2010.account.usage.record.RecordPage - """ - super(RecordPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RecordInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.record.RecordInstance - :rtype: twilio.rest.api.v2010.account.usage.record.RecordInstance - """ - return RecordInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.RecordPage>' - - -class RecordInstance(InstanceResource): - """ """ - - class Category(object): - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IP_MESSAGING = "ip-messaging" - IP_MESSAGING_COMMANDS = "ip-messaging-commands" - IP_MESSAGING_DATA_STORAGE = "ip-messaging-data-storage" - IP_MESSAGING_DATA_TRANSFER = "ip-messaging-data-transfer" - IP_MESSAGING_ENDPOINT_CONNECTIVITY = "ip-messaging-endpoint-connectivity" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_ACTIONS = "pchat-actions" - PCHAT_APS = "pchat-aps" - PCHAT_NOTIFICATIONS = "pchat-notifications" - PCHAT_READS = "pchat-reads" - PCHAT_USERS = "pchat-users" - PCHAT_MESSAGES = "pchat-messages" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PV = "pv" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VIDEO_RECORDINGS = "video-recordings" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_AUDIO_TRACE = "voice-insights-audio-trace" - VOICE_INSIGHTS_CARRIER_CALLS = "voice-insights-carrier-calls" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - - def __init__(self, version, payload, account_sid): - """ - Initialize the RecordInstance - - :returns: twilio.rest.api.v2010.account.usage.record.RecordInstance - :rtype: twilio.rest.api.v2010.account.usage.record.RecordInstance - """ - super(RecordInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'category': payload['category'], - 'count': payload['count'], - 'count_unit': payload['count_unit'], - 'description': payload['description'], - 'end_date': deserialize.iso8601_date(payload['end_date']), - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'start_date': deserialize.iso8601_date(payload['start_date']), - 'subresource_uris': payload['subresource_uris'], - 'uri': payload['uri'], - 'usage': payload['usage'], - 'usage_unit': payload['usage_unit'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The Account that accrued the usage - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def category(self): - """ - :returns: The category of usage - :rtype: RecordInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The number of usage events (e.g. the number of calls). - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The unit in which `Count` is measured - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: A human-readable description of the usage category. - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The last date usage is included in this record - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The total price of the usage - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which `Price` is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The first date usage is included in this record - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: Subresources Uris for this UsageRecord - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The amount of usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The units in which `Usage` is measured - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.RecordInstance>' diff --git a/twilio/rest/api/v2010/account/usage/record/__pycache__/__init__.cpython-36.pyc b/twilio/rest/api/v2010/account/usage/record/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index fce9286..0000000 Binary files a/twilio/rest/api/v2010/account/usage/record/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/usage/record/__pycache__/all_time.cpython-36.pyc b/twilio/rest/api/v2010/account/usage/record/__pycache__/all_time.cpython-36.pyc deleted file mode 100644 index a870de8..0000000 Binary files a/twilio/rest/api/v2010/account/usage/record/__pycache__/all_time.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/usage/record/__pycache__/daily.cpython-36.pyc b/twilio/rest/api/v2010/account/usage/record/__pycache__/daily.cpython-36.pyc deleted file mode 100644 index b367a37..0000000 Binary files a/twilio/rest/api/v2010/account/usage/record/__pycache__/daily.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/usage/record/__pycache__/last_month.cpython-36.pyc b/twilio/rest/api/v2010/account/usage/record/__pycache__/last_month.cpython-36.pyc deleted file mode 100644 index 9af6ece..0000000 Binary files a/twilio/rest/api/v2010/account/usage/record/__pycache__/last_month.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/usage/record/__pycache__/monthly.cpython-36.pyc b/twilio/rest/api/v2010/account/usage/record/__pycache__/monthly.cpython-36.pyc deleted file mode 100644 index 1615f3a..0000000 Binary files a/twilio/rest/api/v2010/account/usage/record/__pycache__/monthly.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/usage/record/__pycache__/this_month.cpython-36.pyc b/twilio/rest/api/v2010/account/usage/record/__pycache__/this_month.cpython-36.pyc deleted file mode 100644 index e55c220..0000000 Binary files a/twilio/rest/api/v2010/account/usage/record/__pycache__/this_month.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/usage/record/__pycache__/today.cpython-36.pyc b/twilio/rest/api/v2010/account/usage/record/__pycache__/today.cpython-36.pyc deleted file mode 100644 index 6e40194..0000000 Binary files a/twilio/rest/api/v2010/account/usage/record/__pycache__/today.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/usage/record/__pycache__/yearly.cpython-36.pyc b/twilio/rest/api/v2010/account/usage/record/__pycache__/yearly.cpython-36.pyc deleted file mode 100644 index b861b2d..0000000 Binary files a/twilio/rest/api/v2010/account/usage/record/__pycache__/yearly.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/usage/record/__pycache__/yesterday.cpython-36.pyc b/twilio/rest/api/v2010/account/usage/record/__pycache__/yesterday.cpython-36.pyc deleted file mode 100644 index bc2c03d..0000000 Binary files a/twilio/rest/api/v2010/account/usage/record/__pycache__/yesterday.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/api/v2010/account/usage/record/all_time.py b/twilio/rest/api/v2010/account/usage/record/all_time.py deleted file mode 100644 index e99af74..0000000 --- a/twilio/rest/api/v2010/account/usage/record/all_time.py +++ /dev/null @@ -1,580 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AllTimeList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the AllTimeList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeList - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeList - """ - super(AllTimeList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/AllTime.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Streams AllTimeInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param AllTimeInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.all_time.AllTimeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Lists AllTimeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param AllTimeInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.all_time.AllTimeInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of AllTimeInstance records from the API. - Request is executed immediately - - :param AllTimeInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AllTimeInstance - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimePage - """ - params = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AllTimePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AllTimeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AllTimeInstance - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AllTimePage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AllTimeList>' - - -class AllTimePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the AllTimePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.all_time.AllTimePage - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimePage - """ - super(AllTimePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AllTimeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeInstance - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeInstance - """ - return AllTimeInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AllTimePage>' - - -class AllTimeInstance(InstanceResource): - """ """ - - class Category(object): - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IP_MESSAGING = "ip-messaging" - IP_MESSAGING_COMMANDS = "ip-messaging-commands" - IP_MESSAGING_DATA_STORAGE = "ip-messaging-data-storage" - IP_MESSAGING_DATA_TRANSFER = "ip-messaging-data-transfer" - IP_MESSAGING_ENDPOINT_CONNECTIVITY = "ip-messaging-endpoint-connectivity" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_ACTIONS = "pchat-actions" - PCHAT_APS = "pchat-aps" - PCHAT_NOTIFICATIONS = "pchat-notifications" - PCHAT_READS = "pchat-reads" - PCHAT_USERS = "pchat-users" - PCHAT_MESSAGES = "pchat-messages" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PV = "pv" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VIDEO_RECORDINGS = "video-recordings" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_AUDIO_TRACE = "voice-insights-audio-trace" - VOICE_INSIGHTS_CARRIER_CALLS = "voice-insights-carrier-calls" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - - def __init__(self, version, payload, account_sid): - """ - Initialize the AllTimeInstance - - :returns: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeInstance - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeInstance - """ - super(AllTimeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'category': payload['category'], - 'count': payload['count'], - 'count_unit': payload['count_unit'], - 'description': payload['description'], - 'end_date': deserialize.iso8601_date(payload['end_date']), - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'start_date': deserialize.iso8601_date(payload['start_date']), - 'subresource_uris': payload['subresource_uris'], - 'uri': payload['uri'], - 'usage': payload['usage'], - 'usage_unit': payload['usage_unit'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def category(self): - """ - :returns: The category - :rtype: AllTimeInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The count - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The count_unit - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: The description - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The end_date - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The price - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The start_date - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The usage_unit - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.AllTimeInstance>' diff --git a/twilio/rest/api/v2010/account/usage/record/daily.py b/twilio/rest/api/v2010/account/usage/record/daily.py deleted file mode 100644 index 4bc83ac..0000000 --- a/twilio/rest/api/v2010/account/usage/record/daily.py +++ /dev/null @@ -1,580 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DailyList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the DailyList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.daily.DailyList - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyList - """ - super(DailyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/Daily.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Streams DailyInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param DailyInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.daily.DailyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Lists DailyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param DailyInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.daily.DailyInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of DailyInstance records from the API. - Request is executed immediately - - :param DailyInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DailyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyPage - """ - params = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return DailyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DailyInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DailyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DailyPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.DailyList>' - - -class DailyPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the DailyPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.daily.DailyPage - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyPage - """ - super(DailyPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DailyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.record.daily.DailyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyInstance - """ - return DailyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.DailyPage>' - - -class DailyInstance(InstanceResource): - """ """ - - class Category(object): - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IP_MESSAGING = "ip-messaging" - IP_MESSAGING_COMMANDS = "ip-messaging-commands" - IP_MESSAGING_DATA_STORAGE = "ip-messaging-data-storage" - IP_MESSAGING_DATA_TRANSFER = "ip-messaging-data-transfer" - IP_MESSAGING_ENDPOINT_CONNECTIVITY = "ip-messaging-endpoint-connectivity" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_ACTIONS = "pchat-actions" - PCHAT_APS = "pchat-aps" - PCHAT_NOTIFICATIONS = "pchat-notifications" - PCHAT_READS = "pchat-reads" - PCHAT_USERS = "pchat-users" - PCHAT_MESSAGES = "pchat-messages" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PV = "pv" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VIDEO_RECORDINGS = "video-recordings" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_AUDIO_TRACE = "voice-insights-audio-trace" - VOICE_INSIGHTS_CARRIER_CALLS = "voice-insights-carrier-calls" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - - def __init__(self, version, payload, account_sid): - """ - Initialize the DailyInstance - - :returns: twilio.rest.api.v2010.account.usage.record.daily.DailyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyInstance - """ - super(DailyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'category': payload['category'], - 'count': payload['count'], - 'count_unit': payload['count_unit'], - 'description': payload['description'], - 'end_date': deserialize.iso8601_date(payload['end_date']), - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'start_date': deserialize.iso8601_date(payload['start_date']), - 'subresource_uris': payload['subresource_uris'], - 'uri': payload['uri'], - 'usage': payload['usage'], - 'usage_unit': payload['usage_unit'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def category(self): - """ - :returns: The category - :rtype: DailyInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The count - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The count_unit - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: The description - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The end_date - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The price - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The start_date - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The usage_unit - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.DailyInstance>' diff --git a/twilio/rest/api/v2010/account/usage/record/last_month.py b/twilio/rest/api/v2010/account/usage/record/last_month.py deleted file mode 100644 index 5bfc5aa..0000000 --- a/twilio/rest/api/v2010/account/usage/record/last_month.py +++ /dev/null @@ -1,580 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class LastMonthList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the LastMonthList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthList - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthList - """ - super(LastMonthList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/LastMonth.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Streams LastMonthInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param LastMonthInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.last_month.LastMonthInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Lists LastMonthInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param LastMonthInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.last_month.LastMonthInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of LastMonthInstance records from the API. - Request is executed immediately - - :param LastMonthInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of LastMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthPage - """ - params = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return LastMonthPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of LastMonthInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of LastMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return LastMonthPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.LastMonthList>' - - -class LastMonthPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the LastMonthPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthPage - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthPage - """ - super(LastMonthPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of LastMonthInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthInstance - """ - return LastMonthInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.LastMonthPage>' - - -class LastMonthInstance(InstanceResource): - """ """ - - class Category(object): - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IP_MESSAGING = "ip-messaging" - IP_MESSAGING_COMMANDS = "ip-messaging-commands" - IP_MESSAGING_DATA_STORAGE = "ip-messaging-data-storage" - IP_MESSAGING_DATA_TRANSFER = "ip-messaging-data-transfer" - IP_MESSAGING_ENDPOINT_CONNECTIVITY = "ip-messaging-endpoint-connectivity" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_ACTIONS = "pchat-actions" - PCHAT_APS = "pchat-aps" - PCHAT_NOTIFICATIONS = "pchat-notifications" - PCHAT_READS = "pchat-reads" - PCHAT_USERS = "pchat-users" - PCHAT_MESSAGES = "pchat-messages" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PV = "pv" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VIDEO_RECORDINGS = "video-recordings" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_AUDIO_TRACE = "voice-insights-audio-trace" - VOICE_INSIGHTS_CARRIER_CALLS = "voice-insights-carrier-calls" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - - def __init__(self, version, payload, account_sid): - """ - Initialize the LastMonthInstance - - :returns: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthInstance - """ - super(LastMonthInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'category': payload['category'], - 'count': payload['count'], - 'count_unit': payload['count_unit'], - 'description': payload['description'], - 'end_date': deserialize.iso8601_date(payload['end_date']), - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'start_date': deserialize.iso8601_date(payload['start_date']), - 'subresource_uris': payload['subresource_uris'], - 'uri': payload['uri'], - 'usage': payload['usage'], - 'usage_unit': payload['usage_unit'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def category(self): - """ - :returns: The category - :rtype: LastMonthInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The count - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The count_unit - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: The description - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The end_date - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The price - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The start_date - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The usage_unit - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.LastMonthInstance>' diff --git a/twilio/rest/api/v2010/account/usage/record/monthly.py b/twilio/rest/api/v2010/account/usage/record/monthly.py deleted file mode 100644 index c6a48bf..0000000 --- a/twilio/rest/api/v2010/account/usage/record/monthly.py +++ /dev/null @@ -1,580 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MonthlyList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the MonthlyList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyList - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyList - """ - super(MonthlyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/Monthly.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Streams MonthlyInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param MonthlyInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.monthly.MonthlyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Lists MonthlyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param MonthlyInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.monthly.MonthlyInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MonthlyInstance records from the API. - Request is executed immediately - - :param MonthlyInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MonthlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyPage - """ - params = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MonthlyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MonthlyInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MonthlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MonthlyPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MonthlyList>' - - -class MonthlyPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MonthlyPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyPage - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyPage - """ - super(MonthlyPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MonthlyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyInstance - """ - return MonthlyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MonthlyPage>' - - -class MonthlyInstance(InstanceResource): - """ """ - - class Category(object): - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IP_MESSAGING = "ip-messaging" - IP_MESSAGING_COMMANDS = "ip-messaging-commands" - IP_MESSAGING_DATA_STORAGE = "ip-messaging-data-storage" - IP_MESSAGING_DATA_TRANSFER = "ip-messaging-data-transfer" - IP_MESSAGING_ENDPOINT_CONNECTIVITY = "ip-messaging-endpoint-connectivity" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_ACTIONS = "pchat-actions" - PCHAT_APS = "pchat-aps" - PCHAT_NOTIFICATIONS = "pchat-notifications" - PCHAT_READS = "pchat-reads" - PCHAT_USERS = "pchat-users" - PCHAT_MESSAGES = "pchat-messages" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PV = "pv" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VIDEO_RECORDINGS = "video-recordings" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_AUDIO_TRACE = "voice-insights-audio-trace" - VOICE_INSIGHTS_CARRIER_CALLS = "voice-insights-carrier-calls" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - - def __init__(self, version, payload, account_sid): - """ - Initialize the MonthlyInstance - - :returns: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyInstance - """ - super(MonthlyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'category': payload['category'], - 'count': payload['count'], - 'count_unit': payload['count_unit'], - 'description': payload['description'], - 'end_date': deserialize.iso8601_date(payload['end_date']), - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'start_date': deserialize.iso8601_date(payload['start_date']), - 'subresource_uris': payload['subresource_uris'], - 'uri': payload['uri'], - 'usage': payload['usage'], - 'usage_unit': payload['usage_unit'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def category(self): - """ - :returns: The category - :rtype: MonthlyInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The count - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The count_unit - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: The description - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The end_date - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The price - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The start_date - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The usage_unit - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.MonthlyInstance>' diff --git a/twilio/rest/api/v2010/account/usage/record/this_month.py b/twilio/rest/api/v2010/account/usage/record/this_month.py deleted file mode 100644 index d48ff3e..0000000 --- a/twilio/rest/api/v2010/account/usage/record/this_month.py +++ /dev/null @@ -1,580 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ThisMonthList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the ThisMonthList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthList - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthList - """ - super(ThisMonthList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/ThisMonth.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Streams ThisMonthInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param ThisMonthInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Lists ThisMonthInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param ThisMonthInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ThisMonthInstance records from the API. - Request is executed immediately - - :param ThisMonthInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ThisMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthPage - """ - params = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ThisMonthPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ThisMonthInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ThisMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ThisMonthPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ThisMonthList>' - - -class ThisMonthPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ThisMonthPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthPage - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthPage - """ - super(ThisMonthPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ThisMonthInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthInstance - """ - return ThisMonthInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ThisMonthPage>' - - -class ThisMonthInstance(InstanceResource): - """ """ - - class Category(object): - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IP_MESSAGING = "ip-messaging" - IP_MESSAGING_COMMANDS = "ip-messaging-commands" - IP_MESSAGING_DATA_STORAGE = "ip-messaging-data-storage" - IP_MESSAGING_DATA_TRANSFER = "ip-messaging-data-transfer" - IP_MESSAGING_ENDPOINT_CONNECTIVITY = "ip-messaging-endpoint-connectivity" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_ACTIONS = "pchat-actions" - PCHAT_APS = "pchat-aps" - PCHAT_NOTIFICATIONS = "pchat-notifications" - PCHAT_READS = "pchat-reads" - PCHAT_USERS = "pchat-users" - PCHAT_MESSAGES = "pchat-messages" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PV = "pv" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VIDEO_RECORDINGS = "video-recordings" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_AUDIO_TRACE = "voice-insights-audio-trace" - VOICE_INSIGHTS_CARRIER_CALLS = "voice-insights-carrier-calls" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - - def __init__(self, version, payload, account_sid): - """ - Initialize the ThisMonthInstance - - :returns: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthInstance - """ - super(ThisMonthInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'category': payload['category'], - 'count': payload['count'], - 'count_unit': payload['count_unit'], - 'description': payload['description'], - 'end_date': deserialize.iso8601_date(payload['end_date']), - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'start_date': deserialize.iso8601_date(payload['start_date']), - 'subresource_uris': payload['subresource_uris'], - 'uri': payload['uri'], - 'usage': payload['usage'], - 'usage_unit': payload['usage_unit'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def category(self): - """ - :returns: The category - :rtype: ThisMonthInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The count - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The count_unit - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: The description - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The end_date - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The price - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The start_date - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The usage_unit - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ThisMonthInstance>' diff --git a/twilio/rest/api/v2010/account/usage/record/today.py b/twilio/rest/api/v2010/account/usage/record/today.py deleted file mode 100644 index d60c3bf..0000000 --- a/twilio/rest/api/v2010/account/usage/record/today.py +++ /dev/null @@ -1,580 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TodayList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the TodayList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.today.TodayList - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayList - """ - super(TodayList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/Today.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Streams TodayInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param TodayInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.today.TodayInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Lists TodayInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param TodayInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.today.TodayInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of TodayInstance records from the API. - Request is executed immediately - - :param TodayInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TodayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayPage - """ - params = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return TodayPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TodayInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TodayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TodayPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TodayList>' - - -class TodayPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TodayPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.today.TodayPage - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayPage - """ - super(TodayPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TodayInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.record.today.TodayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayInstance - """ - return TodayInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TodayPage>' - - -class TodayInstance(InstanceResource): - """ """ - - class Category(object): - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IP_MESSAGING = "ip-messaging" - IP_MESSAGING_COMMANDS = "ip-messaging-commands" - IP_MESSAGING_DATA_STORAGE = "ip-messaging-data-storage" - IP_MESSAGING_DATA_TRANSFER = "ip-messaging-data-transfer" - IP_MESSAGING_ENDPOINT_CONNECTIVITY = "ip-messaging-endpoint-connectivity" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_ACTIONS = "pchat-actions" - PCHAT_APS = "pchat-aps" - PCHAT_NOTIFICATIONS = "pchat-notifications" - PCHAT_READS = "pchat-reads" - PCHAT_USERS = "pchat-users" - PCHAT_MESSAGES = "pchat-messages" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PV = "pv" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VIDEO_RECORDINGS = "video-recordings" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_AUDIO_TRACE = "voice-insights-audio-trace" - VOICE_INSIGHTS_CARRIER_CALLS = "voice-insights-carrier-calls" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - - def __init__(self, version, payload, account_sid): - """ - Initialize the TodayInstance - - :returns: twilio.rest.api.v2010.account.usage.record.today.TodayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayInstance - """ - super(TodayInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'category': payload['category'], - 'count': payload['count'], - 'count_unit': payload['count_unit'], - 'description': payload['description'], - 'end_date': deserialize.iso8601_date(payload['end_date']), - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'start_date': deserialize.iso8601_date(payload['start_date']), - 'subresource_uris': payload['subresource_uris'], - 'uri': payload['uri'], - 'usage': payload['usage'], - 'usage_unit': payload['usage_unit'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def category(self): - """ - :returns: The category - :rtype: TodayInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The count - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The count_unit - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: The description - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The end_date - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The price - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The start_date - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The usage_unit - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TodayInstance>' diff --git a/twilio/rest/api/v2010/account/usage/record/yearly.py b/twilio/rest/api/v2010/account/usage/record/yearly.py deleted file mode 100644 index a19fff3..0000000 --- a/twilio/rest/api/v2010/account/usage/record/yearly.py +++ /dev/null @@ -1,580 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class YearlyList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the YearlyList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.yearly.YearlyList - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyList - """ - super(YearlyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/Yearly.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Streams YearlyInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param YearlyInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.yearly.YearlyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Lists YearlyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param YearlyInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.yearly.YearlyInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of YearlyInstance records from the API. - Request is executed immediately - - :param YearlyInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of YearlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyPage - """ - params = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return YearlyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of YearlyInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of YearlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return YearlyPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.YearlyList>' - - -class YearlyPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the YearlyPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.yearly.YearlyPage - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyPage - """ - super(YearlyPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of YearlyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.record.yearly.YearlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyInstance - """ - return YearlyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.YearlyPage>' - - -class YearlyInstance(InstanceResource): - """ """ - - class Category(object): - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IP_MESSAGING = "ip-messaging" - IP_MESSAGING_COMMANDS = "ip-messaging-commands" - IP_MESSAGING_DATA_STORAGE = "ip-messaging-data-storage" - IP_MESSAGING_DATA_TRANSFER = "ip-messaging-data-transfer" - IP_MESSAGING_ENDPOINT_CONNECTIVITY = "ip-messaging-endpoint-connectivity" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_ACTIONS = "pchat-actions" - PCHAT_APS = "pchat-aps" - PCHAT_NOTIFICATIONS = "pchat-notifications" - PCHAT_READS = "pchat-reads" - PCHAT_USERS = "pchat-users" - PCHAT_MESSAGES = "pchat-messages" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PV = "pv" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VIDEO_RECORDINGS = "video-recordings" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_AUDIO_TRACE = "voice-insights-audio-trace" - VOICE_INSIGHTS_CARRIER_CALLS = "voice-insights-carrier-calls" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - - def __init__(self, version, payload, account_sid): - """ - Initialize the YearlyInstance - - :returns: twilio.rest.api.v2010.account.usage.record.yearly.YearlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyInstance - """ - super(YearlyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'category': payload['category'], - 'count': payload['count'], - 'count_unit': payload['count_unit'], - 'description': payload['description'], - 'end_date': deserialize.iso8601_date(payload['end_date']), - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'start_date': deserialize.iso8601_date(payload['start_date']), - 'subresource_uris': payload['subresource_uris'], - 'uri': payload['uri'], - 'usage': payload['usage'], - 'usage_unit': payload['usage_unit'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def category(self): - """ - :returns: The category - :rtype: YearlyInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The count - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The count_unit - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: The description - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The end_date - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The price - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The start_date - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The usage_unit - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.YearlyInstance>' diff --git a/twilio/rest/api/v2010/account/usage/record/yesterday.py b/twilio/rest/api/v2010/account/usage/record/yesterday.py deleted file mode 100644 index 045faed..0000000 --- a/twilio/rest/api/v2010/account/usage/record/yesterday.py +++ /dev/null @@ -1,580 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class YesterdayList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the YesterdayList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayList - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayList - """ - super(YesterdayList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/Yesterday.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Streams YesterdayInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param YesterdayInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Lists YesterdayInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param YesterdayInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of YesterdayInstance records from the API. - Request is executed immediately - - :param YesterdayInstance.Category category: The category - :param date start_date: The start_date - :param date end_date: The end_date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of YesterdayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayPage - """ - params = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return YesterdayPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of YesterdayInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of YesterdayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return YesterdayPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.YesterdayList>' - - -class YesterdayPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the YesterdayPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayPage - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayPage - """ - super(YesterdayPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of YesterdayInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayInstance - """ - return YesterdayInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.YesterdayPage>' - - -class YesterdayInstance(InstanceResource): - """ """ - - class Category(object): - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IP_MESSAGING = "ip-messaging" - IP_MESSAGING_COMMANDS = "ip-messaging-commands" - IP_MESSAGING_DATA_STORAGE = "ip-messaging-data-storage" - IP_MESSAGING_DATA_TRANSFER = "ip-messaging-data-transfer" - IP_MESSAGING_ENDPOINT_CONNECTIVITY = "ip-messaging-endpoint-connectivity" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_ACTIONS = "pchat-actions" - PCHAT_APS = "pchat-aps" - PCHAT_NOTIFICATIONS = "pchat-notifications" - PCHAT_READS = "pchat-reads" - PCHAT_USERS = "pchat-users" - PCHAT_MESSAGES = "pchat-messages" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PV = "pv" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VIDEO_RECORDINGS = "video-recordings" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_AUDIO_TRACE = "voice-insights-audio-trace" - VOICE_INSIGHTS_CARRIER_CALLS = "voice-insights-carrier-calls" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - - def __init__(self, version, payload, account_sid): - """ - Initialize the YesterdayInstance - - :returns: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayInstance - """ - super(YesterdayInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'category': payload['category'], - 'count': payload['count'], - 'count_unit': payload['count_unit'], - 'description': payload['description'], - 'end_date': deserialize.iso8601_date(payload['end_date']), - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'start_date': deserialize.iso8601_date(payload['start_date']), - 'subresource_uris': payload['subresource_uris'], - 'uri': payload['uri'], - 'usage': payload['usage'], - 'usage_unit': payload['usage_unit'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def category(self): - """ - :returns: The category - :rtype: YesterdayInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The count - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The count_unit - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: The description - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The end_date - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The price - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The start_date - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: The subresource_uris - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The uri - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The usage_unit - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.YesterdayInstance>' diff --git a/twilio/rest/api/v2010/account/usage/trigger.py b/twilio/rest/api/v2010/account/usage/trigger.py deleted file mode 100644 index e5c62f9..0000000 --- a/twilio/rest/api/v2010/account/usage/trigger.py +++ /dev/null @@ -1,813 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class TriggerList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the TriggerList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerList - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerList - """ - super(TriggerList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Triggers.json'.format(**self._solution) - - def create(self, callback_url, trigger_value, usage_category, - callback_method=values.unset, friendly_name=values.unset, - recurring=values.unset, trigger_by=values.unset): - """ - Create a new TriggerInstance - - :param unicode callback_url: URL Twilio will request when the trigger fires - :param unicode trigger_value: the value at which the trigger will fire - :param TriggerInstance.UsageCategory usage_category: The usage category the trigger watches - :param unicode callback_method: HTTP method to use with callback_url - :param unicode friendly_name: A user-specified, human-readable name for the trigger. - :param TriggerInstance.Recurring recurring: How this trigger recurs - :param TriggerInstance.TriggerField trigger_by: The field in the UsageRecord that fires the trigger - - :returns: Newly created TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - """ - data = values.of({ - 'CallbackUrl': callback_url, - 'TriggerValue': trigger_value, - 'UsageCategory': usage_category, - 'CallbackMethod': callback_method, - 'FriendlyName': friendly_name, - 'Recurring': recurring, - 'TriggerBy': trigger_by, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return TriggerInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def stream(self, recurring=values.unset, trigger_by=values.unset, - usage_category=values.unset, limit=None, page_size=None): - """ - Streams TriggerInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param TriggerInstance.Recurring recurring: Filter by recurring - :param TriggerInstance.TriggerField trigger_by: Filter by trigger by - :param TriggerInstance.UsageCategory usage_category: Filter by Usage Category - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.trigger.TriggerInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - recurring=recurring, - trigger_by=trigger_by, - usage_category=usage_category, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, recurring=values.unset, trigger_by=values.unset, - usage_category=values.unset, limit=None, page_size=None): - """ - Lists TriggerInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param TriggerInstance.Recurring recurring: Filter by recurring - :param TriggerInstance.TriggerField trigger_by: Filter by trigger by - :param TriggerInstance.UsageCategory usage_category: Filter by Usage Category - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.trigger.TriggerInstance] - """ - return list(self.stream( - recurring=recurring, - trigger_by=trigger_by, - usage_category=usage_category, - limit=limit, - page_size=page_size, - )) - - def page(self, recurring=values.unset, trigger_by=values.unset, - usage_category=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of TriggerInstance records from the API. - Request is executed immediately - - :param TriggerInstance.Recurring recurring: Filter by recurring - :param TriggerInstance.TriggerField trigger_by: Filter by trigger by - :param TriggerInstance.UsageCategory usage_category: Filter by Usage Category - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerPage - """ - params = values.of({ - 'Recurring': recurring, - 'TriggerBy': trigger_by, - 'UsageCategory': usage_category, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return TriggerPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TriggerInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TriggerPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a TriggerContext - - :param sid: Fetch by unique usage-trigger Sid - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - """ - return TriggerContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TriggerContext - - :param sid: Fetch by unique usage-trigger Sid - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - """ - return TriggerContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TriggerList>' - - -class TriggerPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TriggerPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerPage - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerPage - """ - super(TriggerPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TriggerInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - """ - return TriggerInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.TriggerPage>' - - -class TriggerContext(InstanceContext): - """ """ - - def __init__(self, version, account_sid, sid): - """ - Initialize the TriggerContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: Fetch by unique usage-trigger Sid - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - """ - super(TriggerContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Usage/Triggers/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch a TriggerInstance - - :returns: Fetched TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return TriggerInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, callback_method=values.unset, callback_url=values.unset, - friendly_name=values.unset): - """ - Update the TriggerInstance - - :param unicode callback_method: HTTP method to use with callback_url - :param unicode callback_url: URL Twilio will request when the trigger fires - :param unicode friendly_name: A user-specified, human-readable name for the trigger. - - :returns: Updated TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - """ - data = values.of({ - 'CallbackMethod': callback_method, - 'CallbackUrl': callback_url, - 'FriendlyName': friendly_name, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return TriggerInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the TriggerInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.TriggerContext {}>'.format(context) - - -class TriggerInstance(InstanceResource): - """ """ - - class UsageCategory(object): - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IP_MESSAGING = "ip-messaging" - IP_MESSAGING_COMMANDS = "ip-messaging-commands" - IP_MESSAGING_DATA_STORAGE = "ip-messaging-data-storage" - IP_MESSAGING_DATA_TRANSFER = "ip-messaging-data-transfer" - IP_MESSAGING_ENDPOINT_CONNECTIVITY = "ip-messaging-endpoint-connectivity" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_ACTIONS = "pchat-actions" - PCHAT_APS = "pchat-aps" - PCHAT_NOTIFICATIONS = "pchat-notifications" - PCHAT_READS = "pchat-reads" - PCHAT_USERS = "pchat-users" - PCHAT_MESSAGES = "pchat-messages" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PV = "pv" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VIDEO_RECORDINGS = "video-recordings" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_AUDIO_TRACE = "voice-insights-audio-trace" - VOICE_INSIGHTS_CARRIER_CALLS = "voice-insights-carrier-calls" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - - class Recurring(object): - DAILY = "daily" - MONTHLY = "monthly" - YEARLY = "yearly" - ALLTIME = "alltime" - - class TriggerField(object): - COUNT = "count" - USAGE = "usage" - PRICE = "price" - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the TriggerInstance - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - """ - super(TriggerInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'api_version': payload['api_version'], - 'callback_method': payload['callback_method'], - 'callback_url': payload['callback_url'], - 'current_value': payload['current_value'], - 'date_created': deserialize.rfc2822_datetime(payload['date_created']), - 'date_fired': deserialize.rfc2822_datetime(payload['date_fired']), - 'date_updated': deserialize.rfc2822_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'recurring': payload['recurring'], - 'sid': payload['sid'], - 'trigger_by': payload['trigger_by'], - 'trigger_value': payload['trigger_value'], - 'uri': payload['uri'], - 'usage_category': payload['usage_category'], - 'usage_record_uri': payload['usage_record_uri'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TriggerContext for this TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - """ - if self._context is None: - self._context = TriggerContext( - self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account this trigger monitors. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def callback_method(self): - """ - :returns: HTTP method to use with callback_url - :rtype: unicode - """ - return self._properties['callback_method'] - - @property - def callback_url(self): - """ - :returns: URL Twilio will request when the trigger fires - :rtype: unicode - """ - return self._properties['callback_url'] - - @property - def current_value(self): - """ - :returns: The current value of the field the trigger is watching. - :rtype: unicode - """ - return self._properties['current_value'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_fired(self): - """ - :returns: The date the trigger was last fired - :rtype: datetime - """ - return self._properties['date_fired'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: A user-specified, human-readable name for the trigger. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def recurring(self): - """ - :returns: How this trigger recurs - :rtype: TriggerInstance.Recurring - """ - return self._properties['recurring'] - - @property - def sid(self): - """ - :returns: The trigger's unique Sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def trigger_by(self): - """ - :returns: The field in the UsageRecord that fires the trigger - :rtype: TriggerInstance.TriggerField - """ - return self._properties['trigger_by'] - - @property - def trigger_value(self): - """ - :returns: the value at which the trigger will fire - :rtype: unicode - """ - return self._properties['trigger_value'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage_category(self): - """ - :returns: The usage category the trigger watches - :rtype: TriggerInstance.UsageCategory - """ - return self._properties['usage_category'] - - @property - def usage_record_uri(self): - """ - :returns: The URI of the UsageRecord this trigger is watching - :rtype: unicode - """ - return self._properties['usage_record_uri'] - - def fetch(self): - """ - Fetch a TriggerInstance - - :returns: Fetched TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - """ - return self._proxy.fetch() - - def update(self, callback_method=values.unset, callback_url=values.unset, - friendly_name=values.unset): - """ - Update the TriggerInstance - - :param unicode callback_method: HTTP method to use with callback_url - :param unicode callback_url: URL Twilio will request when the trigger fires - :param unicode friendly_name: A user-specified, human-readable name for the trigger. - - :returns: Updated TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - """ - return self._proxy.update( - callback_method=callback_method, - callback_url=callback_url, - friendly_name=friendly_name, - ) - - def delete(self): - """ - Deletes the TriggerInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Api.V2010.TriggerInstance {}>'.format(context) diff --git a/twilio/rest/api/v2010/account/validation_request.py b/twilio/rest/api/v2010/account/validation_request.py deleted file mode 100644 index cff599a..0000000 --- a/twilio/rest/api/v2010/account/validation_request.py +++ /dev/null @@ -1,190 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ValidationRequestList(ListResource): - """ """ - - def __init__(self, version, account_sid): - """ - Initialize the ValidationRequestList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - - :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - """ - super(ValidationRequestList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/OutgoingCallerIds.json'.format(**self._solution) - - def create(self, phone_number, friendly_name=values.unset, - call_delay=values.unset, extension=values.unset, - status_callback=values.unset, status_callback_method=values.unset): - """ - Create a new ValidationRequestInstance - - :param unicode phone_number: The phone_number - :param unicode friendly_name: The friendly_name - :param unicode call_delay: The call_delay - :param unicode extension: The extension - :param unicode status_callback: The status_callback - :param unicode status_callback_method: The status_callback_method - - :returns: Newly created ValidationRequestInstance - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestInstance - """ - data = values.of({ - 'PhoneNumber': phone_number, - 'FriendlyName': friendly_name, - 'CallDelay': call_delay, - 'Extension': extension, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ValidationRequestInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ValidationRequestList>' - - -class ValidationRequestPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ValidationRequestPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - - :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestPage - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestPage - """ - super(ValidationRequestPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ValidationRequestInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestInstance - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestInstance - """ - return ValidationRequestInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ValidationRequestPage>' - - -class ValidationRequestInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, account_sid): - """ - Initialize the ValidationRequestInstance - - :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestInstance - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestInstance - """ - super(ValidationRequestInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'phone_number': payload['phone_number'], - 'friendly_name': payload['friendly_name'], - 'validation_code': deserialize.integer(payload['validation_code']), - 'call_sid': payload['call_sid'], - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def validation_code(self): - """ - :returns: The validation_code - :rtype: unicode - """ - return self._properties['validation_code'] - - @property - def call_sid(self): - """ - :returns: The call_sid - :rtype: unicode - """ - return self._properties['call_sid'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Api.V2010.ValidationRequestInstance>' diff --git a/twilio/rest/chat/__init__.py b/twilio/rest/chat/__init__.py deleted file mode 100644 index e295113..0000000 --- a/twilio/rest/chat/__init__.py +++ /dev/null @@ -1,72 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.chat.v1 import V1 -from twilio.rest.chat.v2 import V2 - - -class Chat(Domain): - - def __init__(self, twilio): - """ - Initialize the Chat Domain - - :returns: Domain for Chat - :rtype: twilio.rest.chat.Chat - """ - super(Chat, self).__init__(twilio) - - self.base_url = 'https://chat.twilio.com' - - # Versions - self._v1 = None - self._v2 = None - - @property - def v1(self): - """ - :returns: Version v1 of chat - :rtype: twilio.rest.chat.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def v2(self): - """ - :returns: Version v2 of chat - :rtype: twilio.rest.chat.v2.V2 - """ - if self._v2 is None: - self._v2 = V2(self) - return self._v2 - - @property - def credentials(self): - """ - :rtype: twilio.rest.chat.v2.credential.CredentialList - """ - return self.v2.credentials - - @property - def services(self): - """ - :rtype: twilio.rest.chat.v2.service.ServiceList - """ - return self.v2.services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat>' diff --git a/twilio/rest/chat/__pycache__/__init__.cpython-36.pyc b/twilio/rest/chat/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index dfb7617..0000000 Binary files a/twilio/rest/chat/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v1/__init__.py b/twilio/rest/chat/v1/__init__.py deleted file mode 100644 index 44d2dab..0000000 --- a/twilio/rest/chat/v1/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.chat.v1.credential import CredentialList -from twilio.rest.chat.v1.service import ServiceList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Chat - - :returns: V1 version of Chat - :rtype: twilio.rest.chat.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._credentials = None - self._services = None - - @property - def credentials(self): - """ - :rtype: twilio.rest.chat.v1.credential.CredentialList - """ - if self._credentials is None: - self._credentials = CredentialList(self) - return self._credentials - - @property - def services(self): - """ - :rtype: twilio.rest.chat.v1.service.ServiceList - """ - if self._services is None: - self._services = ServiceList(self) - return self._services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1>' diff --git a/twilio/rest/chat/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/chat/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index bb468eb..0000000 Binary files a/twilio/rest/chat/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v1/__pycache__/credential.cpython-36.pyc b/twilio/rest/chat/v1/__pycache__/credential.cpython-36.pyc deleted file mode 100644 index 164a362..0000000 Binary files a/twilio/rest/chat/v1/__pycache__/credential.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v1/credential.py b/twilio/rest/chat/v1/credential.py deleted file mode 100644 index 74f6551..0000000 --- a/twilio/rest/chat/v1/credential.py +++ /dev/null @@ -1,472 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class CredentialList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the CredentialList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.chat.v1.credential.CredentialList - :rtype: twilio.rest.chat.v1.credential.CredentialList - """ - super(CredentialList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Credentials'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.credential.CredentialInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.credential.CredentialInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CredentialPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialPage(self._version, response, self._solution) - - def create(self, type, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Create a new CredentialInstance - - :param CredentialInstance.PushService type: The type - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Newly created CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - data = values.of({ - 'Type': type, - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CredentialInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a CredentialContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.credential.CredentialContext - :rtype: twilio.rest.chat.v1.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CredentialContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.credential.CredentialContext - :rtype: twilio.rest.chat.v1.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.CredentialList>' - - -class CredentialPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the CredentialPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.chat.v1.credential.CredentialPage - :rtype: twilio.rest.chat.v1.credential.CredentialPage - """ - super(CredentialPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.credential.CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - return CredentialInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.CredentialPage>' - - -class CredentialContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the CredentialContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.chat.v1.credential.CredentialContext - :rtype: twilio.rest.chat.v1.credential.CredentialContext - """ - super(CredentialContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Credentials/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a CredentialInstance - - :returns: Fetched CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Updated CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.CredentialContext {}>'.format(context) - - -class CredentialInstance(InstanceResource): - """ """ - - class PushService(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - - def __init__(self, version, payload, sid=None): - """ - Initialize the CredentialInstance - - :returns: twilio.rest.chat.v1.credential.CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - super(CredentialInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'type': payload['type'], - 'sandbox': payload['sandbox'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialContext for this CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialContext - """ - if self._context is None: - self._context = CredentialContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type - :rtype: CredentialInstance.PushService - """ - return self._properties['type'] - - @property - def sandbox(self): - """ - :returns: The sandbox - :rtype: unicode - """ - return self._properties['sandbox'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a CredentialInstance - - :returns: Fetched CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Updated CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - certificate=certificate, - private_key=private_key, - sandbox=sandbox, - api_key=api_key, - secret=secret, - ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.CredentialInstance {}>'.format(context) diff --git a/twilio/rest/chat/v1/service/__init__.py b/twilio/rest/chat/v1/service/__init__.py deleted file mode 100644 index f011097..0000000 --- a/twilio/rest/chat/v1/service/__init__.py +++ /dev/null @@ -1,1027 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.chat.v1.service.channel import ChannelList -from twilio.rest.chat.v1.service.role import RoleList -from twilio.rest.chat.v1.service.user import UserList - - -class ServiceList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.chat.v1.service.ServiceList - :rtype: twilio.rest.chat.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name): - """ - Create a new ServiceInstance - - :param unicode friendly_name: The friendly_name - - :returns: Newly created ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServicePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.ServiceContext - :rtype: twilio.rest.chat.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.ServiceContext - :rtype: twilio.rest.chat.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.ServiceList>' - - -class ServicePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.chat.v1.service.ServicePage - :rtype: twilio.rest.chat.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.ServicePage>' - - -class ServiceContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.ServiceContext - :rtype: twilio.rest.chat.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._channels = None - self._roles = None - self._users = None - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - webhooks_on_message_send_url=values.unset, - webhooks_on_message_send_method=values.unset, - webhooks_on_message_send_format=values.unset, - webhooks_on_message_update_url=values.unset, - webhooks_on_message_update_method=values.unset, - webhooks_on_message_update_format=values.unset, - webhooks_on_message_remove_url=values.unset, - webhooks_on_message_remove_method=values.unset, - webhooks_on_message_remove_format=values.unset, - webhooks_on_channel_add_url=values.unset, - webhooks_on_channel_add_method=values.unset, - webhooks_on_channel_add_format=values.unset, - webhooks_on_channel_destroy_url=values.unset, - webhooks_on_channel_destroy_method=values.unset, - webhooks_on_channel_destroy_format=values.unset, - webhooks_on_channel_update_url=values.unset, - webhooks_on_channel_update_method=values.unset, - webhooks_on_channel_update_format=values.unset, - webhooks_on_member_add_url=values.unset, - webhooks_on_member_add_method=values.unset, - webhooks_on_member_add_format=values.unset, - webhooks_on_member_remove_url=values.unset, - webhooks_on_member_remove_method=values.unset, - webhooks_on_member_remove_format=values.unset, - webhooks_on_message_sent_url=values.unset, - webhooks_on_message_sent_method=values.unset, - webhooks_on_message_sent_format=values.unset, - webhooks_on_message_updated_url=values.unset, - webhooks_on_message_updated_method=values.unset, - webhooks_on_message_updated_format=values.unset, - webhooks_on_message_removed_url=values.unset, - webhooks_on_message_removed_method=values.unset, - webhooks_on_message_removed_format=values.unset, - webhooks_on_channel_added_url=values.unset, - webhooks_on_channel_added_method=values.unset, - webhooks_on_channel_added_format=values.unset, - webhooks_on_channel_destroyed_url=values.unset, - webhooks_on_channel_destroyed_method=values.unset, - webhooks_on_channel_destroyed_format=values.unset, - webhooks_on_channel_updated_url=values.unset, - webhooks_on_channel_updated_method=values.unset, - webhooks_on_channel_updated_format=values.unset, - webhooks_on_member_added_url=values.unset, - webhooks_on_member_added_method=values.unset, - webhooks_on_member_added_format=values.unset, - webhooks_on_member_removed_url=values.unset, - webhooks_on_member_removed_method=values.unset, - webhooks_on_member_removed_format=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode default_service_role_sid: The default_service_role_sid - :param unicode default_channel_role_sid: The default_channel_role_sid - :param unicode default_channel_creator_role_sid: The default_channel_creator_role_sid - :param bool read_status_enabled: The read_status_enabled - :param bool reachability_enabled: The reachability_enabled - :param unicode typing_indicator_timeout: The typing_indicator_timeout - :param unicode consumption_report_interval: The consumption_report_interval - :param bool notifications_new_message_enabled: The notifications.new_message.enabled - :param unicode notifications_new_message_template: The notifications.new_message.template - :param bool notifications_added_to_channel_enabled: The notifications.added_to_channel.enabled - :param unicode notifications_added_to_channel_template: The notifications.added_to_channel.template - :param bool notifications_removed_from_channel_enabled: The notifications.removed_from_channel.enabled - :param unicode notifications_removed_from_channel_template: The notifications.removed_from_channel.template - :param bool notifications_invited_to_channel_enabled: The notifications.invited_to_channel.enabled - :param unicode notifications_invited_to_channel_template: The notifications.invited_to_channel.template - :param unicode pre_webhook_url: The pre_webhook_url - :param unicode post_webhook_url: The post_webhook_url - :param unicode webhook_method: The webhook_method - :param unicode webhook_filters: The webhook_filters - :param unicode webhooks_on_message_send_url: The webhooks.on_message_send.url - :param unicode webhooks_on_message_send_method: The webhooks.on_message_send.method - :param unicode webhooks_on_message_send_format: The webhooks.on_message_send.format - :param unicode webhooks_on_message_update_url: The webhooks.on_message_update.url - :param unicode webhooks_on_message_update_method: The webhooks.on_message_update.method - :param unicode webhooks_on_message_update_format: The webhooks.on_message_update.format - :param unicode webhooks_on_message_remove_url: The webhooks.on_message_remove.url - :param unicode webhooks_on_message_remove_method: The webhooks.on_message_remove.method - :param unicode webhooks_on_message_remove_format: The webhooks.on_message_remove.format - :param unicode webhooks_on_channel_add_url: The webhooks.on_channel_add.url - :param unicode webhooks_on_channel_add_method: The webhooks.on_channel_add.method - :param unicode webhooks_on_channel_add_format: The webhooks.on_channel_add.format - :param unicode webhooks_on_channel_destroy_url: The webhooks.on_channel_destroy.url - :param unicode webhooks_on_channel_destroy_method: The webhooks.on_channel_destroy.method - :param unicode webhooks_on_channel_destroy_format: The webhooks.on_channel_destroy.format - :param unicode webhooks_on_channel_update_url: The webhooks.on_channel_update.url - :param unicode webhooks_on_channel_update_method: The webhooks.on_channel_update.method - :param unicode webhooks_on_channel_update_format: The webhooks.on_channel_update.format - :param unicode webhooks_on_member_add_url: The webhooks.on_member_add.url - :param unicode webhooks_on_member_add_method: The webhooks.on_member_add.method - :param unicode webhooks_on_member_add_format: The webhooks.on_member_add.format - :param unicode webhooks_on_member_remove_url: The webhooks.on_member_remove.url - :param unicode webhooks_on_member_remove_method: The webhooks.on_member_remove.method - :param unicode webhooks_on_member_remove_format: The webhooks.on_member_remove.format - :param unicode webhooks_on_message_sent_url: The webhooks.on_message_sent.url - :param unicode webhooks_on_message_sent_method: The webhooks.on_message_sent.method - :param unicode webhooks_on_message_sent_format: The webhooks.on_message_sent.format - :param unicode webhooks_on_message_updated_url: The webhooks.on_message_updated.url - :param unicode webhooks_on_message_updated_method: The webhooks.on_message_updated.method - :param unicode webhooks_on_message_updated_format: The webhooks.on_message_updated.format - :param unicode webhooks_on_message_removed_url: The webhooks.on_message_removed.url - :param unicode webhooks_on_message_removed_method: The webhooks.on_message_removed.method - :param unicode webhooks_on_message_removed_format: The webhooks.on_message_removed.format - :param unicode webhooks_on_channel_added_url: The webhooks.on_channel_added.url - :param unicode webhooks_on_channel_added_method: The webhooks.on_channel_added.method - :param unicode webhooks_on_channel_added_format: The webhooks.on_channel_added.format - :param unicode webhooks_on_channel_destroyed_url: The webhooks.on_channel_destroyed.url - :param unicode webhooks_on_channel_destroyed_method: The webhooks.on_channel_destroyed.method - :param unicode webhooks_on_channel_destroyed_format: The webhooks.on_channel_destroyed.format - :param unicode webhooks_on_channel_updated_url: The webhooks.on_channel_updated.url - :param unicode webhooks_on_channel_updated_method: The webhooks.on_channel_updated.method - :param unicode webhooks_on_channel_updated_format: The webhooks.on_channel_updated.format - :param unicode webhooks_on_member_added_url: The webhooks.on_member_added.url - :param unicode webhooks_on_member_added_method: The webhooks.on_member_added.method - :param unicode webhooks_on_member_added_format: The webhooks.on_member_added.format - :param unicode webhooks_on_member_removed_url: The webhooks.on_member_removed.url - :param unicode webhooks_on_member_removed_method: The webhooks.on_member_removed.method - :param unicode webhooks_on_member_removed_format: The webhooks.on_member_removed.format - :param unicode limits_channel_members: The limits.channel_members - :param unicode limits_user_channels: The limits.user_channels - - :returns: Updated ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'DefaultServiceRoleSid': default_service_role_sid, - 'DefaultChannelRoleSid': default_channel_role_sid, - 'DefaultChannelCreatorRoleSid': default_channel_creator_role_sid, - 'ReadStatusEnabled': read_status_enabled, - 'ReachabilityEnabled': reachability_enabled, - 'TypingIndicatorTimeout': typing_indicator_timeout, - 'ConsumptionReportInterval': consumption_report_interval, - 'Notifications.NewMessage.Enabled': notifications_new_message_enabled, - 'Notifications.NewMessage.Template': notifications_new_message_template, - 'Notifications.AddedToChannel.Enabled': notifications_added_to_channel_enabled, - 'Notifications.AddedToChannel.Template': notifications_added_to_channel_template, - 'Notifications.RemovedFromChannel.Enabled': notifications_removed_from_channel_enabled, - 'Notifications.RemovedFromChannel.Template': notifications_removed_from_channel_template, - 'Notifications.InvitedToChannel.Enabled': notifications_invited_to_channel_enabled, - 'Notifications.InvitedToChannel.Template': notifications_invited_to_channel_template, - 'PreWebhookUrl': pre_webhook_url, - 'PostWebhookUrl': post_webhook_url, - 'WebhookMethod': webhook_method, - 'WebhookFilters': serialize.map(webhook_filters, lambda e: e), - 'Webhooks.OnMessageSend.Url': webhooks_on_message_send_url, - 'Webhooks.OnMessageSend.Method': webhooks_on_message_send_method, - 'Webhooks.OnMessageSend.Format': webhooks_on_message_send_format, - 'Webhooks.OnMessageUpdate.Url': webhooks_on_message_update_url, - 'Webhooks.OnMessageUpdate.Method': webhooks_on_message_update_method, - 'Webhooks.OnMessageUpdate.Format': webhooks_on_message_update_format, - 'Webhooks.OnMessageRemove.Url': webhooks_on_message_remove_url, - 'Webhooks.OnMessageRemove.Method': webhooks_on_message_remove_method, - 'Webhooks.OnMessageRemove.Format': webhooks_on_message_remove_format, - 'Webhooks.OnChannelAdd.Url': webhooks_on_channel_add_url, - 'Webhooks.OnChannelAdd.Method': webhooks_on_channel_add_method, - 'Webhooks.OnChannelAdd.Format': webhooks_on_channel_add_format, - 'Webhooks.OnChannelDestroy.Url': webhooks_on_channel_destroy_url, - 'Webhooks.OnChannelDestroy.Method': webhooks_on_channel_destroy_method, - 'Webhooks.OnChannelDestroy.Format': webhooks_on_channel_destroy_format, - 'Webhooks.OnChannelUpdate.Url': webhooks_on_channel_update_url, - 'Webhooks.OnChannelUpdate.Method': webhooks_on_channel_update_method, - 'Webhooks.OnChannelUpdate.Format': webhooks_on_channel_update_format, - 'Webhooks.OnMemberAdd.Url': webhooks_on_member_add_url, - 'Webhooks.OnMemberAdd.Method': webhooks_on_member_add_method, - 'Webhooks.OnMemberAdd.Format': webhooks_on_member_add_format, - 'Webhooks.OnMemberRemove.Url': webhooks_on_member_remove_url, - 'Webhooks.OnMemberRemove.Method': webhooks_on_member_remove_method, - 'Webhooks.OnMemberRemove.Format': webhooks_on_member_remove_format, - 'Webhooks.OnMessageSent.Url': webhooks_on_message_sent_url, - 'Webhooks.OnMessageSent.Method': webhooks_on_message_sent_method, - 'Webhooks.OnMessageSent.Format': webhooks_on_message_sent_format, - 'Webhooks.OnMessageUpdated.Url': webhooks_on_message_updated_url, - 'Webhooks.OnMessageUpdated.Method': webhooks_on_message_updated_method, - 'Webhooks.OnMessageUpdated.Format': webhooks_on_message_updated_format, - 'Webhooks.OnMessageRemoved.Url': webhooks_on_message_removed_url, - 'Webhooks.OnMessageRemoved.Method': webhooks_on_message_removed_method, - 'Webhooks.OnMessageRemoved.Format': webhooks_on_message_removed_format, - 'Webhooks.OnChannelAdded.Url': webhooks_on_channel_added_url, - 'Webhooks.OnChannelAdded.Method': webhooks_on_channel_added_method, - 'Webhooks.OnChannelAdded.Format': webhooks_on_channel_added_format, - 'Webhooks.OnChannelDestroyed.Url': webhooks_on_channel_destroyed_url, - 'Webhooks.OnChannelDestroyed.Method': webhooks_on_channel_destroyed_method, - 'Webhooks.OnChannelDestroyed.Format': webhooks_on_channel_destroyed_format, - 'Webhooks.OnChannelUpdated.Url': webhooks_on_channel_updated_url, - 'Webhooks.OnChannelUpdated.Method': webhooks_on_channel_updated_method, - 'Webhooks.OnChannelUpdated.Format': webhooks_on_channel_updated_format, - 'Webhooks.OnMemberAdded.Url': webhooks_on_member_added_url, - 'Webhooks.OnMemberAdded.Method': webhooks_on_member_added_method, - 'Webhooks.OnMemberAdded.Format': webhooks_on_member_added_format, - 'Webhooks.OnMemberRemoved.Url': webhooks_on_member_removed_url, - 'Webhooks.OnMemberRemoved.Method': webhooks_on_member_removed_method, - 'Webhooks.OnMemberRemoved.Format': webhooks_on_member_removed_format, - 'Limits.ChannelMembers': limits_channel_members, - 'Limits.UserChannels': limits_user_channels, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def channels(self): - """ - Access the channels - - :returns: twilio.rest.chat.v1.service.channel.ChannelList - :rtype: twilio.rest.chat.v1.service.channel.ChannelList - """ - if self._channels is None: - self._channels = ChannelList(self._version, service_sid=self._solution['sid'], ) - return self._channels - - @property - def roles(self): - """ - Access the roles - - :returns: twilio.rest.chat.v1.service.role.RoleList - :rtype: twilio.rest.chat.v1.service.role.RoleList - """ - if self._roles is None: - self._roles = RoleList(self._version, service_sid=self._solution['sid'], ) - return self._roles - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.chat.v1.service.user.UserList - :rtype: twilio.rest.chat.v1.service.user.UserList - """ - if self._users is None: - self._users = UserList(self._version, service_sid=self._solution['sid'], ) - return self._users - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.ServiceContext {}>'.format(context) - - -class ServiceInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.chat.v1.service.ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'default_service_role_sid': payload['default_service_role_sid'], - 'default_channel_role_sid': payload['default_channel_role_sid'], - 'default_channel_creator_role_sid': payload['default_channel_creator_role_sid'], - 'read_status_enabled': payload['read_status_enabled'], - 'reachability_enabled': payload['reachability_enabled'], - 'typing_indicator_timeout': deserialize.integer(payload['typing_indicator_timeout']), - 'consumption_report_interval': deserialize.integer(payload['consumption_report_interval']), - 'limits': payload['limits'], - 'webhooks': payload['webhooks'], - 'pre_webhook_url': payload['pre_webhook_url'], - 'post_webhook_url': payload['post_webhook_url'], - 'webhook_method': payload['webhook_method'], - 'webhook_filters': payload['webhook_filters'], - 'notifications': payload['notifications'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceContext - """ - if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def default_service_role_sid(self): - """ - :returns: The default_service_role_sid - :rtype: unicode - """ - return self._properties['default_service_role_sid'] - - @property - def default_channel_role_sid(self): - """ - :returns: The default_channel_role_sid - :rtype: unicode - """ - return self._properties['default_channel_role_sid'] - - @property - def default_channel_creator_role_sid(self): - """ - :returns: The default_channel_creator_role_sid - :rtype: unicode - """ - return self._properties['default_channel_creator_role_sid'] - - @property - def read_status_enabled(self): - """ - :returns: The read_status_enabled - :rtype: bool - """ - return self._properties['read_status_enabled'] - - @property - def reachability_enabled(self): - """ - :returns: The reachability_enabled - :rtype: bool - """ - return self._properties['reachability_enabled'] - - @property - def typing_indicator_timeout(self): - """ - :returns: The typing_indicator_timeout - :rtype: unicode - """ - return self._properties['typing_indicator_timeout'] - - @property - def consumption_report_interval(self): - """ - :returns: The consumption_report_interval - :rtype: unicode - """ - return self._properties['consumption_report_interval'] - - @property - def limits(self): - """ - :returns: The limits - :rtype: dict - """ - return self._properties['limits'] - - @property - def webhooks(self): - """ - :returns: The webhooks - :rtype: dict - """ - return self._properties['webhooks'] - - @property - def pre_webhook_url(self): - """ - :returns: The pre_webhook_url - :rtype: unicode - """ - return self._properties['pre_webhook_url'] - - @property - def post_webhook_url(self): - """ - :returns: The post_webhook_url - :rtype: unicode - """ - return self._properties['post_webhook_url'] - - @property - def webhook_method(self): - """ - :returns: The webhook_method - :rtype: unicode - """ - return self._properties['webhook_method'] - - @property - def webhook_filters(self): - """ - :returns: The webhook_filters - :rtype: unicode - """ - return self._properties['webhook_filters'] - - @property - def notifications(self): - """ - :returns: The notifications - :rtype: dict - """ - return self._properties['notifications'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - webhooks_on_message_send_url=values.unset, - webhooks_on_message_send_method=values.unset, - webhooks_on_message_send_format=values.unset, - webhooks_on_message_update_url=values.unset, - webhooks_on_message_update_method=values.unset, - webhooks_on_message_update_format=values.unset, - webhooks_on_message_remove_url=values.unset, - webhooks_on_message_remove_method=values.unset, - webhooks_on_message_remove_format=values.unset, - webhooks_on_channel_add_url=values.unset, - webhooks_on_channel_add_method=values.unset, - webhooks_on_channel_add_format=values.unset, - webhooks_on_channel_destroy_url=values.unset, - webhooks_on_channel_destroy_method=values.unset, - webhooks_on_channel_destroy_format=values.unset, - webhooks_on_channel_update_url=values.unset, - webhooks_on_channel_update_method=values.unset, - webhooks_on_channel_update_format=values.unset, - webhooks_on_member_add_url=values.unset, - webhooks_on_member_add_method=values.unset, - webhooks_on_member_add_format=values.unset, - webhooks_on_member_remove_url=values.unset, - webhooks_on_member_remove_method=values.unset, - webhooks_on_member_remove_format=values.unset, - webhooks_on_message_sent_url=values.unset, - webhooks_on_message_sent_method=values.unset, - webhooks_on_message_sent_format=values.unset, - webhooks_on_message_updated_url=values.unset, - webhooks_on_message_updated_method=values.unset, - webhooks_on_message_updated_format=values.unset, - webhooks_on_message_removed_url=values.unset, - webhooks_on_message_removed_method=values.unset, - webhooks_on_message_removed_format=values.unset, - webhooks_on_channel_added_url=values.unset, - webhooks_on_channel_added_method=values.unset, - webhooks_on_channel_added_format=values.unset, - webhooks_on_channel_destroyed_url=values.unset, - webhooks_on_channel_destroyed_method=values.unset, - webhooks_on_channel_destroyed_format=values.unset, - webhooks_on_channel_updated_url=values.unset, - webhooks_on_channel_updated_method=values.unset, - webhooks_on_channel_updated_format=values.unset, - webhooks_on_member_added_url=values.unset, - webhooks_on_member_added_method=values.unset, - webhooks_on_member_added_format=values.unset, - webhooks_on_member_removed_url=values.unset, - webhooks_on_member_removed_method=values.unset, - webhooks_on_member_removed_format=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode default_service_role_sid: The default_service_role_sid - :param unicode default_channel_role_sid: The default_channel_role_sid - :param unicode default_channel_creator_role_sid: The default_channel_creator_role_sid - :param bool read_status_enabled: The read_status_enabled - :param bool reachability_enabled: The reachability_enabled - :param unicode typing_indicator_timeout: The typing_indicator_timeout - :param unicode consumption_report_interval: The consumption_report_interval - :param bool notifications_new_message_enabled: The notifications.new_message.enabled - :param unicode notifications_new_message_template: The notifications.new_message.template - :param bool notifications_added_to_channel_enabled: The notifications.added_to_channel.enabled - :param unicode notifications_added_to_channel_template: The notifications.added_to_channel.template - :param bool notifications_removed_from_channel_enabled: The notifications.removed_from_channel.enabled - :param unicode notifications_removed_from_channel_template: The notifications.removed_from_channel.template - :param bool notifications_invited_to_channel_enabled: The notifications.invited_to_channel.enabled - :param unicode notifications_invited_to_channel_template: The notifications.invited_to_channel.template - :param unicode pre_webhook_url: The pre_webhook_url - :param unicode post_webhook_url: The post_webhook_url - :param unicode webhook_method: The webhook_method - :param unicode webhook_filters: The webhook_filters - :param unicode webhooks_on_message_send_url: The webhooks.on_message_send.url - :param unicode webhooks_on_message_send_method: The webhooks.on_message_send.method - :param unicode webhooks_on_message_send_format: The webhooks.on_message_send.format - :param unicode webhooks_on_message_update_url: The webhooks.on_message_update.url - :param unicode webhooks_on_message_update_method: The webhooks.on_message_update.method - :param unicode webhooks_on_message_update_format: The webhooks.on_message_update.format - :param unicode webhooks_on_message_remove_url: The webhooks.on_message_remove.url - :param unicode webhooks_on_message_remove_method: The webhooks.on_message_remove.method - :param unicode webhooks_on_message_remove_format: The webhooks.on_message_remove.format - :param unicode webhooks_on_channel_add_url: The webhooks.on_channel_add.url - :param unicode webhooks_on_channel_add_method: The webhooks.on_channel_add.method - :param unicode webhooks_on_channel_add_format: The webhooks.on_channel_add.format - :param unicode webhooks_on_channel_destroy_url: The webhooks.on_channel_destroy.url - :param unicode webhooks_on_channel_destroy_method: The webhooks.on_channel_destroy.method - :param unicode webhooks_on_channel_destroy_format: The webhooks.on_channel_destroy.format - :param unicode webhooks_on_channel_update_url: The webhooks.on_channel_update.url - :param unicode webhooks_on_channel_update_method: The webhooks.on_channel_update.method - :param unicode webhooks_on_channel_update_format: The webhooks.on_channel_update.format - :param unicode webhooks_on_member_add_url: The webhooks.on_member_add.url - :param unicode webhooks_on_member_add_method: The webhooks.on_member_add.method - :param unicode webhooks_on_member_add_format: The webhooks.on_member_add.format - :param unicode webhooks_on_member_remove_url: The webhooks.on_member_remove.url - :param unicode webhooks_on_member_remove_method: The webhooks.on_member_remove.method - :param unicode webhooks_on_member_remove_format: The webhooks.on_member_remove.format - :param unicode webhooks_on_message_sent_url: The webhooks.on_message_sent.url - :param unicode webhooks_on_message_sent_method: The webhooks.on_message_sent.method - :param unicode webhooks_on_message_sent_format: The webhooks.on_message_sent.format - :param unicode webhooks_on_message_updated_url: The webhooks.on_message_updated.url - :param unicode webhooks_on_message_updated_method: The webhooks.on_message_updated.method - :param unicode webhooks_on_message_updated_format: The webhooks.on_message_updated.format - :param unicode webhooks_on_message_removed_url: The webhooks.on_message_removed.url - :param unicode webhooks_on_message_removed_method: The webhooks.on_message_removed.method - :param unicode webhooks_on_message_removed_format: The webhooks.on_message_removed.format - :param unicode webhooks_on_channel_added_url: The webhooks.on_channel_added.url - :param unicode webhooks_on_channel_added_method: The webhooks.on_channel_added.method - :param unicode webhooks_on_channel_added_format: The webhooks.on_channel_added.format - :param unicode webhooks_on_channel_destroyed_url: The webhooks.on_channel_destroyed.url - :param unicode webhooks_on_channel_destroyed_method: The webhooks.on_channel_destroyed.method - :param unicode webhooks_on_channel_destroyed_format: The webhooks.on_channel_destroyed.format - :param unicode webhooks_on_channel_updated_url: The webhooks.on_channel_updated.url - :param unicode webhooks_on_channel_updated_method: The webhooks.on_channel_updated.method - :param unicode webhooks_on_channel_updated_format: The webhooks.on_channel_updated.format - :param unicode webhooks_on_member_added_url: The webhooks.on_member_added.url - :param unicode webhooks_on_member_added_method: The webhooks.on_member_added.method - :param unicode webhooks_on_member_added_format: The webhooks.on_member_added.format - :param unicode webhooks_on_member_removed_url: The webhooks.on_member_removed.url - :param unicode webhooks_on_member_removed_method: The webhooks.on_member_removed.method - :param unicode webhooks_on_member_removed_format: The webhooks.on_member_removed.format - :param unicode limits_channel_members: The limits.channel_members - :param unicode limits_user_channels: The limits.user_channels - - :returns: Updated ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - default_service_role_sid=default_service_role_sid, - default_channel_role_sid=default_channel_role_sid, - default_channel_creator_role_sid=default_channel_creator_role_sid, - read_status_enabled=read_status_enabled, - reachability_enabled=reachability_enabled, - typing_indicator_timeout=typing_indicator_timeout, - consumption_report_interval=consumption_report_interval, - notifications_new_message_enabled=notifications_new_message_enabled, - notifications_new_message_template=notifications_new_message_template, - notifications_added_to_channel_enabled=notifications_added_to_channel_enabled, - notifications_added_to_channel_template=notifications_added_to_channel_template, - notifications_removed_from_channel_enabled=notifications_removed_from_channel_enabled, - notifications_removed_from_channel_template=notifications_removed_from_channel_template, - notifications_invited_to_channel_enabled=notifications_invited_to_channel_enabled, - notifications_invited_to_channel_template=notifications_invited_to_channel_template, - pre_webhook_url=pre_webhook_url, - post_webhook_url=post_webhook_url, - webhook_method=webhook_method, - webhook_filters=webhook_filters, - webhooks_on_message_send_url=webhooks_on_message_send_url, - webhooks_on_message_send_method=webhooks_on_message_send_method, - webhooks_on_message_send_format=webhooks_on_message_send_format, - webhooks_on_message_update_url=webhooks_on_message_update_url, - webhooks_on_message_update_method=webhooks_on_message_update_method, - webhooks_on_message_update_format=webhooks_on_message_update_format, - webhooks_on_message_remove_url=webhooks_on_message_remove_url, - webhooks_on_message_remove_method=webhooks_on_message_remove_method, - webhooks_on_message_remove_format=webhooks_on_message_remove_format, - webhooks_on_channel_add_url=webhooks_on_channel_add_url, - webhooks_on_channel_add_method=webhooks_on_channel_add_method, - webhooks_on_channel_add_format=webhooks_on_channel_add_format, - webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, - webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, - webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, - webhooks_on_channel_update_url=webhooks_on_channel_update_url, - webhooks_on_channel_update_method=webhooks_on_channel_update_method, - webhooks_on_channel_update_format=webhooks_on_channel_update_format, - webhooks_on_member_add_url=webhooks_on_member_add_url, - webhooks_on_member_add_method=webhooks_on_member_add_method, - webhooks_on_member_add_format=webhooks_on_member_add_format, - webhooks_on_member_remove_url=webhooks_on_member_remove_url, - webhooks_on_member_remove_method=webhooks_on_member_remove_method, - webhooks_on_member_remove_format=webhooks_on_member_remove_format, - webhooks_on_message_sent_url=webhooks_on_message_sent_url, - webhooks_on_message_sent_method=webhooks_on_message_sent_method, - webhooks_on_message_sent_format=webhooks_on_message_sent_format, - webhooks_on_message_updated_url=webhooks_on_message_updated_url, - webhooks_on_message_updated_method=webhooks_on_message_updated_method, - webhooks_on_message_updated_format=webhooks_on_message_updated_format, - webhooks_on_message_removed_url=webhooks_on_message_removed_url, - webhooks_on_message_removed_method=webhooks_on_message_removed_method, - webhooks_on_message_removed_format=webhooks_on_message_removed_format, - webhooks_on_channel_added_url=webhooks_on_channel_added_url, - webhooks_on_channel_added_method=webhooks_on_channel_added_method, - webhooks_on_channel_added_format=webhooks_on_channel_added_format, - webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, - webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, - webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, - webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, - webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, - webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, - webhooks_on_member_added_url=webhooks_on_member_added_url, - webhooks_on_member_added_method=webhooks_on_member_added_method, - webhooks_on_member_added_format=webhooks_on_member_added_format, - webhooks_on_member_removed_url=webhooks_on_member_removed_url, - webhooks_on_member_removed_method=webhooks_on_member_removed_method, - webhooks_on_member_removed_format=webhooks_on_member_removed_format, - limits_channel_members=limits_channel_members, - limits_user_channels=limits_user_channels, - ) - - @property - def channels(self): - """ - Access the channels - - :returns: twilio.rest.chat.v1.service.channel.ChannelList - :rtype: twilio.rest.chat.v1.service.channel.ChannelList - """ - return self._proxy.channels - - @property - def roles(self): - """ - Access the roles - - :returns: twilio.rest.chat.v1.service.role.RoleList - :rtype: twilio.rest.chat.v1.service.role.RoleList - """ - return self._proxy.roles - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.chat.v1.service.user.UserList - :rtype: twilio.rest.chat.v1.service.user.UserList - """ - return self._proxy.users - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.ServiceInstance {}>'.format(context) diff --git a/twilio/rest/chat/v1/service/__pycache__/__init__.cpython-36.pyc b/twilio/rest/chat/v1/service/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 5f24dd7..0000000 Binary files a/twilio/rest/chat/v1/service/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v1/service/__pycache__/role.cpython-36.pyc b/twilio/rest/chat/v1/service/__pycache__/role.cpython-36.pyc deleted file mode 100644 index a52a886..0000000 Binary files a/twilio/rest/chat/v1/service/__pycache__/role.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v1/service/channel/__init__.py b/twilio/rest/chat/v1/service/channel/__init__.py deleted file mode 100644 index 48e8424..0000000 --- a/twilio/rest/chat/v1/service/channel/__init__.py +++ /dev/null @@ -1,616 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.chat.v1.service.channel.invite import InviteList -from twilio.rest.chat.v1.service.channel.member import MemberList -from twilio.rest.chat.v1.service.channel.message import MessageList - - -class ChannelList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the ChannelList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v1.service.channel.ChannelList - :rtype: twilio.rest.chat.v1.service.channel.ChannelList - """ - super(ChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Channels'.format(**self._solution) - - def create(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, type=values.unset): - """ - Create a new ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - :param ChannelInstance.ChannelType type: The type - - :returns: Newly created ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - 'Type': type, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, type=values.unset, limit=None, page_size=None): - """ - Streams ChannelInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param ChannelInstance.ChannelType type: The type - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.ChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(type=type, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, type=values.unset, limit=None, page_size=None): - """ - Lists ChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param ChannelInstance.ChannelType type: The type - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.ChannelInstance] - """ - return list(self.stream(type=type, limit=limit, page_size=page_size, )) - - def page(self, type=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ChannelInstance records from the API. - Request is executed immediately - - :param ChannelInstance.ChannelType type: The type - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelPage - """ - params = values.of({ - 'Type': serialize.map(type, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ChannelPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ChannelContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.ChannelContext - :rtype: twilio.rest.chat.v1.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ChannelContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.ChannelContext - :rtype: twilio.rest.chat.v1.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.ChannelList>' - - -class ChannelPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v1.service.channel.ChannelPage - :rtype: twilio.rest.chat.v1.service.channel.ChannelPage - """ - super(ChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.channel.ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.ChannelPage>' - - -class ChannelContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the ChannelContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.ChannelContext - :rtype: twilio.rest.chat.v1.service.channel.ChannelContext - """ - super(ChannelContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{sid}'.format(**self._solution) - - # Dependents - self._members = None - self._messages = None - self._invites = None - - def fetch(self): - """ - Fetch a ChannelInstance - - :returns: Fetched ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the ChannelInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset): - """ - Update the ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - - :returns: Updated ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def members(self): - """ - Access the members - - :returns: twilio.rest.chat.v1.service.channel.member.MemberList - :rtype: twilio.rest.chat.v1.service.channel.member.MemberList - """ - if self._members is None: - self._members = MemberList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._members - - @property - def messages(self): - """ - Access the messages - - :returns: twilio.rest.chat.v1.service.channel.message.MessageList - :rtype: twilio.rest.chat.v1.service.channel.message.MessageList - """ - if self._messages is None: - self._messages = MessageList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._messages - - @property - def invites(self): - """ - Access the invites - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteList - """ - if self._invites is None: - self._invites = InviteList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._invites - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.ChannelContext {}>'.format(context) - - -class ChannelInstance(InstanceResource): - """ """ - - class ChannelType(object): - PUBLIC = "public" - PRIVATE = "private" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ChannelInstance - - :returns: twilio.rest.chat.v1.service.channel.ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - super(ChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'friendly_name': payload['friendly_name'], - 'unique_name': payload['unique_name'], - 'attributes': payload['attributes'], - 'type': payload['type'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - 'members_count': deserialize.integer(payload['members_count']), - 'messages_count': deserialize.integer(payload['messages_count']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ChannelContext for this ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelContext - """ - if self._context is None: - self._context = ChannelContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def type(self): - """ - :returns: The type - :rtype: ChannelInstance.ChannelType - """ - return self._properties['type'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def members_count(self): - """ - :returns: The members_count - :rtype: unicode - """ - return self._properties['members_count'] - - @property - def messages_count(self): - """ - :returns: The messages_count - :rtype: unicode - """ - return self._properties['messages_count'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ChannelInstance - - :returns: Fetched ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ChannelInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset): - """ - Update the ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - - :returns: Updated ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - unique_name=unique_name, - attributes=attributes, - ) - - @property - def members(self): - """ - Access the members - - :returns: twilio.rest.chat.v1.service.channel.member.MemberList - :rtype: twilio.rest.chat.v1.service.channel.member.MemberList - """ - return self._proxy.members - - @property - def messages(self): - """ - Access the messages - - :returns: twilio.rest.chat.v1.service.channel.message.MessageList - :rtype: twilio.rest.chat.v1.service.channel.message.MessageList - """ - return self._proxy.messages - - @property - def invites(self): - """ - Access the invites - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteList - """ - return self._proxy.invites - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.ChannelInstance {}>'.format(context) diff --git a/twilio/rest/chat/v1/service/channel/__pycache__/__init__.cpython-36.pyc b/twilio/rest/chat/v1/service/channel/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index f2e9fc6..0000000 Binary files a/twilio/rest/chat/v1/service/channel/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v1/service/channel/__pycache__/invite.cpython-36.pyc b/twilio/rest/chat/v1/service/channel/__pycache__/invite.cpython-36.pyc deleted file mode 100644 index 2db087a..0000000 Binary files a/twilio/rest/chat/v1/service/channel/__pycache__/invite.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v1/service/channel/__pycache__/member.cpython-36.pyc b/twilio/rest/chat/v1/service/channel/__pycache__/member.cpython-36.pyc deleted file mode 100644 index d4cd9ce..0000000 Binary files a/twilio/rest/chat/v1/service/channel/__pycache__/member.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v1/service/channel/__pycache__/message.cpython-36.pyc b/twilio/rest/chat/v1/service/channel/__pycache__/message.cpython-36.pyc deleted file mode 100644 index 4198552..0000000 Binary files a/twilio/rest/chat/v1/service/channel/__pycache__/message.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v1/service/channel/invite.py b/twilio/rest/chat/v1/service/channel/invite.py deleted file mode 100644 index f12f4fe..0000000 --- a/twilio/rest/chat/v1/service/channel/invite.py +++ /dev/null @@ -1,462 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class InviteList(ListResource): - """ """ - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the InviteList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteList - """ - super(InviteList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Invites'.format(**self._solution) - - def create(self, identity, role_sid=values.unset): - """ - Create a new InviteInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - - :returns: Newly created InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - data = values.of({'Identity': identity, 'RoleSid': role_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, identity=values.unset, limit=None, page_size=None): - """ - Streams InviteInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.invite.InviteInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, identity=values.unset, limit=None, page_size=None): - """ - Lists InviteInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.invite.InviteInstance] - """ - return list(self.stream(identity=identity, limit=limit, page_size=page_size, )) - - def page(self, identity=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of InviteInstance records from the API. - Request is executed immediately - - :param unicode identity: The identity - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InvitePage - """ - params = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return InvitePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of InviteInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InvitePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InvitePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InviteContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteContext - """ - return InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a InviteContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteContext - """ - return InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.InviteList>' - - -class InvitePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the InvitePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v1.service.channel.invite.InvitePage - :rtype: twilio.rest.chat.v1.service.channel.invite.InvitePage - """ - super(InvitePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InviteInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.InvitePage>' - - -class InviteContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the InviteContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteContext - """ - super(InviteContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Invites/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a InviteInstance - - :returns: Fetched InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the InviteInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.InviteContext {}>'.format(context) - - -class InviteInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the InviteInstance - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - super(InviteInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'channel_sid': payload['channel_sid'], - 'service_sid': payload['service_sid'], - 'identity': payload['identity'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'role_sid': payload['role_sid'], - 'created_by': payload['created_by'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InviteContext for this InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteContext - """ - if self._context is None: - self._context = InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a InviteInstance - - :returns: Fetched InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the InviteInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.InviteInstance {}>'.format(context) diff --git a/twilio/rest/chat/v1/service/channel/member.py b/twilio/rest/chat/v1/service/channel/member.py deleted file mode 100644 index 30a3f07..0000000 --- a/twilio/rest/chat/v1/service/channel/member.py +++ /dev/null @@ -1,514 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class MemberList(ListResource): - """ """ - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the MemberList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v1.service.channel.member.MemberList - :rtype: twilio.rest.chat.v1.service.channel.member.MemberList - """ - super(MemberList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Members'.format(**self._solution) - - def create(self, identity, role_sid=values.unset): - """ - Create a new MemberInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - - :returns: Newly created MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - data = values.of({'Identity': identity, 'RoleSid': role_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, identity=values.unset, limit=None, page_size=None): - """ - Streams MemberInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.member.MemberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, identity=values.unset, limit=None, page_size=None): - """ - Lists MemberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.member.MemberInstance] - """ - return list(self.stream(identity=identity, limit=limit, page_size=page_size, )) - - def page(self, identity=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MemberInstance records from the API. - Request is executed immediately - - :param unicode identity: The identity - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberPage - """ - params = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MemberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MemberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MemberPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MemberContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext - """ - return MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MemberContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext - """ - return MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.MemberList>' - - -class MemberPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MemberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v1.service.channel.member.MemberPage - :rtype: twilio.rest.chat.v1.service.channel.member.MemberPage - """ - super(MemberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MemberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.channel.member.MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.MemberPage>' - - -class MemberContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the MemberContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext - """ - super(MemberContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Members/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a MemberInstance - - :returns: Fetched MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the MemberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, role_sid=values.unset, - last_consumed_message_index=values.unset): - """ - Update the MemberInstance - - :param unicode role_sid: The role_sid - :param unicode last_consumed_message_index: The last_consumed_message_index - - :returns: Updated MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - data = values.of({'RoleSid': role_sid, 'LastConsumedMessageIndex': last_consumed_message_index, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.MemberContext {}>'.format(context) - - -class MemberInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the MemberInstance - - :returns: twilio.rest.chat.v1.service.channel.member.MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - super(MemberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'channel_sid': payload['channel_sid'], - 'service_sid': payload['service_sid'], - 'identity': payload['identity'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'role_sid': payload['role_sid'], - 'last_consumed_message_index': deserialize.integer(payload['last_consumed_message_index']), - 'last_consumption_timestamp': deserialize.iso8601_datetime(payload['last_consumption_timestamp']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MemberContext for this MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext - """ - if self._context is None: - self._context = MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def last_consumed_message_index(self): - """ - :returns: The last_consumed_message_index - :rtype: unicode - """ - return self._properties['last_consumed_message_index'] - - @property - def last_consumption_timestamp(self): - """ - :returns: The last_consumption_timestamp - :rtype: datetime - """ - return self._properties['last_consumption_timestamp'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a MemberInstance - - :returns: Fetched MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the MemberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, role_sid=values.unset, - last_consumed_message_index=values.unset): - """ - Update the MemberInstance - - :param unicode role_sid: The role_sid - :param unicode last_consumed_message_index: The last_consumed_message_index - - :returns: Updated MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - return self._proxy.update( - role_sid=role_sid, - last_consumed_message_index=last_consumed_message_index, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.MemberInstance {}>'.format(context) diff --git a/twilio/rest/chat/v1/service/channel/message.py b/twilio/rest/chat/v1/service/channel/message.py deleted file mode 100644 index 44d947b..0000000 --- a/twilio/rest/chat/v1/service/channel/message.py +++ /dev/null @@ -1,531 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class MessageList(ListResource): - """ """ - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the MessageList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v1.service.channel.message.MessageList - :rtype: twilio.rest.chat.v1.service.channel.message.MessageList - """ - super(MessageList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Messages'.format(**self._solution) - - def create(self, body, from_=values.unset, attributes=values.unset): - """ - Create a new MessageInstance - - :param unicode body: The body - :param unicode from_: The from - :param unicode attributes: The attributes - - :returns: Newly created MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - data = values.of({'Body': body, 'From': from_, 'Attributes': attributes, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, order=values.unset, limit=None, page_size=None): - """ - Streams MessageInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param MessageInstance.OrderType order: The order - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.message.MessageInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, order=values.unset, limit=None, page_size=None): - """ - Lists MessageInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param MessageInstance.OrderType order: The order - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.message.MessageInstance] - """ - return list(self.stream(order=order, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MessageInstance records from the API. - Request is executed immediately - - :param MessageInstance.OrderType order: The order - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage - """ - params = values.of({ - 'Order': order, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MessagePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessageInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessagePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MessageContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext - """ - return MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MessageContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext - """ - return MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.MessageList>' - - -class MessagePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MessagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v1.service.channel.message.MessagePage - :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage - """ - super(MessagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessageInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.channel.message.MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.MessagePage>' - - -class MessageContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the MessageContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext - """ - super(MessageContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Messages/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a MessageInstance - - :returns: Fetched MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, body=values.unset, attributes=values.unset): - """ - Update the MessageInstance - - :param unicode body: The body - :param unicode attributes: The attributes - - :returns: Updated MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - data = values.of({'Body': body, 'Attributes': attributes, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.MessageContext {}>'.format(context) - - -class MessageInstance(InstanceResource): - """ """ - - class OrderType(object): - ASC = "asc" - DESC = "desc" - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the MessageInstance - - :returns: twilio.rest.chat.v1.service.channel.message.MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - super(MessageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'attributes': payload['attributes'], - 'service_sid': payload['service_sid'], - 'to': payload['to'], - 'channel_sid': payload['channel_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'was_edited': payload['was_edited'], - 'from_': payload['from'], - 'body': payload['body'], - 'index': deserialize.integer(payload['index']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessageContext for this MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext - """ - if self._context is None: - self._context = MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def to(self): - """ - :returns: The to - :rtype: unicode - """ - return self._properties['to'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def was_edited(self): - """ - :returns: The was_edited - :rtype: bool - """ - return self._properties['was_edited'] - - @property - def from_(self): - """ - :returns: The from - :rtype: unicode - """ - return self._properties['from_'] - - @property - def body(self): - """ - :returns: The body - :rtype: unicode - """ - return self._properties['body'] - - @property - def index(self): - """ - :returns: The index - :rtype: unicode - """ - return self._properties['index'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a MessageInstance - - :returns: Fetched MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, body=values.unset, attributes=values.unset): - """ - Update the MessageInstance - - :param unicode body: The body - :param unicode attributes: The attributes - - :returns: Updated MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - return self._proxy.update(body=body, attributes=attributes, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.MessageInstance {}>'.format(context) diff --git a/twilio/rest/chat/v1/service/role.py b/twilio/rest/chat/v1/service/role.py deleted file mode 100644 index 1ec84b0..0000000 --- a/twilio/rest/chat/v1/service/role.py +++ /dev/null @@ -1,460 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class RoleList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the RoleList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v1.service.role.RoleList - :rtype: twilio.rest.chat.v1.service.role.RoleList - """ - super(RoleList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Roles'.format(**self._solution) - - def create(self, friendly_name, type, permission): - """ - Create a new RoleInstance - - :param unicode friendly_name: The friendly_name - :param RoleInstance.RoleType type: The type - :param unicode permission: The permission - - :returns: Newly created RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Type': type, - 'Permission': serialize.map(permission, lambda e: e), - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams RoleInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.role.RoleInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists RoleInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.role.RoleInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RoleInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RolePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return RolePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RoleInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RolePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RolePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RoleContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.role.RoleContext - :rtype: twilio.rest.chat.v1.service.role.RoleContext - """ - return RoleContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RoleContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.role.RoleContext - :rtype: twilio.rest.chat.v1.service.role.RoleContext - """ - return RoleContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.RoleList>' - - -class RolePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the RolePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v1.service.role.RolePage - :rtype: twilio.rest.chat.v1.service.role.RolePage - """ - super(RolePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RoleInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.role.RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.RolePage>' - - -class RoleContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the RoleContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.role.RoleContext - :rtype: twilio.rest.chat.v1.service.role.RoleContext - """ - super(RoleContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Roles/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a RoleInstance - - :returns: Fetched RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return RoleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the RoleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, permission): - """ - Update the RoleInstance - - :param unicode permission: The permission - - :returns: Updated RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - data = values.of({'Permission': serialize.map(permission, lambda e: e), }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return RoleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.RoleContext {}>'.format(context) - - -class RoleInstance(InstanceResource): - """ """ - - class RoleType(object): - CHANNEL = "channel" - DEPLOYMENT = "deployment" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the RoleInstance - - :returns: twilio.rest.chat.v1.service.role.RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - super(RoleInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'friendly_name': payload['friendly_name'], - 'type': payload['type'], - 'permissions': payload['permissions'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoleContext for this RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleContext - """ - if self._context is None: - self._context = RoleContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type - :rtype: RoleInstance.RoleType - """ - return self._properties['type'] - - @property - def permissions(self): - """ - :returns: The permissions - :rtype: unicode - """ - return self._properties['permissions'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a RoleInstance - - :returns: Fetched RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the RoleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, permission): - """ - Update the RoleInstance - - :param unicode permission: The permission - - :returns: Updated RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - return self._proxy.update(permission, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.RoleInstance {}>'.format(context) diff --git a/twilio/rest/chat/v1/service/user/__init__.py b/twilio/rest/chat/v1/service/user/__init__.py deleted file mode 100644 index cc9af0b..0000000 --- a/twilio/rest/chat/v1/service/user/__init__.py +++ /dev/null @@ -1,539 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.chat.v1.service.user.user_channel import UserChannelList - - -class UserList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the UserList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v1.service.user.UserList - :rtype: twilio.rest.chat.v1.service.user.UserList - """ - super(UserList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Users'.format(**self._solution) - - def create(self, identity, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Create a new UserInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Newly created UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - data = values.of({ - 'Identity': identity, - 'RoleSid': role_sid, - 'Attributes': attributes, - 'FriendlyName': friendly_name, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams UserInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.user.UserInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.user.UserInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return UserPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.user.UserContext - :rtype: twilio.rest.chat.v1.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a UserContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.user.UserContext - :rtype: twilio.rest.chat.v1.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.UserList>' - - -class UserPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the UserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v1.service.user.UserPage - :rtype: twilio.rest.chat.v1.service.user.UserPage - """ - super(UserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.user.UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.UserPage>' - - -class UserContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the UserContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.user.UserContext - :rtype: twilio.rest.chat.v1.service.user.UserContext - """ - super(UserContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Users/{sid}'.format(**self._solution) - - # Dependents - self._user_channels = None - - def fetch(self): - """ - Fetch a UserInstance - - :returns: Fetched UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Update the UserInstance - - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Updated UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - data = values.of({'RoleSid': role_sid, 'Attributes': attributes, 'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def user_channels(self): - """ - Access the user_channels - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - """ - if self._user_channels is None: - self._user_channels = UserChannelList( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['sid'], - ) - return self._user_channels - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.UserContext {}>'.format(context) - - -class UserInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the UserInstance - - :returns: twilio.rest.chat.v1.service.user.UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - super(UserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'attributes': payload['attributes'], - 'friendly_name': payload['friendly_name'], - 'role_sid': payload['role_sid'], - 'identity': payload['identity'], - 'is_online': payload['is_online'], - 'is_notifiable': payload['is_notifiable'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'joined_channels_count': deserialize.integer(payload['joined_channels_count']), - 'links': payload['links'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserContext for this UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserContext - """ - if self._context is None: - self._context = UserContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def is_online(self): - """ - :returns: The is_online - :rtype: bool - """ - return self._properties['is_online'] - - @property - def is_notifiable(self): - """ - :returns: The is_notifiable - :rtype: bool - """ - return self._properties['is_notifiable'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def joined_channels_count(self): - """ - :returns: The joined_channels_count - :rtype: unicode - """ - return self._properties['joined_channels_count'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a UserInstance - - :returns: Fetched UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Update the UserInstance - - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Updated UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - return self._proxy.update(role_sid=role_sid, attributes=attributes, friendly_name=friendly_name, ) - - @property - def user_channels(self): - """ - Access the user_channels - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - """ - return self._proxy.user_channels - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V1.UserInstance {}>'.format(context) diff --git a/twilio/rest/chat/v1/service/user/__pycache__/__init__.cpython-36.pyc b/twilio/rest/chat/v1/service/user/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index cc09811..0000000 Binary files a/twilio/rest/chat/v1/service/user/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v1/service/user/__pycache__/user_channel.cpython-36.pyc b/twilio/rest/chat/v1/service/user/__pycache__/user_channel.cpython-36.pyc deleted file mode 100644 index 0f3d240..0000000 Binary files a/twilio/rest/chat/v1/service/user/__pycache__/user_channel.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v1/service/user/user_channel.py b/twilio/rest/chat/v1/service/user/user_channel.py deleted file mode 100644 index 32990f4..0000000 --- a/twilio/rest/chat/v1/service/user/user_channel.py +++ /dev/null @@ -1,277 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UserChannelList(ListResource): - """ """ - - def __init__(self, version, service_sid, user_sid): - """ - Initialize the UserChannelList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param user_sid: The sid - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - """ - super(UserChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - self._uri = '/Services/{service_sid}/Users/{user_sid}/Channels'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams UserChannelInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserChannelInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserChannelInstance - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return UserChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserChannelInstance - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserChannelPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.UserChannelList>' - - -class UserChannelPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the UserChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param user_sid: The sid - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage - """ - super(UserChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance - """ - return UserChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.UserChannelPage>' - - -class UserChannelInstance(InstanceResource): - """ """ - - class ChannelStatus(object): - JOINED = "joined" - INVITED = "invited" - NOT_PARTICIPATING = "not_participating" - - def __init__(self, version, payload, service_sid, user_sid): - """ - Initialize the UserChannelInstance - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance - """ - super(UserChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'channel_sid': payload['channel_sid'], - 'member_sid': payload['member_sid'], - 'status': payload['status'], - 'last_consumed_message_index': deserialize.integer(payload['last_consumed_message_index']), - 'unread_messages_count': deserialize.integer(payload['unread_messages_count']), - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def member_sid(self): - """ - :returns: The member_sid - :rtype: unicode - """ - return self._properties['member_sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: UserChannelInstance.ChannelStatus - """ - return self._properties['status'] - - @property - def last_consumed_message_index(self): - """ - :returns: The last_consumed_message_index - :rtype: unicode - """ - return self._properties['last_consumed_message_index'] - - @property - def unread_messages_count(self): - """ - :returns: The unread_messages_count - :rtype: unicode - """ - return self._properties['unread_messages_count'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V1.UserChannelInstance>' diff --git a/twilio/rest/chat/v2/__init__.py b/twilio/rest/chat/v2/__init__.py deleted file mode 100644 index 099c5d8..0000000 --- a/twilio/rest/chat/v2/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.chat.v2.credential import CredentialList -from twilio.rest.chat.v2.service import ServiceList - - -class V2(Version): - - def __init__(self, domain): - """ - Initialize the V2 version of Chat - - :returns: V2 version of Chat - :rtype: twilio.rest.chat.v2.V2.V2 - """ - super(V2, self).__init__(domain) - self.version = 'v2' - self._credentials = None - self._services = None - - @property - def credentials(self): - """ - :rtype: twilio.rest.chat.v2.credential.CredentialList - """ - if self._credentials is None: - self._credentials = CredentialList(self) - return self._credentials - - @property - def services(self): - """ - :rtype: twilio.rest.chat.v2.service.ServiceList - """ - if self._services is None: - self._services = ServiceList(self) - return self._services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2>' diff --git a/twilio/rest/chat/v2/__pycache__/__init__.cpython-36.pyc b/twilio/rest/chat/v2/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index dd540c3..0000000 Binary files a/twilio/rest/chat/v2/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v2/__pycache__/credential.cpython-36.pyc b/twilio/rest/chat/v2/__pycache__/credential.cpython-36.pyc deleted file mode 100644 index 293184b..0000000 Binary files a/twilio/rest/chat/v2/__pycache__/credential.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v2/credential.py b/twilio/rest/chat/v2/credential.py deleted file mode 100644 index df2e268..0000000 --- a/twilio/rest/chat/v2/credential.py +++ /dev/null @@ -1,472 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class CredentialList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the CredentialList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.chat.v2.credential.CredentialList - :rtype: twilio.rest.chat.v2.credential.CredentialList - """ - super(CredentialList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Credentials'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.credential.CredentialInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.credential.CredentialInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CredentialPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialPage(self._version, response, self._solution) - - def create(self, type, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Create a new CredentialInstance - - :param CredentialInstance.PushService type: The type - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Newly created CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - data = values.of({ - 'Type': type, - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CredentialInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a CredentialContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.credential.CredentialContext - :rtype: twilio.rest.chat.v2.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CredentialContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.credential.CredentialContext - :rtype: twilio.rest.chat.v2.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.CredentialList>' - - -class CredentialPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the CredentialPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.chat.v2.credential.CredentialPage - :rtype: twilio.rest.chat.v2.credential.CredentialPage - """ - super(CredentialPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.credential.CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - return CredentialInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.CredentialPage>' - - -class CredentialContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the CredentialContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.chat.v2.credential.CredentialContext - :rtype: twilio.rest.chat.v2.credential.CredentialContext - """ - super(CredentialContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Credentials/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a CredentialInstance - - :returns: Fetched CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Updated CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.CredentialContext {}>'.format(context) - - -class CredentialInstance(InstanceResource): - """ """ - - class PushService(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - - def __init__(self, version, payload, sid=None): - """ - Initialize the CredentialInstance - - :returns: twilio.rest.chat.v2.credential.CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - super(CredentialInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'type': payload['type'], - 'sandbox': payload['sandbox'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialContext for this CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialContext - """ - if self._context is None: - self._context = CredentialContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type - :rtype: CredentialInstance.PushService - """ - return self._properties['type'] - - @property - def sandbox(self): - """ - :returns: The sandbox - :rtype: unicode - """ - return self._properties['sandbox'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a CredentialInstance - - :returns: Fetched CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Updated CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - certificate=certificate, - private_key=private_key, - sandbox=sandbox, - api_key=api_key, - secret=secret, - ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.CredentialInstance {}>'.format(context) diff --git a/twilio/rest/chat/v2/service/__init__.py b/twilio/rest/chat/v2/service/__init__.py deleted file mode 100644 index 80b9947..0000000 --- a/twilio/rest/chat/v2/service/__init__.py +++ /dev/null @@ -1,835 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.chat.v2.service.binding import BindingList -from twilio.rest.chat.v2.service.channel import ChannelList -from twilio.rest.chat.v2.service.role import RoleList -from twilio.rest.chat.v2.service.user import UserList - - -class ServiceList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.chat.v2.service.ServiceList - :rtype: twilio.rest.chat.v2.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name): - """ - Create a new ServiceInstance - - :param unicode friendly_name: The friendly_name - - :returns: Newly created ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServicePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.ServiceContext - :rtype: twilio.rest.chat.v2.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.ServiceContext - :rtype: twilio.rest.chat.v2.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.ServiceList>' - - -class ServicePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.chat.v2.service.ServicePage - :rtype: twilio.rest.chat.v2.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.ServicePage>' - - -class ServiceContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.ServiceContext - :rtype: twilio.rest.chat.v2.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._channels = None - self._roles = None - self._users = None - self._bindings = None - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_new_message_sound=values.unset, - notifications_new_message_badge_count_enabled=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_added_to_channel_sound=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_removed_from_channel_sound=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - notifications_invited_to_channel_sound=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset, - media_compatibility_message=values.unset, - pre_webhook_retry_count=values.unset, - post_webhook_retry_count=values.unset, - notifications_log_enabled=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode default_service_role_sid: The default_service_role_sid - :param unicode default_channel_role_sid: The default_channel_role_sid - :param unicode default_channel_creator_role_sid: The default_channel_creator_role_sid - :param bool read_status_enabled: The read_status_enabled - :param bool reachability_enabled: The reachability_enabled - :param unicode typing_indicator_timeout: The typing_indicator_timeout - :param unicode consumption_report_interval: The consumption_report_interval - :param bool notifications_new_message_enabled: The notifications.new_message.enabled - :param unicode notifications_new_message_template: The notifications.new_message.template - :param unicode notifications_new_message_sound: The notifications.new_message.sound - :param bool notifications_new_message_badge_count_enabled: The notifications.new_message.badge_count_enabled - :param bool notifications_added_to_channel_enabled: The notifications.added_to_channel.enabled - :param unicode notifications_added_to_channel_template: The notifications.added_to_channel.template - :param unicode notifications_added_to_channel_sound: The notifications.added_to_channel.sound - :param bool notifications_removed_from_channel_enabled: The notifications.removed_from_channel.enabled - :param unicode notifications_removed_from_channel_template: The notifications.removed_from_channel.template - :param unicode notifications_removed_from_channel_sound: The notifications.removed_from_channel.sound - :param bool notifications_invited_to_channel_enabled: The notifications.invited_to_channel.enabled - :param unicode notifications_invited_to_channel_template: The notifications.invited_to_channel.template - :param unicode notifications_invited_to_channel_sound: The notifications.invited_to_channel.sound - :param unicode pre_webhook_url: The pre_webhook_url - :param unicode post_webhook_url: The post_webhook_url - :param unicode webhook_method: The webhook_method - :param unicode webhook_filters: The webhook_filters - :param unicode limits_channel_members: The limits.channel_members - :param unicode limits_user_channels: The limits.user_channels - :param unicode media_compatibility_message: The media.compatibility_message - :param unicode pre_webhook_retry_count: The pre_webhook_retry_count - :param unicode post_webhook_retry_count: The post_webhook_retry_count - :param bool notifications_log_enabled: The notifications.log_enabled - - :returns: Updated ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'DefaultServiceRoleSid': default_service_role_sid, - 'DefaultChannelRoleSid': default_channel_role_sid, - 'DefaultChannelCreatorRoleSid': default_channel_creator_role_sid, - 'ReadStatusEnabled': read_status_enabled, - 'ReachabilityEnabled': reachability_enabled, - 'TypingIndicatorTimeout': typing_indicator_timeout, - 'ConsumptionReportInterval': consumption_report_interval, - 'Notifications.NewMessage.Enabled': notifications_new_message_enabled, - 'Notifications.NewMessage.Template': notifications_new_message_template, - 'Notifications.NewMessage.Sound': notifications_new_message_sound, - 'Notifications.NewMessage.BadgeCountEnabled': notifications_new_message_badge_count_enabled, - 'Notifications.AddedToChannel.Enabled': notifications_added_to_channel_enabled, - 'Notifications.AddedToChannel.Template': notifications_added_to_channel_template, - 'Notifications.AddedToChannel.Sound': notifications_added_to_channel_sound, - 'Notifications.RemovedFromChannel.Enabled': notifications_removed_from_channel_enabled, - 'Notifications.RemovedFromChannel.Template': notifications_removed_from_channel_template, - 'Notifications.RemovedFromChannel.Sound': notifications_removed_from_channel_sound, - 'Notifications.InvitedToChannel.Enabled': notifications_invited_to_channel_enabled, - 'Notifications.InvitedToChannel.Template': notifications_invited_to_channel_template, - 'Notifications.InvitedToChannel.Sound': notifications_invited_to_channel_sound, - 'PreWebhookUrl': pre_webhook_url, - 'PostWebhookUrl': post_webhook_url, - 'WebhookMethod': webhook_method, - 'WebhookFilters': serialize.map(webhook_filters, lambda e: e), - 'Limits.ChannelMembers': limits_channel_members, - 'Limits.UserChannels': limits_user_channels, - 'Media.CompatibilityMessage': media_compatibility_message, - 'PreWebhookRetryCount': pre_webhook_retry_count, - 'PostWebhookRetryCount': post_webhook_retry_count, - 'Notifications.LogEnabled': notifications_log_enabled, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def channels(self): - """ - Access the channels - - :returns: twilio.rest.chat.v2.service.channel.ChannelList - :rtype: twilio.rest.chat.v2.service.channel.ChannelList - """ - if self._channels is None: - self._channels = ChannelList(self._version, service_sid=self._solution['sid'], ) - return self._channels - - @property - def roles(self): - """ - Access the roles - - :returns: twilio.rest.chat.v2.service.role.RoleList - :rtype: twilio.rest.chat.v2.service.role.RoleList - """ - if self._roles is None: - self._roles = RoleList(self._version, service_sid=self._solution['sid'], ) - return self._roles - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.chat.v2.service.user.UserList - :rtype: twilio.rest.chat.v2.service.user.UserList - """ - if self._users is None: - self._users = UserList(self._version, service_sid=self._solution['sid'], ) - return self._users - - @property - def bindings(self): - """ - Access the bindings - - :returns: twilio.rest.chat.v2.service.binding.BindingList - :rtype: twilio.rest.chat.v2.service.binding.BindingList - """ - if self._bindings is None: - self._bindings = BindingList(self._version, service_sid=self._solution['sid'], ) - return self._bindings - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.ServiceContext {}>'.format(context) - - -class ServiceInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.chat.v2.service.ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'default_service_role_sid': payload['default_service_role_sid'], - 'default_channel_role_sid': payload['default_channel_role_sid'], - 'default_channel_creator_role_sid': payload['default_channel_creator_role_sid'], - 'read_status_enabled': payload['read_status_enabled'], - 'reachability_enabled': payload['reachability_enabled'], - 'typing_indicator_timeout': deserialize.integer(payload['typing_indicator_timeout']), - 'consumption_report_interval': deserialize.integer(payload['consumption_report_interval']), - 'limits': payload['limits'], - 'pre_webhook_url': payload['pre_webhook_url'], - 'post_webhook_url': payload['post_webhook_url'], - 'webhook_method': payload['webhook_method'], - 'webhook_filters': payload['webhook_filters'], - 'pre_webhook_retry_count': deserialize.integer(payload['pre_webhook_retry_count']), - 'post_webhook_retry_count': deserialize.integer(payload['post_webhook_retry_count']), - 'notifications': payload['notifications'], - 'media': payload['media'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceContext - """ - if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def default_service_role_sid(self): - """ - :returns: The default_service_role_sid - :rtype: unicode - """ - return self._properties['default_service_role_sid'] - - @property - def default_channel_role_sid(self): - """ - :returns: The default_channel_role_sid - :rtype: unicode - """ - return self._properties['default_channel_role_sid'] - - @property - def default_channel_creator_role_sid(self): - """ - :returns: The default_channel_creator_role_sid - :rtype: unicode - """ - return self._properties['default_channel_creator_role_sid'] - - @property - def read_status_enabled(self): - """ - :returns: The read_status_enabled - :rtype: bool - """ - return self._properties['read_status_enabled'] - - @property - def reachability_enabled(self): - """ - :returns: The reachability_enabled - :rtype: bool - """ - return self._properties['reachability_enabled'] - - @property - def typing_indicator_timeout(self): - """ - :returns: The typing_indicator_timeout - :rtype: unicode - """ - return self._properties['typing_indicator_timeout'] - - @property - def consumption_report_interval(self): - """ - :returns: The consumption_report_interval - :rtype: unicode - """ - return self._properties['consumption_report_interval'] - - @property - def limits(self): - """ - :returns: The limits - :rtype: dict - """ - return self._properties['limits'] - - @property - def pre_webhook_url(self): - """ - :returns: The pre_webhook_url - :rtype: unicode - """ - return self._properties['pre_webhook_url'] - - @property - def post_webhook_url(self): - """ - :returns: The post_webhook_url - :rtype: unicode - """ - return self._properties['post_webhook_url'] - - @property - def webhook_method(self): - """ - :returns: The webhook_method - :rtype: unicode - """ - return self._properties['webhook_method'] - - @property - def webhook_filters(self): - """ - :returns: The webhook_filters - :rtype: unicode - """ - return self._properties['webhook_filters'] - - @property - def pre_webhook_retry_count(self): - """ - :returns: The pre_webhook_retry_count - :rtype: unicode - """ - return self._properties['pre_webhook_retry_count'] - - @property - def post_webhook_retry_count(self): - """ - :returns: The post_webhook_retry_count - :rtype: unicode - """ - return self._properties['post_webhook_retry_count'] - - @property - def notifications(self): - """ - :returns: The notifications - :rtype: dict - """ - return self._properties['notifications'] - - @property - def media(self): - """ - :returns: The media - :rtype: dict - """ - return self._properties['media'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_new_message_sound=values.unset, - notifications_new_message_badge_count_enabled=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_added_to_channel_sound=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_removed_from_channel_sound=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - notifications_invited_to_channel_sound=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset, - media_compatibility_message=values.unset, - pre_webhook_retry_count=values.unset, - post_webhook_retry_count=values.unset, - notifications_log_enabled=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode default_service_role_sid: The default_service_role_sid - :param unicode default_channel_role_sid: The default_channel_role_sid - :param unicode default_channel_creator_role_sid: The default_channel_creator_role_sid - :param bool read_status_enabled: The read_status_enabled - :param bool reachability_enabled: The reachability_enabled - :param unicode typing_indicator_timeout: The typing_indicator_timeout - :param unicode consumption_report_interval: The consumption_report_interval - :param bool notifications_new_message_enabled: The notifications.new_message.enabled - :param unicode notifications_new_message_template: The notifications.new_message.template - :param unicode notifications_new_message_sound: The notifications.new_message.sound - :param bool notifications_new_message_badge_count_enabled: The notifications.new_message.badge_count_enabled - :param bool notifications_added_to_channel_enabled: The notifications.added_to_channel.enabled - :param unicode notifications_added_to_channel_template: The notifications.added_to_channel.template - :param unicode notifications_added_to_channel_sound: The notifications.added_to_channel.sound - :param bool notifications_removed_from_channel_enabled: The notifications.removed_from_channel.enabled - :param unicode notifications_removed_from_channel_template: The notifications.removed_from_channel.template - :param unicode notifications_removed_from_channel_sound: The notifications.removed_from_channel.sound - :param bool notifications_invited_to_channel_enabled: The notifications.invited_to_channel.enabled - :param unicode notifications_invited_to_channel_template: The notifications.invited_to_channel.template - :param unicode notifications_invited_to_channel_sound: The notifications.invited_to_channel.sound - :param unicode pre_webhook_url: The pre_webhook_url - :param unicode post_webhook_url: The post_webhook_url - :param unicode webhook_method: The webhook_method - :param unicode webhook_filters: The webhook_filters - :param unicode limits_channel_members: The limits.channel_members - :param unicode limits_user_channels: The limits.user_channels - :param unicode media_compatibility_message: The media.compatibility_message - :param unicode pre_webhook_retry_count: The pre_webhook_retry_count - :param unicode post_webhook_retry_count: The post_webhook_retry_count - :param bool notifications_log_enabled: The notifications.log_enabled - - :returns: Updated ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - default_service_role_sid=default_service_role_sid, - default_channel_role_sid=default_channel_role_sid, - default_channel_creator_role_sid=default_channel_creator_role_sid, - read_status_enabled=read_status_enabled, - reachability_enabled=reachability_enabled, - typing_indicator_timeout=typing_indicator_timeout, - consumption_report_interval=consumption_report_interval, - notifications_new_message_enabled=notifications_new_message_enabled, - notifications_new_message_template=notifications_new_message_template, - notifications_new_message_sound=notifications_new_message_sound, - notifications_new_message_badge_count_enabled=notifications_new_message_badge_count_enabled, - notifications_added_to_channel_enabled=notifications_added_to_channel_enabled, - notifications_added_to_channel_template=notifications_added_to_channel_template, - notifications_added_to_channel_sound=notifications_added_to_channel_sound, - notifications_removed_from_channel_enabled=notifications_removed_from_channel_enabled, - notifications_removed_from_channel_template=notifications_removed_from_channel_template, - notifications_removed_from_channel_sound=notifications_removed_from_channel_sound, - notifications_invited_to_channel_enabled=notifications_invited_to_channel_enabled, - notifications_invited_to_channel_template=notifications_invited_to_channel_template, - notifications_invited_to_channel_sound=notifications_invited_to_channel_sound, - pre_webhook_url=pre_webhook_url, - post_webhook_url=post_webhook_url, - webhook_method=webhook_method, - webhook_filters=webhook_filters, - limits_channel_members=limits_channel_members, - limits_user_channels=limits_user_channels, - media_compatibility_message=media_compatibility_message, - pre_webhook_retry_count=pre_webhook_retry_count, - post_webhook_retry_count=post_webhook_retry_count, - notifications_log_enabled=notifications_log_enabled, - ) - - @property - def channels(self): - """ - Access the channels - - :returns: twilio.rest.chat.v2.service.channel.ChannelList - :rtype: twilio.rest.chat.v2.service.channel.ChannelList - """ - return self._proxy.channels - - @property - def roles(self): - """ - Access the roles - - :returns: twilio.rest.chat.v2.service.role.RoleList - :rtype: twilio.rest.chat.v2.service.role.RoleList - """ - return self._proxy.roles - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.chat.v2.service.user.UserList - :rtype: twilio.rest.chat.v2.service.user.UserList - """ - return self._proxy.users - - @property - def bindings(self): - """ - Access the bindings - - :returns: twilio.rest.chat.v2.service.binding.BindingList - :rtype: twilio.rest.chat.v2.service.binding.BindingList - """ - return self._proxy.bindings - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.ServiceInstance {}>'.format(context) diff --git a/twilio/rest/chat/v2/service/__pycache__/__init__.cpython-36.pyc b/twilio/rest/chat/v2/service/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index daec75f..0000000 Binary files a/twilio/rest/chat/v2/service/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v2/service/__pycache__/binding.cpython-36.pyc b/twilio/rest/chat/v2/service/__pycache__/binding.cpython-36.pyc deleted file mode 100644 index 87b4932..0000000 Binary files a/twilio/rest/chat/v2/service/__pycache__/binding.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v2/service/__pycache__/role.cpython-36.pyc b/twilio/rest/chat/v2/service/__pycache__/role.cpython-36.pyc deleted file mode 100644 index 7225f5c..0000000 Binary files a/twilio/rest/chat/v2/service/__pycache__/role.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v2/service/binding.py b/twilio/rest/chat/v2/service/binding.py deleted file mode 100644 index 720f394..0000000 --- a/twilio/rest/chat/v2/service/binding.py +++ /dev/null @@ -1,448 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class BindingList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the BindingList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.binding.BindingList - :rtype: twilio.rest.chat.v2.service.binding.BindingList - """ - super(BindingList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Bindings'.format(**self._solution) - - def stream(self, binding_type=values.unset, identity=values.unset, limit=None, - page_size=None): - """ - Streams BindingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param BindingInstance.BindingType binding_type: The binding_type - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.binding.BindingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(binding_type=binding_type, identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, binding_type=values.unset, identity=values.unset, limit=None, - page_size=None): - """ - Lists BindingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param BindingInstance.BindingType binding_type: The binding_type - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.binding.BindingInstance] - """ - return list(self.stream( - binding_type=binding_type, - identity=identity, - limit=limit, - page_size=page_size, - )) - - def page(self, binding_type=values.unset, identity=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of BindingInstance records from the API. - Request is executed immediately - - :param BindingInstance.BindingType binding_type: The binding_type - :param unicode identity: The identity - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingPage - """ - params = values.of({ - 'BindingType': serialize.map(binding_type, lambda e: e), - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return BindingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of BindingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return BindingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a BindingContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.binding.BindingContext - :rtype: twilio.rest.chat.v2.service.binding.BindingContext - """ - return BindingContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a BindingContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.binding.BindingContext - :rtype: twilio.rest.chat.v2.service.binding.BindingContext - """ - return BindingContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.BindingList>' - - -class BindingPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the BindingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.binding.BindingPage - :rtype: twilio.rest.chat.v2.service.binding.BindingPage - """ - super(BindingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BindingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.binding.BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingInstance - """ - return BindingInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.BindingPage>' - - -class BindingContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the BindingContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.binding.BindingContext - :rtype: twilio.rest.chat.v2.service.binding.BindingContext - """ - super(BindingContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Bindings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a BindingInstance - - :returns: Fetched BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return BindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the BindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.BindingContext {}>'.format(context) - - -class BindingInstance(InstanceResource): - """ """ - - class BindingType(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the BindingInstance - - :returns: twilio.rest.chat.v2.service.binding.BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingInstance - """ - super(BindingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'endpoint': payload['endpoint'], - 'identity': payload['identity'], - 'credential_sid': payload['credential_sid'], - 'binding_type': payload['binding_type'], - 'message_types': payload['message_types'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: BindingContext for this BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingContext - """ - if self._context is None: - self._context = BindingContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def endpoint(self): - """ - :returns: The endpoint - :rtype: unicode - """ - return self._properties['endpoint'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def credential_sid(self): - """ - :returns: The credential_sid - :rtype: unicode - """ - return self._properties['credential_sid'] - - @property - def binding_type(self): - """ - :returns: The binding_type - :rtype: BindingInstance.BindingType - """ - return self._properties['binding_type'] - - @property - def message_types(self): - """ - :returns: The message_types - :rtype: unicode - """ - return self._properties['message_types'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a BindingInstance - - :returns: Fetched BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the BindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.BindingInstance {}>'.format(context) diff --git a/twilio/rest/chat/v2/service/channel/__init__.py b/twilio/rest/chat/v2/service/channel/__init__.py deleted file mode 100644 index e770ca1..0000000 --- a/twilio/rest/chat/v2/service/channel/__init__.py +++ /dev/null @@ -1,638 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.chat.v2.service.channel.invite import InviteList -from twilio.rest.chat.v2.service.channel.member import MemberList -from twilio.rest.chat.v2.service.channel.message import MessageList - - -class ChannelList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the ChannelList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.channel.ChannelList - :rtype: twilio.rest.chat.v2.service.channel.ChannelList - """ - super(ChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Channels'.format(**self._solution) - - def create(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, type=values.unset, - date_created=values.unset, date_updated=values.unset, - created_by=values.unset): - """ - Create a new ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - :param ChannelInstance.ChannelType type: The type - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode created_by: The created_by - - :returns: Newly created ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - 'Type': type, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'CreatedBy': created_by, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, type=values.unset, limit=None, page_size=None): - """ - Streams ChannelInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param ChannelInstance.ChannelType type: The type - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.ChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(type=type, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, type=values.unset, limit=None, page_size=None): - """ - Lists ChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param ChannelInstance.ChannelType type: The type - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.ChannelInstance] - """ - return list(self.stream(type=type, limit=limit, page_size=page_size, )) - - def page(self, type=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ChannelInstance records from the API. - Request is executed immediately - - :param ChannelInstance.ChannelType type: The type - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelPage - """ - params = values.of({ - 'Type': serialize.map(type, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ChannelPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ChannelContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.ChannelContext - :rtype: twilio.rest.chat.v2.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ChannelContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.ChannelContext - :rtype: twilio.rest.chat.v2.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.ChannelList>' - - -class ChannelPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.channel.ChannelPage - :rtype: twilio.rest.chat.v2.service.channel.ChannelPage - """ - super(ChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.channel.ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.ChannelPage>' - - -class ChannelContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the ChannelContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.ChannelContext - :rtype: twilio.rest.chat.v2.service.channel.ChannelContext - """ - super(ChannelContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{sid}'.format(**self._solution) - - # Dependents - self._members = None - self._messages = None - self._invites = None - - def fetch(self): - """ - Fetch a ChannelInstance - - :returns: Fetched ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the ChannelInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, date_created=values.unset, - date_updated=values.unset, created_by=values.unset): - """ - Update the ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode created_by: The created_by - - :returns: Updated ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'CreatedBy': created_by, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def members(self): - """ - Access the members - - :returns: twilio.rest.chat.v2.service.channel.member.MemberList - :rtype: twilio.rest.chat.v2.service.channel.member.MemberList - """ - if self._members is None: - self._members = MemberList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._members - - @property - def messages(self): - """ - Access the messages - - :returns: twilio.rest.chat.v2.service.channel.message.MessageList - :rtype: twilio.rest.chat.v2.service.channel.message.MessageList - """ - if self._messages is None: - self._messages = MessageList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._messages - - @property - def invites(self): - """ - Access the invites - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteList - """ - if self._invites is None: - self._invites = InviteList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._invites - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.ChannelContext {}>'.format(context) - - -class ChannelInstance(InstanceResource): - """ """ - - class ChannelType(object): - PUBLIC = "public" - PRIVATE = "private" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ChannelInstance - - :returns: twilio.rest.chat.v2.service.channel.ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - super(ChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'friendly_name': payload['friendly_name'], - 'unique_name': payload['unique_name'], - 'attributes': payload['attributes'], - 'type': payload['type'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - 'members_count': deserialize.integer(payload['members_count']), - 'messages_count': deserialize.integer(payload['messages_count']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ChannelContext for this ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelContext - """ - if self._context is None: - self._context = ChannelContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def type(self): - """ - :returns: The type - :rtype: ChannelInstance.ChannelType - """ - return self._properties['type'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def members_count(self): - """ - :returns: The members_count - :rtype: unicode - """ - return self._properties['members_count'] - - @property - def messages_count(self): - """ - :returns: The messages_count - :rtype: unicode - """ - return self._properties['messages_count'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ChannelInstance - - :returns: Fetched ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ChannelInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, date_created=values.unset, - date_updated=values.unset, created_by=values.unset): - """ - Update the ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode created_by: The created_by - - :returns: Updated ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - unique_name=unique_name, - attributes=attributes, - date_created=date_created, - date_updated=date_updated, - created_by=created_by, - ) - - @property - def members(self): - """ - Access the members - - :returns: twilio.rest.chat.v2.service.channel.member.MemberList - :rtype: twilio.rest.chat.v2.service.channel.member.MemberList - """ - return self._proxy.members - - @property - def messages(self): - """ - Access the messages - - :returns: twilio.rest.chat.v2.service.channel.message.MessageList - :rtype: twilio.rest.chat.v2.service.channel.message.MessageList - """ - return self._proxy.messages - - @property - def invites(self): - """ - Access the invites - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteList - """ - return self._proxy.invites - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.ChannelInstance {}>'.format(context) diff --git a/twilio/rest/chat/v2/service/channel/__pycache__/__init__.cpython-36.pyc b/twilio/rest/chat/v2/service/channel/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 3c9a7b8..0000000 Binary files a/twilio/rest/chat/v2/service/channel/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v2/service/channel/__pycache__/invite.cpython-36.pyc b/twilio/rest/chat/v2/service/channel/__pycache__/invite.cpython-36.pyc deleted file mode 100644 index 071bd1b..0000000 Binary files a/twilio/rest/chat/v2/service/channel/__pycache__/invite.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v2/service/channel/__pycache__/member.cpython-36.pyc b/twilio/rest/chat/v2/service/channel/__pycache__/member.cpython-36.pyc deleted file mode 100644 index 96ae6f4..0000000 Binary files a/twilio/rest/chat/v2/service/channel/__pycache__/member.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v2/service/channel/__pycache__/message.cpython-36.pyc b/twilio/rest/chat/v2/service/channel/__pycache__/message.cpython-36.pyc deleted file mode 100644 index 83dd44e..0000000 Binary files a/twilio/rest/chat/v2/service/channel/__pycache__/message.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v2/service/channel/invite.py b/twilio/rest/chat/v2/service/channel/invite.py deleted file mode 100644 index d92770a..0000000 --- a/twilio/rest/chat/v2/service/channel/invite.py +++ /dev/null @@ -1,462 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class InviteList(ListResource): - """ """ - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the InviteList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteList - """ - super(InviteList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Invites'.format(**self._solution) - - def create(self, identity, role_sid=values.unset): - """ - Create a new InviteInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - - :returns: Newly created InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - data = values.of({'Identity': identity, 'RoleSid': role_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, identity=values.unset, limit=None, page_size=None): - """ - Streams InviteInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.invite.InviteInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, identity=values.unset, limit=None, page_size=None): - """ - Lists InviteInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.invite.InviteInstance] - """ - return list(self.stream(identity=identity, limit=limit, page_size=page_size, )) - - def page(self, identity=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of InviteInstance records from the API. - Request is executed immediately - - :param unicode identity: The identity - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InvitePage - """ - params = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return InvitePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of InviteInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InvitePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InvitePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InviteContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteContext - """ - return InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a InviteContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteContext - """ - return InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.InviteList>' - - -class InvitePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the InvitePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v2.service.channel.invite.InvitePage - :rtype: twilio.rest.chat.v2.service.channel.invite.InvitePage - """ - super(InvitePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InviteInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.InvitePage>' - - -class InviteContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the InviteContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteContext - """ - super(InviteContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Invites/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a InviteInstance - - :returns: Fetched InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the InviteInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.InviteContext {}>'.format(context) - - -class InviteInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the InviteInstance - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - super(InviteInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'channel_sid': payload['channel_sid'], - 'service_sid': payload['service_sid'], - 'identity': payload['identity'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'role_sid': payload['role_sid'], - 'created_by': payload['created_by'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InviteContext for this InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteContext - """ - if self._context is None: - self._context = InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a InviteInstance - - :returns: Fetched InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the InviteInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.InviteInstance {}>'.format(context) diff --git a/twilio/rest/chat/v2/service/channel/member.py b/twilio/rest/chat/v2/service/channel/member.py deleted file mode 100644 index 50f701d..0000000 --- a/twilio/rest/chat/v2/service/channel/member.py +++ /dev/null @@ -1,547 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class MemberList(ListResource): - """ """ - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the MemberList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v2.service.channel.member.MemberList - :rtype: twilio.rest.chat.v2.service.channel.member.MemberList - """ - super(MemberList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Members'.format(**self._solution) - - def create(self, identity, role_sid=values.unset, - last_consumed_message_index=values.unset, - last_consumption_timestamp=values.unset, date_created=values.unset, - date_updated=values.unset): - """ - Create a new MemberInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - :param unicode last_consumed_message_index: The last_consumed_message_index - :param datetime last_consumption_timestamp: The last_consumption_timestamp - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - - :returns: Newly created MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - data = values.of({ - 'Identity': identity, - 'RoleSid': role_sid, - 'LastConsumedMessageIndex': last_consumed_message_index, - 'LastConsumptionTimestamp': serialize.iso8601_datetime(last_consumption_timestamp), - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, identity=values.unset, limit=None, page_size=None): - """ - Streams MemberInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.member.MemberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, identity=values.unset, limit=None, page_size=None): - """ - Lists MemberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.member.MemberInstance] - """ - return list(self.stream(identity=identity, limit=limit, page_size=page_size, )) - - def page(self, identity=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MemberInstance records from the API. - Request is executed immediately - - :param unicode identity: The identity - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage - """ - params = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MemberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MemberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MemberPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MemberContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext - """ - return MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MemberContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext - """ - return MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.MemberList>' - - -class MemberPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MemberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v2.service.channel.member.MemberPage - :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage - """ - super(MemberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MemberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.channel.member.MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.MemberPage>' - - -class MemberContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the MemberContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext - """ - super(MemberContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Members/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a MemberInstance - - :returns: Fetched MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the MemberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, role_sid=values.unset, - last_consumed_message_index=values.unset, - last_consumption_timestamp=values.unset, date_created=values.unset, - date_updated=values.unset): - """ - Update the MemberInstance - - :param unicode role_sid: The role_sid - :param unicode last_consumed_message_index: The last_consumed_message_index - :param datetime last_consumption_timestamp: The last_consumption_timestamp - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - - :returns: Updated MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - data = values.of({ - 'RoleSid': role_sid, - 'LastConsumedMessageIndex': last_consumed_message_index, - 'LastConsumptionTimestamp': serialize.iso8601_datetime(last_consumption_timestamp), - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.MemberContext {}>'.format(context) - - -class MemberInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the MemberInstance - - :returns: twilio.rest.chat.v2.service.channel.member.MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - super(MemberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'channel_sid': payload['channel_sid'], - 'service_sid': payload['service_sid'], - 'identity': payload['identity'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'role_sid': payload['role_sid'], - 'last_consumed_message_index': deserialize.integer(payload['last_consumed_message_index']), - 'last_consumption_timestamp': deserialize.iso8601_datetime(payload['last_consumption_timestamp']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MemberContext for this MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext - """ - if self._context is None: - self._context = MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def last_consumed_message_index(self): - """ - :returns: The last_consumed_message_index - :rtype: unicode - """ - return self._properties['last_consumed_message_index'] - - @property - def last_consumption_timestamp(self): - """ - :returns: The last_consumption_timestamp - :rtype: datetime - """ - return self._properties['last_consumption_timestamp'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a MemberInstance - - :returns: Fetched MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the MemberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, role_sid=values.unset, - last_consumed_message_index=values.unset, - last_consumption_timestamp=values.unset, date_created=values.unset, - date_updated=values.unset): - """ - Update the MemberInstance - - :param unicode role_sid: The role_sid - :param unicode last_consumed_message_index: The last_consumed_message_index - :param datetime last_consumption_timestamp: The last_consumption_timestamp - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - - :returns: Updated MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - return self._proxy.update( - role_sid=role_sid, - last_consumed_message_index=last_consumed_message_index, - last_consumption_timestamp=last_consumption_timestamp, - date_created=date_created, - date_updated=date_updated, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.MemberInstance {}>'.format(context) diff --git a/twilio/rest/chat/v2/service/channel/message.py b/twilio/rest/chat/v2/service/channel/message.py deleted file mode 100644 index 4e3bf4d..0000000 --- a/twilio/rest/chat/v2/service/channel/message.py +++ /dev/null @@ -1,596 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class MessageList(ListResource): - """ """ - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the MessageList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v2.service.channel.message.MessageList - :rtype: twilio.rest.chat.v2.service.channel.message.MessageList - """ - super(MessageList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Messages'.format(**self._solution) - - def create(self, from_=values.unset, attributes=values.unset, - date_created=values.unset, date_updated=values.unset, - last_updated_by=values.unset, body=values.unset, - media_sid=values.unset): - """ - Create a new MessageInstance - - :param unicode from_: The from - :param unicode attributes: The attributes - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode last_updated_by: The last_updated_by - :param unicode body: The body - :param unicode media_sid: The media_sid - - :returns: Newly created MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - data = values.of({ - 'From': from_, - 'Attributes': attributes, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'LastUpdatedBy': last_updated_by, - 'Body': body, - 'MediaSid': media_sid, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, order=values.unset, limit=None, page_size=None): - """ - Streams MessageInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param MessageInstance.OrderType order: The order - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.message.MessageInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, order=values.unset, limit=None, page_size=None): - """ - Lists MessageInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param MessageInstance.OrderType order: The order - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.message.MessageInstance] - """ - return list(self.stream(order=order, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MessageInstance records from the API. - Request is executed immediately - - :param MessageInstance.OrderType order: The order - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessagePage - """ - params = values.of({ - 'Order': order, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MessagePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessageInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessagePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessagePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MessageContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext - """ - return MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MessageContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext - """ - return MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.MessageList>' - - -class MessagePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MessagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v2.service.channel.message.MessagePage - :rtype: twilio.rest.chat.v2.service.channel.message.MessagePage - """ - super(MessagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessageInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.channel.message.MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.MessagePage>' - - -class MessageContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the MessageContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext - """ - super(MessageContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Messages/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a MessageInstance - - :returns: Fetched MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, body=values.unset, attributes=values.unset, - date_created=values.unset, date_updated=values.unset, - last_updated_by=values.unset): - """ - Update the MessageInstance - - :param unicode body: The body - :param unicode attributes: The attributes - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode last_updated_by: The last_updated_by - - :returns: Updated MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - data = values.of({ - 'Body': body, - 'Attributes': attributes, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'LastUpdatedBy': last_updated_by, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.MessageContext {}>'.format(context) - - -class MessageInstance(InstanceResource): - """ """ - - class OrderType(object): - ASC = "asc" - DESC = "desc" - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the MessageInstance - - :returns: twilio.rest.chat.v2.service.channel.message.MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - super(MessageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'attributes': payload['attributes'], - 'service_sid': payload['service_sid'], - 'to': payload['to'], - 'channel_sid': payload['channel_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'last_updated_by': payload['last_updated_by'], - 'was_edited': payload['was_edited'], - 'from_': payload['from'], - 'body': payload['body'], - 'index': deserialize.integer(payload['index']), - 'type': payload['type'], - 'media': payload['media'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessageContext for this MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext - """ - if self._context is None: - self._context = MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def to(self): - """ - :returns: The to - :rtype: unicode - """ - return self._properties['to'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def last_updated_by(self): - """ - :returns: The last_updated_by - :rtype: unicode - """ - return self._properties['last_updated_by'] - - @property - def was_edited(self): - """ - :returns: The was_edited - :rtype: bool - """ - return self._properties['was_edited'] - - @property - def from_(self): - """ - :returns: The from - :rtype: unicode - """ - return self._properties['from_'] - - @property - def body(self): - """ - :returns: The body - :rtype: unicode - """ - return self._properties['body'] - - @property - def index(self): - """ - :returns: The index - :rtype: unicode - """ - return self._properties['index'] - - @property - def type(self): - """ - :returns: The type - :rtype: unicode - """ - return self._properties['type'] - - @property - def media(self): - """ - :returns: The media - :rtype: dict - """ - return self._properties['media'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a MessageInstance - - :returns: Fetched MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, body=values.unset, attributes=values.unset, - date_created=values.unset, date_updated=values.unset, - last_updated_by=values.unset): - """ - Update the MessageInstance - - :param unicode body: The body - :param unicode attributes: The attributes - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode last_updated_by: The last_updated_by - - :returns: Updated MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - return self._proxy.update( - body=body, - attributes=attributes, - date_created=date_created, - date_updated=date_updated, - last_updated_by=last_updated_by, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.MessageInstance {}>'.format(context) diff --git a/twilio/rest/chat/v2/service/role.py b/twilio/rest/chat/v2/service/role.py deleted file mode 100644 index d0257a9..0000000 --- a/twilio/rest/chat/v2/service/role.py +++ /dev/null @@ -1,460 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class RoleList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the RoleList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.role.RoleList - :rtype: twilio.rest.chat.v2.service.role.RoleList - """ - super(RoleList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Roles'.format(**self._solution) - - def create(self, friendly_name, type, permission): - """ - Create a new RoleInstance - - :param unicode friendly_name: The friendly_name - :param RoleInstance.RoleType type: The type - :param unicode permission: The permission - - :returns: Newly created RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Type': type, - 'Permission': serialize.map(permission, lambda e: e), - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams RoleInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.role.RoleInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists RoleInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.role.RoleInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RoleInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RolePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return RolePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RoleInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RolePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RolePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RoleContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.role.RoleContext - :rtype: twilio.rest.chat.v2.service.role.RoleContext - """ - return RoleContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RoleContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.role.RoleContext - :rtype: twilio.rest.chat.v2.service.role.RoleContext - """ - return RoleContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.RoleList>' - - -class RolePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the RolePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.role.RolePage - :rtype: twilio.rest.chat.v2.service.role.RolePage - """ - super(RolePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RoleInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.role.RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.RolePage>' - - -class RoleContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the RoleContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.role.RoleContext - :rtype: twilio.rest.chat.v2.service.role.RoleContext - """ - super(RoleContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Roles/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a RoleInstance - - :returns: Fetched RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return RoleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the RoleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, permission): - """ - Update the RoleInstance - - :param unicode permission: The permission - - :returns: Updated RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - data = values.of({'Permission': serialize.map(permission, lambda e: e), }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return RoleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.RoleContext {}>'.format(context) - - -class RoleInstance(InstanceResource): - """ """ - - class RoleType(object): - CHANNEL = "channel" - DEPLOYMENT = "deployment" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the RoleInstance - - :returns: twilio.rest.chat.v2.service.role.RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - super(RoleInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'friendly_name': payload['friendly_name'], - 'type': payload['type'], - 'permissions': payload['permissions'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoleContext for this RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleContext - """ - if self._context is None: - self._context = RoleContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type - :rtype: RoleInstance.RoleType - """ - return self._properties['type'] - - @property - def permissions(self): - """ - :returns: The permissions - :rtype: unicode - """ - return self._properties['permissions'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a RoleInstance - - :returns: Fetched RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the RoleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, permission): - """ - Update the RoleInstance - - :param unicode permission: The permission - - :returns: Updated RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - return self._proxy.update(permission, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.RoleInstance {}>'.format(context) diff --git a/twilio/rest/chat/v2/service/user/__init__.py b/twilio/rest/chat/v2/service/user/__init__.py deleted file mode 100644 index c9b5085..0000000 --- a/twilio/rest/chat/v2/service/user/__init__.py +++ /dev/null @@ -1,567 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.chat.v2.service.user.user_binding import UserBindingList -from twilio.rest.chat.v2.service.user.user_channel import UserChannelList - - -class UserList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the UserList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.user.UserList - :rtype: twilio.rest.chat.v2.service.user.UserList - """ - super(UserList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Users'.format(**self._solution) - - def create(self, identity, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Create a new UserInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Newly created UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - data = values.of({ - 'Identity': identity, - 'RoleSid': role_sid, - 'Attributes': attributes, - 'FriendlyName': friendly_name, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams UserInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.user.UserInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.user.UserInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return UserPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.user.UserContext - :rtype: twilio.rest.chat.v2.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a UserContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.user.UserContext - :rtype: twilio.rest.chat.v2.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.UserList>' - - -class UserPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the UserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.user.UserPage - :rtype: twilio.rest.chat.v2.service.user.UserPage - """ - super(UserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.user.UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.UserPage>' - - -class UserContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the UserContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.user.UserContext - :rtype: twilio.rest.chat.v2.service.user.UserContext - """ - super(UserContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Users/{sid}'.format(**self._solution) - - # Dependents - self._user_channels = None - self._user_bindings = None - - def fetch(self): - """ - Fetch a UserInstance - - :returns: Fetched UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Update the UserInstance - - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Updated UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - data = values.of({'RoleSid': role_sid, 'Attributes': attributes, 'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def user_channels(self): - """ - Access the user_channels - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - """ - if self._user_channels is None: - self._user_channels = UserChannelList( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['sid'], - ) - return self._user_channels - - @property - def user_bindings(self): - """ - Access the user_bindings - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - """ - if self._user_bindings is None: - self._user_bindings = UserBindingList( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['sid'], - ) - return self._user_bindings - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.UserContext {}>'.format(context) - - -class UserInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the UserInstance - - :returns: twilio.rest.chat.v2.service.user.UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - super(UserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'attributes': payload['attributes'], - 'friendly_name': payload['friendly_name'], - 'role_sid': payload['role_sid'], - 'identity': payload['identity'], - 'is_online': payload['is_online'], - 'is_notifiable': payload['is_notifiable'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'joined_channels_count': deserialize.integer(payload['joined_channels_count']), - 'links': payload['links'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserContext for this UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserContext - """ - if self._context is None: - self._context = UserContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def is_online(self): - """ - :returns: The is_online - :rtype: bool - """ - return self._properties['is_online'] - - @property - def is_notifiable(self): - """ - :returns: The is_notifiable - :rtype: bool - """ - return self._properties['is_notifiable'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def joined_channels_count(self): - """ - :returns: The joined_channels_count - :rtype: unicode - """ - return self._properties['joined_channels_count'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a UserInstance - - :returns: Fetched UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Update the UserInstance - - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Updated UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - return self._proxy.update(role_sid=role_sid, attributes=attributes, friendly_name=friendly_name, ) - - @property - def user_channels(self): - """ - Access the user_channels - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - """ - return self._proxy.user_channels - - @property - def user_bindings(self): - """ - Access the user_bindings - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - """ - return self._proxy.user_bindings - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.UserInstance {}>'.format(context) diff --git a/twilio/rest/chat/v2/service/user/__pycache__/__init__.cpython-36.pyc b/twilio/rest/chat/v2/service/user/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index edb1493..0000000 Binary files a/twilio/rest/chat/v2/service/user/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v2/service/user/__pycache__/user_binding.cpython-36.pyc b/twilio/rest/chat/v2/service/user/__pycache__/user_binding.cpython-36.pyc deleted file mode 100644 index 0319764..0000000 Binary files a/twilio/rest/chat/v2/service/user/__pycache__/user_binding.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v2/service/user/__pycache__/user_channel.cpython-36.pyc b/twilio/rest/chat/v2/service/user/__pycache__/user_channel.cpython-36.pyc deleted file mode 100644 index bc9b28a..0000000 Binary files a/twilio/rest/chat/v2/service/user/__pycache__/user_channel.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/chat/v2/service/user/user_binding.py b/twilio/rest/chat/v2/service/user/user_binding.py deleted file mode 100644 index 47a7c63..0000000 --- a/twilio/rest/chat/v2/service/user/user_binding.py +++ /dev/null @@ -1,460 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class UserBindingList(ListResource): - """ """ - - def __init__(self, version, service_sid, user_sid): - """ - Initialize the UserBindingList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param user_sid: The user_sid - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - """ - super(UserBindingList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - self._uri = '/Services/{service_sid}/Users/{user_sid}/Bindings'.format(**self._solution) - - def stream(self, binding_type=values.unset, limit=None, page_size=None): - """ - Streams UserBindingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param UserBindingInstance.BindingType binding_type: The binding_type - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(binding_type=binding_type, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, binding_type=values.unset, limit=None, page_size=None): - """ - Lists UserBindingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param UserBindingInstance.BindingType binding_type: The binding_type - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance] - """ - return list(self.stream(binding_type=binding_type, limit=limit, page_size=page_size, )) - - def page(self, binding_type=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of UserBindingInstance records from the API. - Request is executed immediately - - :param UserBindingInstance.BindingType binding_type: The binding_type - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingPage - """ - params = values.of({ - 'BindingType': serialize.map(binding_type, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return UserBindingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserBindingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserBindingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserBindingContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - """ - return UserBindingContext( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a UserBindingContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - """ - return UserBindingContext( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.UserBindingList>' - - -class UserBindingPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the UserBindingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param user_sid: The user_sid - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingPage - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingPage - """ - super(UserBindingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserBindingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - """ - return UserBindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.UserBindingPage>' - - -class UserBindingContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, user_sid, sid): - """ - Initialize the UserBindingContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param user_sid: The user_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - """ - super(UserBindingContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Users/{user_sid}/Bindings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a UserBindingInstance - - :returns: Fetched UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return UserBindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the UserBindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.UserBindingContext {}>'.format(context) - - -class UserBindingInstance(InstanceResource): - """ """ - - class BindingType(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - - def __init__(self, version, payload, service_sid, user_sid, sid=None): - """ - Initialize the UserBindingInstance - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - """ - super(UserBindingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'endpoint': payload['endpoint'], - 'identity': payload['identity'], - 'user_sid': payload['user_sid'], - 'credential_sid': payload['credential_sid'], - 'binding_type': payload['binding_type'], - 'message_types': payload['message_types'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'user_sid': user_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserBindingContext for this UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - """ - if self._context is None: - self._context = UserBindingContext( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def endpoint(self): - """ - :returns: The endpoint - :rtype: unicode - """ - return self._properties['endpoint'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def user_sid(self): - """ - :returns: The user_sid - :rtype: unicode - """ - return self._properties['user_sid'] - - @property - def credential_sid(self): - """ - :returns: The credential_sid - :rtype: unicode - """ - return self._properties['credential_sid'] - - @property - def binding_type(self): - """ - :returns: The binding_type - :rtype: UserBindingInstance.BindingType - """ - return self._properties['binding_type'] - - @property - def message_types(self): - """ - :returns: The message_types - :rtype: unicode - """ - return self._properties['message_types'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a UserBindingInstance - - :returns: Fetched UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the UserBindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Chat.V2.UserBindingInstance {}>'.format(context) diff --git a/twilio/rest/chat/v2/service/user/user_channel.py b/twilio/rest/chat/v2/service/user/user_channel.py deleted file mode 100644 index 7439674..0000000 --- a/twilio/rest/chat/v2/service/user/user_channel.py +++ /dev/null @@ -1,277 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UserChannelList(ListResource): - """ """ - - def __init__(self, version, service_sid, user_sid): - """ - Initialize the UserChannelList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param user_sid: The sid - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - """ - super(UserChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - self._uri = '/Services/{service_sid}/Users/{user_sid}/Channels'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams UserChannelInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserChannelInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return UserChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserChannelPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.UserChannelList>' - - -class UserChannelPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the UserChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param user_sid: The sid - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage - """ - super(UserChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance - """ - return UserChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.UserChannelPage>' - - -class UserChannelInstance(InstanceResource): - """ """ - - class ChannelStatus(object): - JOINED = "joined" - INVITED = "invited" - NOT_PARTICIPATING = "not_participating" - - def __init__(self, version, payload, service_sid, user_sid): - """ - Initialize the UserChannelInstance - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance - """ - super(UserChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'channel_sid': payload['channel_sid'], - 'member_sid': payload['member_sid'], - 'status': payload['status'], - 'last_consumed_message_index': deserialize.integer(payload['last_consumed_message_index']), - 'unread_messages_count': deserialize.integer(payload['unread_messages_count']), - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def member_sid(self): - """ - :returns: The member_sid - :rtype: unicode - """ - return self._properties['member_sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: UserChannelInstance.ChannelStatus - """ - return self._properties['status'] - - @property - def last_consumed_message_index(self): - """ - :returns: The last_consumed_message_index - :rtype: unicode - """ - return self._properties['last_consumed_message_index'] - - @property - def unread_messages_count(self): - """ - :returns: The unread_messages_count - :rtype: unicode - """ - return self._properties['unread_messages_count'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Chat.V2.UserChannelInstance>' diff --git a/twilio/rest/fax/__init__.py b/twilio/rest/fax/__init__.py deleted file mode 100644 index d7edde4..0000000 --- a/twilio/rest/fax/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.fax.v1 import V1 - - -class Fax(Domain): - - def __init__(self, twilio): - """ - Initialize the Fax Domain - - :returns: Domain for Fax - :rtype: twilio.rest.fax.Fax - """ - super(Fax, self).__init__(twilio) - - self.base_url = 'https://fax.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of fax - :rtype: twilio.rest.fax.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def faxes(self): - """ - :rtype: twilio.rest.fax.v1.fax.FaxList - """ - return self.v1.faxes - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Fax>' diff --git a/twilio/rest/fax/__pycache__/__init__.cpython-36.pyc b/twilio/rest/fax/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 3ce67e2..0000000 Binary files a/twilio/rest/fax/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/fax/v1/__init__.py b/twilio/rest/fax/v1/__init__.py deleted file mode 100644 index 8ce0420..0000000 --- a/twilio/rest/fax/v1/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.fax.v1.fax import FaxList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Fax - - :returns: V1 version of Fax - :rtype: twilio.rest.fax.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._faxes = None - - @property - def faxes(self): - """ - :rtype: twilio.rest.fax.v1.fax.FaxList - """ - if self._faxes is None: - self._faxes = FaxList(self) - return self._faxes - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Fax.V1>' diff --git a/twilio/rest/fax/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/fax/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 20000e8..0000000 Binary files a/twilio/rest/fax/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/fax/v1/fax/__init__.py b/twilio/rest/fax/v1/fax/__init__.py deleted file mode 100644 index 79200ea..0000000 --- a/twilio/rest/fax/v1/fax/__init__.py +++ /dev/null @@ -1,628 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.fax.v1.fax.fax_media import FaxMediaList - - -class FaxList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the FaxList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.fax.v1.fax.FaxList - :rtype: twilio.rest.fax.v1.fax.FaxList - """ - super(FaxList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Faxes'.format(**self._solution) - - def stream(self, from_=values.unset, to=values.unset, - date_created_on_or_before=values.unset, - date_created_after=values.unset, limit=None, page_size=None): - """ - Streams FaxInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode from_: Include only faxes sent from - :param unicode to: Include only faxes sent to - :param datetime date_created_on_or_before: Include only faxes created on or before - :param datetime date_created_after: Include only faxes created after - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.fax.v1.fax.FaxInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - from_=from_, - to=to, - date_created_on_or_before=date_created_on_or_before, - date_created_after=date_created_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, from_=values.unset, to=values.unset, - date_created_on_or_before=values.unset, - date_created_after=values.unset, limit=None, page_size=None): - """ - Lists FaxInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode from_: Include only faxes sent from - :param unicode to: Include only faxes sent to - :param datetime date_created_on_or_before: Include only faxes created on or before - :param datetime date_created_after: Include only faxes created after - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.fax.v1.fax.FaxInstance] - """ - return list(self.stream( - from_=from_, - to=to, - date_created_on_or_before=date_created_on_or_before, - date_created_after=date_created_after, - limit=limit, - page_size=page_size, - )) - - def page(self, from_=values.unset, to=values.unset, - date_created_on_or_before=values.unset, - date_created_after=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of FaxInstance records from the API. - Request is executed immediately - - :param unicode from_: Include only faxes sent from - :param unicode to: Include only faxes sent to - :param datetime date_created_on_or_before: Include only faxes created on or before - :param datetime date_created_after: Include only faxes created after - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FaxInstance - :rtype: twilio.rest.fax.v1.fax.FaxPage - """ - params = values.of({ - 'From': from_, - 'To': to, - 'DateCreatedOnOrBefore': serialize.iso8601_datetime(date_created_on_or_before), - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return FaxPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FaxInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FaxInstance - :rtype: twilio.rest.fax.v1.fax.FaxPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FaxPage(self._version, response, self._solution) - - def create(self, to, media_url, quality=values.unset, - status_callback=values.unset, from_=values.unset, - sip_auth_username=values.unset, sip_auth_password=values.unset, - store_media=values.unset, ttl=values.unset): - """ - Create a new FaxInstance - - :param unicode to: The phone number or SIP address to send the fax to - :param unicode media_url: URL that points to the fax media - :param FaxInstance.Quality quality: The quality of this fax - :param unicode status_callback: URL for fax status callbacks - :param unicode from_: Twilio number from which to originate the fax - :param unicode sip_auth_username: Username for SIP authentication - :param unicode sip_auth_password: Password for SIP authentication - :param bool store_media: Whether or not to store media - :param unicode ttl: How many minutes to attempt a fax - - :returns: Newly created FaxInstance - :rtype: twilio.rest.fax.v1.fax.FaxInstance - """ - data = values.of({ - 'To': to, - 'MediaUrl': media_url, - 'Quality': quality, - 'StatusCallback': status_callback, - 'From': from_, - 'SipAuthUsername': sip_auth_username, - 'SipAuthPassword': sip_auth_password, - 'StoreMedia': store_media, - 'Ttl': ttl, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return FaxInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a FaxContext - - :param sid: A string that uniquely identifies this fax. - - :returns: twilio.rest.fax.v1.fax.FaxContext - :rtype: twilio.rest.fax.v1.fax.FaxContext - """ - return FaxContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FaxContext - - :param sid: A string that uniquely identifies this fax. - - :returns: twilio.rest.fax.v1.fax.FaxContext - :rtype: twilio.rest.fax.v1.fax.FaxContext - """ - return FaxContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Fax.V1.FaxList>' - - -class FaxPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the FaxPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.fax.v1.fax.FaxPage - :rtype: twilio.rest.fax.v1.fax.FaxPage - """ - super(FaxPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FaxInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.fax.v1.fax.FaxInstance - :rtype: twilio.rest.fax.v1.fax.FaxInstance - """ - return FaxInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Fax.V1.FaxPage>' - - -class FaxContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the FaxContext - - :param Version version: Version that contains the resource - :param sid: A string that uniquely identifies this fax. - - :returns: twilio.rest.fax.v1.fax.FaxContext - :rtype: twilio.rest.fax.v1.fax.FaxContext - """ - super(FaxContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Faxes/{sid}'.format(**self._solution) - - # Dependents - self._media = None - - def fetch(self): - """ - Fetch a FaxInstance - - :returns: Fetched FaxInstance - :rtype: twilio.rest.fax.v1.fax.FaxInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return FaxInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, status=values.unset): - """ - Update the FaxInstance - - :param FaxInstance.UpdateStatus status: The updated status of this fax - - :returns: Updated FaxInstance - :rtype: twilio.rest.fax.v1.fax.FaxInstance - """ - data = values.of({'Status': status, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return FaxInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the FaxInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def media(self): - """ - Access the media - - :returns: twilio.rest.fax.v1.fax.fax_media.FaxMediaList - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaList - """ - if self._media is None: - self._media = FaxMediaList(self._version, fax_sid=self._solution['sid'], ) - return self._media - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Fax.V1.FaxContext {}>'.format(context) - - -class FaxInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Direction(object): - INBOUND = "inbound" - OUTBOUND = "outbound" - - class Quality(object): - STANDARD = "standard" - FINE = "fine" - SUPERFINE = "superfine" - - class Status(object): - QUEUED = "queued" - PROCESSING = "processing" - SENDING = "sending" - DELIVERED = "delivered" - RECEIVING = "receiving" - RECEIVED = "received" - NO_ANSWER = "no-answer" - BUSY = "busy" - FAILED = "failed" - CANCELED = "canceled" - - class UpdateStatus(object): - CANCELED = "canceled" - - def __init__(self, version, payload, sid=None): - """ - Initialize the FaxInstance - - :returns: twilio.rest.fax.v1.fax.FaxInstance - :rtype: twilio.rest.fax.v1.fax.FaxInstance - """ - super(FaxInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'from_': payload['from'], - 'to': payload['to'], - 'quality': payload['quality'], - 'media_sid': payload['media_sid'], - 'media_url': payload['media_url'], - 'num_pages': deserialize.integer(payload['num_pages']), - 'duration': deserialize.integer(payload['duration']), - 'status': payload['status'], - 'direction': payload['direction'], - 'api_version': payload['api_version'], - 'price': deserialize.decimal(payload['price']), - 'price_unit': payload['price_unit'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'links': payload['links'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FaxContext for this FaxInstance - :rtype: twilio.rest.fax.v1.fax.FaxContext - """ - if self._context is None: - self._context = FaxContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this fax. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account SID - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def from_(self): - """ - :returns: The party that sent the fax - :rtype: unicode - """ - return self._properties['from_'] - - @property - def to(self): - """ - :returns: The party that received the fax - :rtype: unicode - """ - return self._properties['to'] - - @property - def quality(self): - """ - :returns: The quality of this fax - :rtype: FaxInstance.Quality - """ - return self._properties['quality'] - - @property - def media_sid(self): - """ - :returns: Media SID - :rtype: unicode - """ - return self._properties['media_sid'] - - @property - def media_url(self): - """ - :returns: URL pointing to fax media - :rtype: unicode - """ - return self._properties['media_url'] - - @property - def num_pages(self): - """ - :returns: Number of pages - :rtype: unicode - """ - return self._properties['num_pages'] - - @property - def duration(self): - """ - :returns: The time taken to transmit the fax - :rtype: unicode - """ - return self._properties['duration'] - - @property - def status(self): - """ - :returns: The status of this fax - :rtype: FaxInstance.Status - """ - return self._properties['status'] - - @property - def direction(self): - """ - :returns: The direction of this fax - :rtype: FaxInstance.Direction - """ - return self._properties['direction'] - - @property - def api_version(self): - """ - :returns: The API version used - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def price(self): - """ - :returns: Fax transmission price - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: Currency used for billing - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def date_created(self): - """ - :returns: The date this fax was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this fax was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def links(self): - """ - :returns: Nested resource URLs - :rtype: unicode - """ - return self._properties['links'] - - @property - def url(self): - """ - :returns: The URL of this resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a FaxInstance - - :returns: Fetched FaxInstance - :rtype: twilio.rest.fax.v1.fax.FaxInstance - """ - return self._proxy.fetch() - - def update(self, status=values.unset): - """ - Update the FaxInstance - - :param FaxInstance.UpdateStatus status: The updated status of this fax - - :returns: Updated FaxInstance - :rtype: twilio.rest.fax.v1.fax.FaxInstance - """ - return self._proxy.update(status=status, ) - - def delete(self): - """ - Deletes the FaxInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def media(self): - """ - Access the media - - :returns: twilio.rest.fax.v1.fax.fax_media.FaxMediaList - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaList - """ - return self._proxy.media - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Fax.V1.FaxInstance {}>'.format(context) diff --git a/twilio/rest/fax/v1/fax/__pycache__/__init__.cpython-36.pyc b/twilio/rest/fax/v1/fax/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 30de4e7..0000000 Binary files a/twilio/rest/fax/v1/fax/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/fax/v1/fax/__pycache__/fax_media.cpython-36.pyc b/twilio/rest/fax/v1/fax/__pycache__/fax_media.cpython-36.pyc deleted file mode 100644 index 7bc070d..0000000 Binary files a/twilio/rest/fax/v1/fax/__pycache__/fax_media.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/fax/v1/fax/fax_media.py b/twilio/rest/fax/v1/fax/fax_media.py deleted file mode 100644 index de42773..0000000 --- a/twilio/rest/fax/v1/fax/fax_media.py +++ /dev/null @@ -1,381 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class FaxMediaList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, fax_sid): - """ - Initialize the FaxMediaList - - :param Version version: Version that contains the resource - :param fax_sid: Fax SID - - :returns: twilio.rest.fax.v1.fax.fax_media.FaxMediaList - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaList - """ - super(FaxMediaList, self).__init__(version) - - # Path Solution - self._solution = {'fax_sid': fax_sid, } - self._uri = '/Faxes/{fax_sid}/Media'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FaxMediaInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.fax.v1.fax.fax_media.FaxMediaInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FaxMediaInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.fax.v1.fax.fax_media.FaxMediaInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FaxMediaInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FaxMediaInstance - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return FaxMediaPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FaxMediaInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FaxMediaInstance - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FaxMediaPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a FaxMediaContext - - :param sid: A string that uniquely identifies this fax media - - :returns: twilio.rest.fax.v1.fax.fax_media.FaxMediaContext - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaContext - """ - return FaxMediaContext(self._version, fax_sid=self._solution['fax_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FaxMediaContext - - :param sid: A string that uniquely identifies this fax media - - :returns: twilio.rest.fax.v1.fax.fax_media.FaxMediaContext - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaContext - """ - return FaxMediaContext(self._version, fax_sid=self._solution['fax_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Fax.V1.FaxMediaList>' - - -class FaxMediaPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the FaxMediaPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param fax_sid: Fax SID - - :returns: twilio.rest.fax.v1.fax.fax_media.FaxMediaPage - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaPage - """ - super(FaxMediaPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FaxMediaInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.fax.v1.fax.fax_media.FaxMediaInstance - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaInstance - """ - return FaxMediaInstance(self._version, payload, fax_sid=self._solution['fax_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Fax.V1.FaxMediaPage>' - - -class FaxMediaContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, fax_sid, sid): - """ - Initialize the FaxMediaContext - - :param Version version: Version that contains the resource - :param fax_sid: Fax SID - :param sid: A string that uniquely identifies this fax media - - :returns: twilio.rest.fax.v1.fax.fax_media.FaxMediaContext - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaContext - """ - super(FaxMediaContext, self).__init__(version) - - # Path Solution - self._solution = {'fax_sid': fax_sid, 'sid': sid, } - self._uri = '/Faxes/{fax_sid}/Media/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a FaxMediaInstance - - :returns: Fetched FaxMediaInstance - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return FaxMediaInstance( - self._version, - payload, - fax_sid=self._solution['fax_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the FaxMediaInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Fax.V1.FaxMediaContext {}>'.format(context) - - -class FaxMediaInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, fax_sid, sid=None): - """ - Initialize the FaxMediaInstance - - :returns: twilio.rest.fax.v1.fax.fax_media.FaxMediaInstance - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaInstance - """ - super(FaxMediaInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'fax_sid': payload['fax_sid'], - 'content_type': payload['content_type'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'fax_sid': fax_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FaxMediaContext for this FaxMediaInstance - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaContext - """ - if self._context is None: - self._context = FaxMediaContext( - self._version, - fax_sid=self._solution['fax_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this fax media - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account SID - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def fax_sid(self): - """ - :returns: Fax SID - :rtype: unicode - """ - return self._properties['fax_sid'] - - @property - def content_type(self): - """ - :returns: Media content type - :rtype: unicode - """ - return self._properties['content_type'] - - @property - def date_created(self): - """ - :returns: The date this fax media was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this fax media was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a FaxMediaInstance - - :returns: Fetched FaxMediaInstance - :rtype: twilio.rest.fax.v1.fax.fax_media.FaxMediaInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the FaxMediaInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Fax.V1.FaxMediaInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/__init__.py b/twilio/rest/ip_messaging/__init__.py deleted file mode 100644 index a425384..0000000 --- a/twilio/rest/ip_messaging/__init__.py +++ /dev/null @@ -1,72 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.ip_messaging.v1 import V1 -from twilio.rest.ip_messaging.v2 import V2 - - -class IpMessaging(Domain): - - def __init__(self, twilio): - """ - Initialize the IpMessaging Domain - - :returns: Domain for IpMessaging - :rtype: twilio.rest.ip_messaging.IpMessaging - """ - super(IpMessaging, self).__init__(twilio) - - self.base_url = 'https://ip-messaging.twilio.com' - - # Versions - self._v1 = None - self._v2 = None - - @property - def v1(self): - """ - :returns: Version v1 of ip_messaging - :rtype: twilio.rest.ip_messaging.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def v2(self): - """ - :returns: Version v2 of ip_messaging - :rtype: twilio.rest.ip_messaging.v2.V2 - """ - if self._v2 is None: - self._v2 = V2(self) - return self._v2 - - @property - def credentials(self): - """ - :rtype: twilio.rest.chat.v2.credential.CredentialList - """ - return self.v2.credentials - - @property - def services(self): - """ - :rtype: twilio.rest.chat.v2.service.ServiceList - """ - return self.v2.services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging>' diff --git a/twilio/rest/ip_messaging/__pycache__/__init__.cpython-36.pyc b/twilio/rest/ip_messaging/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 99678e9..0000000 Binary files a/twilio/rest/ip_messaging/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v1/__init__.py b/twilio/rest/ip_messaging/v1/__init__.py deleted file mode 100644 index 811bc82..0000000 --- a/twilio/rest/ip_messaging/v1/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.ip_messaging.v1.credential import CredentialList -from twilio.rest.ip_messaging.v1.service import ServiceList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of IpMessaging - - :returns: V1 version of IpMessaging - :rtype: twilio.rest.ip_messaging.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._credentials = None - self._services = None - - @property - def credentials(self): - """ - :rtype: twilio.rest.chat.v1.credential.CredentialList - """ - if self._credentials is None: - self._credentials = CredentialList(self) - return self._credentials - - @property - def services(self): - """ - :rtype: twilio.rest.chat.v1.service.ServiceList - """ - if self._services is None: - self._services = ServiceList(self) - return self._services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1>' diff --git a/twilio/rest/ip_messaging/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/ip_messaging/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 0526605..0000000 Binary files a/twilio/rest/ip_messaging/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v1/__pycache__/credential.cpython-36.pyc b/twilio/rest/ip_messaging/v1/__pycache__/credential.cpython-36.pyc deleted file mode 100644 index b6947f6..0000000 Binary files a/twilio/rest/ip_messaging/v1/__pycache__/credential.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v1/credential.py b/twilio/rest/ip_messaging/v1/credential.py deleted file mode 100644 index e5d99ac..0000000 --- a/twilio/rest/ip_messaging/v1/credential.py +++ /dev/null @@ -1,472 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class CredentialList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the CredentialList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.chat.v1.credential.CredentialList - :rtype: twilio.rest.chat.v1.credential.CredentialList - """ - super(CredentialList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Credentials'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.credential.CredentialInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.credential.CredentialInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CredentialPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialPage(self._version, response, self._solution) - - def create(self, type, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Create a new CredentialInstance - - :param CredentialInstance.PushService type: The type - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Newly created CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - data = values.of({ - 'Type': type, - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CredentialInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a CredentialContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.credential.CredentialContext - :rtype: twilio.rest.chat.v1.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CredentialContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.credential.CredentialContext - :rtype: twilio.rest.chat.v1.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.CredentialList>' - - -class CredentialPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the CredentialPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.chat.v1.credential.CredentialPage - :rtype: twilio.rest.chat.v1.credential.CredentialPage - """ - super(CredentialPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.credential.CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - return CredentialInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.CredentialPage>' - - -class CredentialContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the CredentialContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.chat.v1.credential.CredentialContext - :rtype: twilio.rest.chat.v1.credential.CredentialContext - """ - super(CredentialContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Credentials/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a CredentialInstance - - :returns: Fetched CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Updated CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.CredentialContext {}>'.format(context) - - -class CredentialInstance(InstanceResource): - """ """ - - class PushService(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - - def __init__(self, version, payload, sid=None): - """ - Initialize the CredentialInstance - - :returns: twilio.rest.chat.v1.credential.CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - super(CredentialInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'type': payload['type'], - 'sandbox': payload['sandbox'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialContext for this CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialContext - """ - if self._context is None: - self._context = CredentialContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type - :rtype: CredentialInstance.PushService - """ - return self._properties['type'] - - @property - def sandbox(self): - """ - :returns: The sandbox - :rtype: unicode - """ - return self._properties['sandbox'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a CredentialInstance - - :returns: Fetched CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Updated CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - certificate=certificate, - private_key=private_key, - sandbox=sandbox, - api_key=api_key, - secret=secret, - ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.CredentialInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v1/service/__init__.py b/twilio/rest/ip_messaging/v1/service/__init__.py deleted file mode 100644 index 76df879..0000000 --- a/twilio/rest/ip_messaging/v1/service/__init__.py +++ /dev/null @@ -1,1027 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.ip_messaging.v1.service.channel import ChannelList -from twilio.rest.ip_messaging.v1.service.role import RoleList -from twilio.rest.ip_messaging.v1.service.user import UserList - - -class ServiceList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.chat.v1.service.ServiceList - :rtype: twilio.rest.chat.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name): - """ - Create a new ServiceInstance - - :param unicode friendly_name: The friendly_name - - :returns: Newly created ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServicePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.ServiceContext - :rtype: twilio.rest.chat.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.ServiceContext - :rtype: twilio.rest.chat.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.ServiceList>' - - -class ServicePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.chat.v1.service.ServicePage - :rtype: twilio.rest.chat.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.ServicePage>' - - -class ServiceContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.ServiceContext - :rtype: twilio.rest.chat.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._channels = None - self._roles = None - self._users = None - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - webhooks_on_message_send_url=values.unset, - webhooks_on_message_send_method=values.unset, - webhooks_on_message_send_format=values.unset, - webhooks_on_message_update_url=values.unset, - webhooks_on_message_update_method=values.unset, - webhooks_on_message_update_format=values.unset, - webhooks_on_message_remove_url=values.unset, - webhooks_on_message_remove_method=values.unset, - webhooks_on_message_remove_format=values.unset, - webhooks_on_channel_add_url=values.unset, - webhooks_on_channel_add_method=values.unset, - webhooks_on_channel_add_format=values.unset, - webhooks_on_channel_destroy_url=values.unset, - webhooks_on_channel_destroy_method=values.unset, - webhooks_on_channel_destroy_format=values.unset, - webhooks_on_channel_update_url=values.unset, - webhooks_on_channel_update_method=values.unset, - webhooks_on_channel_update_format=values.unset, - webhooks_on_member_add_url=values.unset, - webhooks_on_member_add_method=values.unset, - webhooks_on_member_add_format=values.unset, - webhooks_on_member_remove_url=values.unset, - webhooks_on_member_remove_method=values.unset, - webhooks_on_member_remove_format=values.unset, - webhooks_on_message_sent_url=values.unset, - webhooks_on_message_sent_method=values.unset, - webhooks_on_message_sent_format=values.unset, - webhooks_on_message_updated_url=values.unset, - webhooks_on_message_updated_method=values.unset, - webhooks_on_message_updated_format=values.unset, - webhooks_on_message_removed_url=values.unset, - webhooks_on_message_removed_method=values.unset, - webhooks_on_message_removed_format=values.unset, - webhooks_on_channel_added_url=values.unset, - webhooks_on_channel_added_method=values.unset, - webhooks_on_channel_added_format=values.unset, - webhooks_on_channel_destroyed_url=values.unset, - webhooks_on_channel_destroyed_method=values.unset, - webhooks_on_channel_destroyed_format=values.unset, - webhooks_on_channel_updated_url=values.unset, - webhooks_on_channel_updated_method=values.unset, - webhooks_on_channel_updated_format=values.unset, - webhooks_on_member_added_url=values.unset, - webhooks_on_member_added_method=values.unset, - webhooks_on_member_added_format=values.unset, - webhooks_on_member_removed_url=values.unset, - webhooks_on_member_removed_method=values.unset, - webhooks_on_member_removed_format=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode default_service_role_sid: The default_service_role_sid - :param unicode default_channel_role_sid: The default_channel_role_sid - :param unicode default_channel_creator_role_sid: The default_channel_creator_role_sid - :param bool read_status_enabled: The read_status_enabled - :param bool reachability_enabled: The reachability_enabled - :param unicode typing_indicator_timeout: The typing_indicator_timeout - :param unicode consumption_report_interval: The consumption_report_interval - :param bool notifications_new_message_enabled: The notifications.new_message.enabled - :param unicode notifications_new_message_template: The notifications.new_message.template - :param bool notifications_added_to_channel_enabled: The notifications.added_to_channel.enabled - :param unicode notifications_added_to_channel_template: The notifications.added_to_channel.template - :param bool notifications_removed_from_channel_enabled: The notifications.removed_from_channel.enabled - :param unicode notifications_removed_from_channel_template: The notifications.removed_from_channel.template - :param bool notifications_invited_to_channel_enabled: The notifications.invited_to_channel.enabled - :param unicode notifications_invited_to_channel_template: The notifications.invited_to_channel.template - :param unicode pre_webhook_url: The pre_webhook_url - :param unicode post_webhook_url: The post_webhook_url - :param unicode webhook_method: The webhook_method - :param unicode webhook_filters: The webhook_filters - :param unicode webhooks_on_message_send_url: The webhooks.on_message_send.url - :param unicode webhooks_on_message_send_method: The webhooks.on_message_send.method - :param unicode webhooks_on_message_send_format: The webhooks.on_message_send.format - :param unicode webhooks_on_message_update_url: The webhooks.on_message_update.url - :param unicode webhooks_on_message_update_method: The webhooks.on_message_update.method - :param unicode webhooks_on_message_update_format: The webhooks.on_message_update.format - :param unicode webhooks_on_message_remove_url: The webhooks.on_message_remove.url - :param unicode webhooks_on_message_remove_method: The webhooks.on_message_remove.method - :param unicode webhooks_on_message_remove_format: The webhooks.on_message_remove.format - :param unicode webhooks_on_channel_add_url: The webhooks.on_channel_add.url - :param unicode webhooks_on_channel_add_method: The webhooks.on_channel_add.method - :param unicode webhooks_on_channel_add_format: The webhooks.on_channel_add.format - :param unicode webhooks_on_channel_destroy_url: The webhooks.on_channel_destroy.url - :param unicode webhooks_on_channel_destroy_method: The webhooks.on_channel_destroy.method - :param unicode webhooks_on_channel_destroy_format: The webhooks.on_channel_destroy.format - :param unicode webhooks_on_channel_update_url: The webhooks.on_channel_update.url - :param unicode webhooks_on_channel_update_method: The webhooks.on_channel_update.method - :param unicode webhooks_on_channel_update_format: The webhooks.on_channel_update.format - :param unicode webhooks_on_member_add_url: The webhooks.on_member_add.url - :param unicode webhooks_on_member_add_method: The webhooks.on_member_add.method - :param unicode webhooks_on_member_add_format: The webhooks.on_member_add.format - :param unicode webhooks_on_member_remove_url: The webhooks.on_member_remove.url - :param unicode webhooks_on_member_remove_method: The webhooks.on_member_remove.method - :param unicode webhooks_on_member_remove_format: The webhooks.on_member_remove.format - :param unicode webhooks_on_message_sent_url: The webhooks.on_message_sent.url - :param unicode webhooks_on_message_sent_method: The webhooks.on_message_sent.method - :param unicode webhooks_on_message_sent_format: The webhooks.on_message_sent.format - :param unicode webhooks_on_message_updated_url: The webhooks.on_message_updated.url - :param unicode webhooks_on_message_updated_method: The webhooks.on_message_updated.method - :param unicode webhooks_on_message_updated_format: The webhooks.on_message_updated.format - :param unicode webhooks_on_message_removed_url: The webhooks.on_message_removed.url - :param unicode webhooks_on_message_removed_method: The webhooks.on_message_removed.method - :param unicode webhooks_on_message_removed_format: The webhooks.on_message_removed.format - :param unicode webhooks_on_channel_added_url: The webhooks.on_channel_added.url - :param unicode webhooks_on_channel_added_method: The webhooks.on_channel_added.method - :param unicode webhooks_on_channel_added_format: The webhooks.on_channel_added.format - :param unicode webhooks_on_channel_destroyed_url: The webhooks.on_channel_destroyed.url - :param unicode webhooks_on_channel_destroyed_method: The webhooks.on_channel_destroyed.method - :param unicode webhooks_on_channel_destroyed_format: The webhooks.on_channel_destroyed.format - :param unicode webhooks_on_channel_updated_url: The webhooks.on_channel_updated.url - :param unicode webhooks_on_channel_updated_method: The webhooks.on_channel_updated.method - :param unicode webhooks_on_channel_updated_format: The webhooks.on_channel_updated.format - :param unicode webhooks_on_member_added_url: The webhooks.on_member_added.url - :param unicode webhooks_on_member_added_method: The webhooks.on_member_added.method - :param unicode webhooks_on_member_added_format: The webhooks.on_member_added.format - :param unicode webhooks_on_member_removed_url: The webhooks.on_member_removed.url - :param unicode webhooks_on_member_removed_method: The webhooks.on_member_removed.method - :param unicode webhooks_on_member_removed_format: The webhooks.on_member_removed.format - :param unicode limits_channel_members: The limits.channel_members - :param unicode limits_user_channels: The limits.user_channels - - :returns: Updated ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'DefaultServiceRoleSid': default_service_role_sid, - 'DefaultChannelRoleSid': default_channel_role_sid, - 'DefaultChannelCreatorRoleSid': default_channel_creator_role_sid, - 'ReadStatusEnabled': read_status_enabled, - 'ReachabilityEnabled': reachability_enabled, - 'TypingIndicatorTimeout': typing_indicator_timeout, - 'ConsumptionReportInterval': consumption_report_interval, - 'Notifications.NewMessage.Enabled': notifications_new_message_enabled, - 'Notifications.NewMessage.Template': notifications_new_message_template, - 'Notifications.AddedToChannel.Enabled': notifications_added_to_channel_enabled, - 'Notifications.AddedToChannel.Template': notifications_added_to_channel_template, - 'Notifications.RemovedFromChannel.Enabled': notifications_removed_from_channel_enabled, - 'Notifications.RemovedFromChannel.Template': notifications_removed_from_channel_template, - 'Notifications.InvitedToChannel.Enabled': notifications_invited_to_channel_enabled, - 'Notifications.InvitedToChannel.Template': notifications_invited_to_channel_template, - 'PreWebhookUrl': pre_webhook_url, - 'PostWebhookUrl': post_webhook_url, - 'WebhookMethod': webhook_method, - 'WebhookFilters': serialize.map(webhook_filters, lambda e: e), - 'Webhooks.OnMessageSend.Url': webhooks_on_message_send_url, - 'Webhooks.OnMessageSend.Method': webhooks_on_message_send_method, - 'Webhooks.OnMessageSend.Format': webhooks_on_message_send_format, - 'Webhooks.OnMessageUpdate.Url': webhooks_on_message_update_url, - 'Webhooks.OnMessageUpdate.Method': webhooks_on_message_update_method, - 'Webhooks.OnMessageUpdate.Format': webhooks_on_message_update_format, - 'Webhooks.OnMessageRemove.Url': webhooks_on_message_remove_url, - 'Webhooks.OnMessageRemove.Method': webhooks_on_message_remove_method, - 'Webhooks.OnMessageRemove.Format': webhooks_on_message_remove_format, - 'Webhooks.OnChannelAdd.Url': webhooks_on_channel_add_url, - 'Webhooks.OnChannelAdd.Method': webhooks_on_channel_add_method, - 'Webhooks.OnChannelAdd.Format': webhooks_on_channel_add_format, - 'Webhooks.OnChannelDestroy.Url': webhooks_on_channel_destroy_url, - 'Webhooks.OnChannelDestroy.Method': webhooks_on_channel_destroy_method, - 'Webhooks.OnChannelDestroy.Format': webhooks_on_channel_destroy_format, - 'Webhooks.OnChannelUpdate.Url': webhooks_on_channel_update_url, - 'Webhooks.OnChannelUpdate.Method': webhooks_on_channel_update_method, - 'Webhooks.OnChannelUpdate.Format': webhooks_on_channel_update_format, - 'Webhooks.OnMemberAdd.Url': webhooks_on_member_add_url, - 'Webhooks.OnMemberAdd.Method': webhooks_on_member_add_method, - 'Webhooks.OnMemberAdd.Format': webhooks_on_member_add_format, - 'Webhooks.OnMemberRemove.Url': webhooks_on_member_remove_url, - 'Webhooks.OnMemberRemove.Method': webhooks_on_member_remove_method, - 'Webhooks.OnMemberRemove.Format': webhooks_on_member_remove_format, - 'Webhooks.OnMessageSent.Url': webhooks_on_message_sent_url, - 'Webhooks.OnMessageSent.Method': webhooks_on_message_sent_method, - 'Webhooks.OnMessageSent.Format': webhooks_on_message_sent_format, - 'Webhooks.OnMessageUpdated.Url': webhooks_on_message_updated_url, - 'Webhooks.OnMessageUpdated.Method': webhooks_on_message_updated_method, - 'Webhooks.OnMessageUpdated.Format': webhooks_on_message_updated_format, - 'Webhooks.OnMessageRemoved.Url': webhooks_on_message_removed_url, - 'Webhooks.OnMessageRemoved.Method': webhooks_on_message_removed_method, - 'Webhooks.OnMessageRemoved.Format': webhooks_on_message_removed_format, - 'Webhooks.OnChannelAdded.Url': webhooks_on_channel_added_url, - 'Webhooks.OnChannelAdded.Method': webhooks_on_channel_added_method, - 'Webhooks.OnChannelAdded.Format': webhooks_on_channel_added_format, - 'Webhooks.OnChannelDestroyed.Url': webhooks_on_channel_destroyed_url, - 'Webhooks.OnChannelDestroyed.Method': webhooks_on_channel_destroyed_method, - 'Webhooks.OnChannelDestroyed.Format': webhooks_on_channel_destroyed_format, - 'Webhooks.OnChannelUpdated.Url': webhooks_on_channel_updated_url, - 'Webhooks.OnChannelUpdated.Method': webhooks_on_channel_updated_method, - 'Webhooks.OnChannelUpdated.Format': webhooks_on_channel_updated_format, - 'Webhooks.OnMemberAdded.Url': webhooks_on_member_added_url, - 'Webhooks.OnMemberAdded.Method': webhooks_on_member_added_method, - 'Webhooks.OnMemberAdded.Format': webhooks_on_member_added_format, - 'Webhooks.OnMemberRemoved.Url': webhooks_on_member_removed_url, - 'Webhooks.OnMemberRemoved.Method': webhooks_on_member_removed_method, - 'Webhooks.OnMemberRemoved.Format': webhooks_on_member_removed_format, - 'Limits.ChannelMembers': limits_channel_members, - 'Limits.UserChannels': limits_user_channels, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def channels(self): - """ - Access the channels - - :returns: twilio.rest.chat.v1.service.channel.ChannelList - :rtype: twilio.rest.chat.v1.service.channel.ChannelList - """ - if self._channels is None: - self._channels = ChannelList(self._version, service_sid=self._solution['sid'], ) - return self._channels - - @property - def roles(self): - """ - Access the roles - - :returns: twilio.rest.chat.v1.service.role.RoleList - :rtype: twilio.rest.chat.v1.service.role.RoleList - """ - if self._roles is None: - self._roles = RoleList(self._version, service_sid=self._solution['sid'], ) - return self._roles - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.chat.v1.service.user.UserList - :rtype: twilio.rest.chat.v1.service.user.UserList - """ - if self._users is None: - self._users = UserList(self._version, service_sid=self._solution['sid'], ) - return self._users - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.ServiceContext {}>'.format(context) - - -class ServiceInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.chat.v1.service.ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'default_service_role_sid': payload['default_service_role_sid'], - 'default_channel_role_sid': payload['default_channel_role_sid'], - 'default_channel_creator_role_sid': payload['default_channel_creator_role_sid'], - 'read_status_enabled': payload['read_status_enabled'], - 'reachability_enabled': payload['reachability_enabled'], - 'typing_indicator_timeout': deserialize.integer(payload['typing_indicator_timeout']), - 'consumption_report_interval': deserialize.integer(payload['consumption_report_interval']), - 'limits': payload['limits'], - 'webhooks': payload['webhooks'], - 'pre_webhook_url': payload['pre_webhook_url'], - 'post_webhook_url': payload['post_webhook_url'], - 'webhook_method': payload['webhook_method'], - 'webhook_filters': payload['webhook_filters'], - 'notifications': payload['notifications'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceContext - """ - if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def default_service_role_sid(self): - """ - :returns: The default_service_role_sid - :rtype: unicode - """ - return self._properties['default_service_role_sid'] - - @property - def default_channel_role_sid(self): - """ - :returns: The default_channel_role_sid - :rtype: unicode - """ - return self._properties['default_channel_role_sid'] - - @property - def default_channel_creator_role_sid(self): - """ - :returns: The default_channel_creator_role_sid - :rtype: unicode - """ - return self._properties['default_channel_creator_role_sid'] - - @property - def read_status_enabled(self): - """ - :returns: The read_status_enabled - :rtype: bool - """ - return self._properties['read_status_enabled'] - - @property - def reachability_enabled(self): - """ - :returns: The reachability_enabled - :rtype: bool - """ - return self._properties['reachability_enabled'] - - @property - def typing_indicator_timeout(self): - """ - :returns: The typing_indicator_timeout - :rtype: unicode - """ - return self._properties['typing_indicator_timeout'] - - @property - def consumption_report_interval(self): - """ - :returns: The consumption_report_interval - :rtype: unicode - """ - return self._properties['consumption_report_interval'] - - @property - def limits(self): - """ - :returns: The limits - :rtype: dict - """ - return self._properties['limits'] - - @property - def webhooks(self): - """ - :returns: The webhooks - :rtype: dict - """ - return self._properties['webhooks'] - - @property - def pre_webhook_url(self): - """ - :returns: The pre_webhook_url - :rtype: unicode - """ - return self._properties['pre_webhook_url'] - - @property - def post_webhook_url(self): - """ - :returns: The post_webhook_url - :rtype: unicode - """ - return self._properties['post_webhook_url'] - - @property - def webhook_method(self): - """ - :returns: The webhook_method - :rtype: unicode - """ - return self._properties['webhook_method'] - - @property - def webhook_filters(self): - """ - :returns: The webhook_filters - :rtype: unicode - """ - return self._properties['webhook_filters'] - - @property - def notifications(self): - """ - :returns: The notifications - :rtype: dict - """ - return self._properties['notifications'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - webhooks_on_message_send_url=values.unset, - webhooks_on_message_send_method=values.unset, - webhooks_on_message_send_format=values.unset, - webhooks_on_message_update_url=values.unset, - webhooks_on_message_update_method=values.unset, - webhooks_on_message_update_format=values.unset, - webhooks_on_message_remove_url=values.unset, - webhooks_on_message_remove_method=values.unset, - webhooks_on_message_remove_format=values.unset, - webhooks_on_channel_add_url=values.unset, - webhooks_on_channel_add_method=values.unset, - webhooks_on_channel_add_format=values.unset, - webhooks_on_channel_destroy_url=values.unset, - webhooks_on_channel_destroy_method=values.unset, - webhooks_on_channel_destroy_format=values.unset, - webhooks_on_channel_update_url=values.unset, - webhooks_on_channel_update_method=values.unset, - webhooks_on_channel_update_format=values.unset, - webhooks_on_member_add_url=values.unset, - webhooks_on_member_add_method=values.unset, - webhooks_on_member_add_format=values.unset, - webhooks_on_member_remove_url=values.unset, - webhooks_on_member_remove_method=values.unset, - webhooks_on_member_remove_format=values.unset, - webhooks_on_message_sent_url=values.unset, - webhooks_on_message_sent_method=values.unset, - webhooks_on_message_sent_format=values.unset, - webhooks_on_message_updated_url=values.unset, - webhooks_on_message_updated_method=values.unset, - webhooks_on_message_updated_format=values.unset, - webhooks_on_message_removed_url=values.unset, - webhooks_on_message_removed_method=values.unset, - webhooks_on_message_removed_format=values.unset, - webhooks_on_channel_added_url=values.unset, - webhooks_on_channel_added_method=values.unset, - webhooks_on_channel_added_format=values.unset, - webhooks_on_channel_destroyed_url=values.unset, - webhooks_on_channel_destroyed_method=values.unset, - webhooks_on_channel_destroyed_format=values.unset, - webhooks_on_channel_updated_url=values.unset, - webhooks_on_channel_updated_method=values.unset, - webhooks_on_channel_updated_format=values.unset, - webhooks_on_member_added_url=values.unset, - webhooks_on_member_added_method=values.unset, - webhooks_on_member_added_format=values.unset, - webhooks_on_member_removed_url=values.unset, - webhooks_on_member_removed_method=values.unset, - webhooks_on_member_removed_format=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode default_service_role_sid: The default_service_role_sid - :param unicode default_channel_role_sid: The default_channel_role_sid - :param unicode default_channel_creator_role_sid: The default_channel_creator_role_sid - :param bool read_status_enabled: The read_status_enabled - :param bool reachability_enabled: The reachability_enabled - :param unicode typing_indicator_timeout: The typing_indicator_timeout - :param unicode consumption_report_interval: The consumption_report_interval - :param bool notifications_new_message_enabled: The notifications.new_message.enabled - :param unicode notifications_new_message_template: The notifications.new_message.template - :param bool notifications_added_to_channel_enabled: The notifications.added_to_channel.enabled - :param unicode notifications_added_to_channel_template: The notifications.added_to_channel.template - :param bool notifications_removed_from_channel_enabled: The notifications.removed_from_channel.enabled - :param unicode notifications_removed_from_channel_template: The notifications.removed_from_channel.template - :param bool notifications_invited_to_channel_enabled: The notifications.invited_to_channel.enabled - :param unicode notifications_invited_to_channel_template: The notifications.invited_to_channel.template - :param unicode pre_webhook_url: The pre_webhook_url - :param unicode post_webhook_url: The post_webhook_url - :param unicode webhook_method: The webhook_method - :param unicode webhook_filters: The webhook_filters - :param unicode webhooks_on_message_send_url: The webhooks.on_message_send.url - :param unicode webhooks_on_message_send_method: The webhooks.on_message_send.method - :param unicode webhooks_on_message_send_format: The webhooks.on_message_send.format - :param unicode webhooks_on_message_update_url: The webhooks.on_message_update.url - :param unicode webhooks_on_message_update_method: The webhooks.on_message_update.method - :param unicode webhooks_on_message_update_format: The webhooks.on_message_update.format - :param unicode webhooks_on_message_remove_url: The webhooks.on_message_remove.url - :param unicode webhooks_on_message_remove_method: The webhooks.on_message_remove.method - :param unicode webhooks_on_message_remove_format: The webhooks.on_message_remove.format - :param unicode webhooks_on_channel_add_url: The webhooks.on_channel_add.url - :param unicode webhooks_on_channel_add_method: The webhooks.on_channel_add.method - :param unicode webhooks_on_channel_add_format: The webhooks.on_channel_add.format - :param unicode webhooks_on_channel_destroy_url: The webhooks.on_channel_destroy.url - :param unicode webhooks_on_channel_destroy_method: The webhooks.on_channel_destroy.method - :param unicode webhooks_on_channel_destroy_format: The webhooks.on_channel_destroy.format - :param unicode webhooks_on_channel_update_url: The webhooks.on_channel_update.url - :param unicode webhooks_on_channel_update_method: The webhooks.on_channel_update.method - :param unicode webhooks_on_channel_update_format: The webhooks.on_channel_update.format - :param unicode webhooks_on_member_add_url: The webhooks.on_member_add.url - :param unicode webhooks_on_member_add_method: The webhooks.on_member_add.method - :param unicode webhooks_on_member_add_format: The webhooks.on_member_add.format - :param unicode webhooks_on_member_remove_url: The webhooks.on_member_remove.url - :param unicode webhooks_on_member_remove_method: The webhooks.on_member_remove.method - :param unicode webhooks_on_member_remove_format: The webhooks.on_member_remove.format - :param unicode webhooks_on_message_sent_url: The webhooks.on_message_sent.url - :param unicode webhooks_on_message_sent_method: The webhooks.on_message_sent.method - :param unicode webhooks_on_message_sent_format: The webhooks.on_message_sent.format - :param unicode webhooks_on_message_updated_url: The webhooks.on_message_updated.url - :param unicode webhooks_on_message_updated_method: The webhooks.on_message_updated.method - :param unicode webhooks_on_message_updated_format: The webhooks.on_message_updated.format - :param unicode webhooks_on_message_removed_url: The webhooks.on_message_removed.url - :param unicode webhooks_on_message_removed_method: The webhooks.on_message_removed.method - :param unicode webhooks_on_message_removed_format: The webhooks.on_message_removed.format - :param unicode webhooks_on_channel_added_url: The webhooks.on_channel_added.url - :param unicode webhooks_on_channel_added_method: The webhooks.on_channel_added.method - :param unicode webhooks_on_channel_added_format: The webhooks.on_channel_added.format - :param unicode webhooks_on_channel_destroyed_url: The webhooks.on_channel_destroyed.url - :param unicode webhooks_on_channel_destroyed_method: The webhooks.on_channel_destroyed.method - :param unicode webhooks_on_channel_destroyed_format: The webhooks.on_channel_destroyed.format - :param unicode webhooks_on_channel_updated_url: The webhooks.on_channel_updated.url - :param unicode webhooks_on_channel_updated_method: The webhooks.on_channel_updated.method - :param unicode webhooks_on_channel_updated_format: The webhooks.on_channel_updated.format - :param unicode webhooks_on_member_added_url: The webhooks.on_member_added.url - :param unicode webhooks_on_member_added_method: The webhooks.on_member_added.method - :param unicode webhooks_on_member_added_format: The webhooks.on_member_added.format - :param unicode webhooks_on_member_removed_url: The webhooks.on_member_removed.url - :param unicode webhooks_on_member_removed_method: The webhooks.on_member_removed.method - :param unicode webhooks_on_member_removed_format: The webhooks.on_member_removed.format - :param unicode limits_channel_members: The limits.channel_members - :param unicode limits_user_channels: The limits.user_channels - - :returns: Updated ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - default_service_role_sid=default_service_role_sid, - default_channel_role_sid=default_channel_role_sid, - default_channel_creator_role_sid=default_channel_creator_role_sid, - read_status_enabled=read_status_enabled, - reachability_enabled=reachability_enabled, - typing_indicator_timeout=typing_indicator_timeout, - consumption_report_interval=consumption_report_interval, - notifications_new_message_enabled=notifications_new_message_enabled, - notifications_new_message_template=notifications_new_message_template, - notifications_added_to_channel_enabled=notifications_added_to_channel_enabled, - notifications_added_to_channel_template=notifications_added_to_channel_template, - notifications_removed_from_channel_enabled=notifications_removed_from_channel_enabled, - notifications_removed_from_channel_template=notifications_removed_from_channel_template, - notifications_invited_to_channel_enabled=notifications_invited_to_channel_enabled, - notifications_invited_to_channel_template=notifications_invited_to_channel_template, - pre_webhook_url=pre_webhook_url, - post_webhook_url=post_webhook_url, - webhook_method=webhook_method, - webhook_filters=webhook_filters, - webhooks_on_message_send_url=webhooks_on_message_send_url, - webhooks_on_message_send_method=webhooks_on_message_send_method, - webhooks_on_message_send_format=webhooks_on_message_send_format, - webhooks_on_message_update_url=webhooks_on_message_update_url, - webhooks_on_message_update_method=webhooks_on_message_update_method, - webhooks_on_message_update_format=webhooks_on_message_update_format, - webhooks_on_message_remove_url=webhooks_on_message_remove_url, - webhooks_on_message_remove_method=webhooks_on_message_remove_method, - webhooks_on_message_remove_format=webhooks_on_message_remove_format, - webhooks_on_channel_add_url=webhooks_on_channel_add_url, - webhooks_on_channel_add_method=webhooks_on_channel_add_method, - webhooks_on_channel_add_format=webhooks_on_channel_add_format, - webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, - webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, - webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, - webhooks_on_channel_update_url=webhooks_on_channel_update_url, - webhooks_on_channel_update_method=webhooks_on_channel_update_method, - webhooks_on_channel_update_format=webhooks_on_channel_update_format, - webhooks_on_member_add_url=webhooks_on_member_add_url, - webhooks_on_member_add_method=webhooks_on_member_add_method, - webhooks_on_member_add_format=webhooks_on_member_add_format, - webhooks_on_member_remove_url=webhooks_on_member_remove_url, - webhooks_on_member_remove_method=webhooks_on_member_remove_method, - webhooks_on_member_remove_format=webhooks_on_member_remove_format, - webhooks_on_message_sent_url=webhooks_on_message_sent_url, - webhooks_on_message_sent_method=webhooks_on_message_sent_method, - webhooks_on_message_sent_format=webhooks_on_message_sent_format, - webhooks_on_message_updated_url=webhooks_on_message_updated_url, - webhooks_on_message_updated_method=webhooks_on_message_updated_method, - webhooks_on_message_updated_format=webhooks_on_message_updated_format, - webhooks_on_message_removed_url=webhooks_on_message_removed_url, - webhooks_on_message_removed_method=webhooks_on_message_removed_method, - webhooks_on_message_removed_format=webhooks_on_message_removed_format, - webhooks_on_channel_added_url=webhooks_on_channel_added_url, - webhooks_on_channel_added_method=webhooks_on_channel_added_method, - webhooks_on_channel_added_format=webhooks_on_channel_added_format, - webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, - webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, - webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, - webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, - webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, - webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, - webhooks_on_member_added_url=webhooks_on_member_added_url, - webhooks_on_member_added_method=webhooks_on_member_added_method, - webhooks_on_member_added_format=webhooks_on_member_added_format, - webhooks_on_member_removed_url=webhooks_on_member_removed_url, - webhooks_on_member_removed_method=webhooks_on_member_removed_method, - webhooks_on_member_removed_format=webhooks_on_member_removed_format, - limits_channel_members=limits_channel_members, - limits_user_channels=limits_user_channels, - ) - - @property - def channels(self): - """ - Access the channels - - :returns: twilio.rest.chat.v1.service.channel.ChannelList - :rtype: twilio.rest.chat.v1.service.channel.ChannelList - """ - return self._proxy.channels - - @property - def roles(self): - """ - Access the roles - - :returns: twilio.rest.chat.v1.service.role.RoleList - :rtype: twilio.rest.chat.v1.service.role.RoleList - """ - return self._proxy.roles - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.chat.v1.service.user.UserList - :rtype: twilio.rest.chat.v1.service.user.UserList - """ - return self._proxy.users - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.ServiceInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v1/service/__pycache__/__init__.cpython-36.pyc b/twilio/rest/ip_messaging/v1/service/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 1545327..0000000 Binary files a/twilio/rest/ip_messaging/v1/service/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v1/service/__pycache__/role.cpython-36.pyc b/twilio/rest/ip_messaging/v1/service/__pycache__/role.cpython-36.pyc deleted file mode 100644 index ddcec71..0000000 Binary files a/twilio/rest/ip_messaging/v1/service/__pycache__/role.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v1/service/channel/__init__.py b/twilio/rest/ip_messaging/v1/service/channel/__init__.py deleted file mode 100644 index 4be634d..0000000 --- a/twilio/rest/ip_messaging/v1/service/channel/__init__.py +++ /dev/null @@ -1,616 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.ip_messaging.v1.service.channel.invite import InviteList -from twilio.rest.ip_messaging.v1.service.channel.member import MemberList -from twilio.rest.ip_messaging.v1.service.channel.message import MessageList - - -class ChannelList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the ChannelList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v1.service.channel.ChannelList - :rtype: twilio.rest.chat.v1.service.channel.ChannelList - """ - super(ChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Channels'.format(**self._solution) - - def create(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, type=values.unset): - """ - Create a new ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - :param ChannelInstance.ChannelType type: The type - - :returns: Newly created ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - 'Type': type, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, type=values.unset, limit=None, page_size=None): - """ - Streams ChannelInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param ChannelInstance.ChannelType type: The type - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.ChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(type=type, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, type=values.unset, limit=None, page_size=None): - """ - Lists ChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param ChannelInstance.ChannelType type: The type - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.ChannelInstance] - """ - return list(self.stream(type=type, limit=limit, page_size=page_size, )) - - def page(self, type=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ChannelInstance records from the API. - Request is executed immediately - - :param ChannelInstance.ChannelType type: The type - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelPage - """ - params = values.of({ - 'Type': serialize.map(type, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ChannelPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ChannelContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.ChannelContext - :rtype: twilio.rest.chat.v1.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ChannelContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.ChannelContext - :rtype: twilio.rest.chat.v1.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.ChannelList>' - - -class ChannelPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v1.service.channel.ChannelPage - :rtype: twilio.rest.chat.v1.service.channel.ChannelPage - """ - super(ChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.channel.ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.ChannelPage>' - - -class ChannelContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the ChannelContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.ChannelContext - :rtype: twilio.rest.chat.v1.service.channel.ChannelContext - """ - super(ChannelContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{sid}'.format(**self._solution) - - # Dependents - self._members = None - self._messages = None - self._invites = None - - def fetch(self): - """ - Fetch a ChannelInstance - - :returns: Fetched ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the ChannelInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset): - """ - Update the ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - - :returns: Updated ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def members(self): - """ - Access the members - - :returns: twilio.rest.chat.v1.service.channel.member.MemberList - :rtype: twilio.rest.chat.v1.service.channel.member.MemberList - """ - if self._members is None: - self._members = MemberList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._members - - @property - def messages(self): - """ - Access the messages - - :returns: twilio.rest.chat.v1.service.channel.message.MessageList - :rtype: twilio.rest.chat.v1.service.channel.message.MessageList - """ - if self._messages is None: - self._messages = MessageList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._messages - - @property - def invites(self): - """ - Access the invites - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteList - """ - if self._invites is None: - self._invites = InviteList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._invites - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.ChannelContext {}>'.format(context) - - -class ChannelInstance(InstanceResource): - """ """ - - class ChannelType(object): - PUBLIC = "public" - PRIVATE = "private" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ChannelInstance - - :returns: twilio.rest.chat.v1.service.channel.ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - super(ChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'friendly_name': payload['friendly_name'], - 'unique_name': payload['unique_name'], - 'attributes': payload['attributes'], - 'type': payload['type'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - 'members_count': deserialize.integer(payload['members_count']), - 'messages_count': deserialize.integer(payload['messages_count']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ChannelContext for this ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelContext - """ - if self._context is None: - self._context = ChannelContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def type(self): - """ - :returns: The type - :rtype: ChannelInstance.ChannelType - """ - return self._properties['type'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def members_count(self): - """ - :returns: The members_count - :rtype: unicode - """ - return self._properties['members_count'] - - @property - def messages_count(self): - """ - :returns: The messages_count - :rtype: unicode - """ - return self._properties['messages_count'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ChannelInstance - - :returns: Fetched ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ChannelInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset): - """ - Update the ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - - :returns: Updated ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - unique_name=unique_name, - attributes=attributes, - ) - - @property - def members(self): - """ - Access the members - - :returns: twilio.rest.chat.v1.service.channel.member.MemberList - :rtype: twilio.rest.chat.v1.service.channel.member.MemberList - """ - return self._proxy.members - - @property - def messages(self): - """ - Access the messages - - :returns: twilio.rest.chat.v1.service.channel.message.MessageList - :rtype: twilio.rest.chat.v1.service.channel.message.MessageList - """ - return self._proxy.messages - - @property - def invites(self): - """ - Access the invites - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteList - """ - return self._proxy.invites - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.ChannelInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v1/service/channel/__pycache__/__init__.cpython-36.pyc b/twilio/rest/ip_messaging/v1/service/channel/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 0892eb1..0000000 Binary files a/twilio/rest/ip_messaging/v1/service/channel/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v1/service/channel/__pycache__/invite.cpython-36.pyc b/twilio/rest/ip_messaging/v1/service/channel/__pycache__/invite.cpython-36.pyc deleted file mode 100644 index c5d3c2c..0000000 Binary files a/twilio/rest/ip_messaging/v1/service/channel/__pycache__/invite.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v1/service/channel/__pycache__/member.cpython-36.pyc b/twilio/rest/ip_messaging/v1/service/channel/__pycache__/member.cpython-36.pyc deleted file mode 100644 index 97182cb..0000000 Binary files a/twilio/rest/ip_messaging/v1/service/channel/__pycache__/member.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v1/service/channel/__pycache__/message.cpython-36.pyc b/twilio/rest/ip_messaging/v1/service/channel/__pycache__/message.cpython-36.pyc deleted file mode 100644 index 9913166..0000000 Binary files a/twilio/rest/ip_messaging/v1/service/channel/__pycache__/message.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v1/service/channel/invite.py b/twilio/rest/ip_messaging/v1/service/channel/invite.py deleted file mode 100644 index 3f6e695..0000000 --- a/twilio/rest/ip_messaging/v1/service/channel/invite.py +++ /dev/null @@ -1,462 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class InviteList(ListResource): - """ """ - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the InviteList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteList - """ - super(InviteList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Invites'.format(**self._solution) - - def create(self, identity, role_sid=values.unset): - """ - Create a new InviteInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - - :returns: Newly created InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - data = values.of({'Identity': identity, 'RoleSid': role_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, identity=values.unset, limit=None, page_size=None): - """ - Streams InviteInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.invite.InviteInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, identity=values.unset, limit=None, page_size=None): - """ - Lists InviteInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.invite.InviteInstance] - """ - return list(self.stream(identity=identity, limit=limit, page_size=page_size, )) - - def page(self, identity=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of InviteInstance records from the API. - Request is executed immediately - - :param unicode identity: The identity - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InvitePage - """ - params = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return InvitePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of InviteInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InvitePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InvitePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InviteContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteContext - """ - return InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a InviteContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteContext - """ - return InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.InviteList>' - - -class InvitePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the InvitePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v1.service.channel.invite.InvitePage - :rtype: twilio.rest.chat.v1.service.channel.invite.InvitePage - """ - super(InvitePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InviteInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.InvitePage>' - - -class InviteContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the InviteContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteContext - """ - super(InviteContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Invites/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a InviteInstance - - :returns: Fetched InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the InviteInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.InviteContext {}>'.format(context) - - -class InviteInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the InviteInstance - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - super(InviteInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'channel_sid': payload['channel_sid'], - 'service_sid': payload['service_sid'], - 'identity': payload['identity'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'role_sid': payload['role_sid'], - 'created_by': payload['created_by'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InviteContext for this InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteContext - """ - if self._context is None: - self._context = InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a InviteInstance - - :returns: Fetched InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the InviteInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.InviteInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v1/service/channel/member.py b/twilio/rest/ip_messaging/v1/service/channel/member.py deleted file mode 100644 index a2cfe54..0000000 --- a/twilio/rest/ip_messaging/v1/service/channel/member.py +++ /dev/null @@ -1,514 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class MemberList(ListResource): - """ """ - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the MemberList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v1.service.channel.member.MemberList - :rtype: twilio.rest.chat.v1.service.channel.member.MemberList - """ - super(MemberList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Members'.format(**self._solution) - - def create(self, identity, role_sid=values.unset): - """ - Create a new MemberInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - - :returns: Newly created MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - data = values.of({'Identity': identity, 'RoleSid': role_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, identity=values.unset, limit=None, page_size=None): - """ - Streams MemberInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.member.MemberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, identity=values.unset, limit=None, page_size=None): - """ - Lists MemberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.member.MemberInstance] - """ - return list(self.stream(identity=identity, limit=limit, page_size=page_size, )) - - def page(self, identity=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MemberInstance records from the API. - Request is executed immediately - - :param unicode identity: The identity - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberPage - """ - params = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MemberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MemberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MemberPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MemberContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext - """ - return MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MemberContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext - """ - return MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.MemberList>' - - -class MemberPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MemberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v1.service.channel.member.MemberPage - :rtype: twilio.rest.chat.v1.service.channel.member.MemberPage - """ - super(MemberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MemberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.channel.member.MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.MemberPage>' - - -class MemberContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the MemberContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext - """ - super(MemberContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Members/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a MemberInstance - - :returns: Fetched MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the MemberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, role_sid=values.unset, - last_consumed_message_index=values.unset): - """ - Update the MemberInstance - - :param unicode role_sid: The role_sid - :param unicode last_consumed_message_index: The last_consumed_message_index - - :returns: Updated MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - data = values.of({'RoleSid': role_sid, 'LastConsumedMessageIndex': last_consumed_message_index, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.MemberContext {}>'.format(context) - - -class MemberInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the MemberInstance - - :returns: twilio.rest.chat.v1.service.channel.member.MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - super(MemberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'channel_sid': payload['channel_sid'], - 'service_sid': payload['service_sid'], - 'identity': payload['identity'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'role_sid': payload['role_sid'], - 'last_consumed_message_index': deserialize.integer(payload['last_consumed_message_index']), - 'last_consumption_timestamp': deserialize.iso8601_datetime(payload['last_consumption_timestamp']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MemberContext for this MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext - """ - if self._context is None: - self._context = MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def last_consumed_message_index(self): - """ - :returns: The last_consumed_message_index - :rtype: unicode - """ - return self._properties['last_consumed_message_index'] - - @property - def last_consumption_timestamp(self): - """ - :returns: The last_consumption_timestamp - :rtype: datetime - """ - return self._properties['last_consumption_timestamp'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a MemberInstance - - :returns: Fetched MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the MemberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, role_sid=values.unset, - last_consumed_message_index=values.unset): - """ - Update the MemberInstance - - :param unicode role_sid: The role_sid - :param unicode last_consumed_message_index: The last_consumed_message_index - - :returns: Updated MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - return self._proxy.update( - role_sid=role_sid, - last_consumed_message_index=last_consumed_message_index, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.MemberInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v1/service/channel/message.py b/twilio/rest/ip_messaging/v1/service/channel/message.py deleted file mode 100644 index cf450af..0000000 --- a/twilio/rest/ip_messaging/v1/service/channel/message.py +++ /dev/null @@ -1,531 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class MessageList(ListResource): - """ """ - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the MessageList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v1.service.channel.message.MessageList - :rtype: twilio.rest.chat.v1.service.channel.message.MessageList - """ - super(MessageList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Messages'.format(**self._solution) - - def create(self, body, from_=values.unset, attributes=values.unset): - """ - Create a new MessageInstance - - :param unicode body: The body - :param unicode from_: The from - :param unicode attributes: The attributes - - :returns: Newly created MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - data = values.of({'Body': body, 'From': from_, 'Attributes': attributes, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, order=values.unset, limit=None, page_size=None): - """ - Streams MessageInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param MessageInstance.OrderType order: The order - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.message.MessageInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, order=values.unset, limit=None, page_size=None): - """ - Lists MessageInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param MessageInstance.OrderType order: The order - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.message.MessageInstance] - """ - return list(self.stream(order=order, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MessageInstance records from the API. - Request is executed immediately - - :param MessageInstance.OrderType order: The order - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage - """ - params = values.of({ - 'Order': order, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MessagePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessageInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessagePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MessageContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext - """ - return MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MessageContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext - """ - return MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.MessageList>' - - -class MessagePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MessagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v1.service.channel.message.MessagePage - :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage - """ - super(MessagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessageInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.channel.message.MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.MessagePage>' - - -class MessageContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the MessageContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext - """ - super(MessageContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Messages/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a MessageInstance - - :returns: Fetched MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, body=values.unset, attributes=values.unset): - """ - Update the MessageInstance - - :param unicode body: The body - :param unicode attributes: The attributes - - :returns: Updated MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - data = values.of({'Body': body, 'Attributes': attributes, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.MessageContext {}>'.format(context) - - -class MessageInstance(InstanceResource): - """ """ - - class OrderType(object): - ASC = "asc" - DESC = "desc" - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the MessageInstance - - :returns: twilio.rest.chat.v1.service.channel.message.MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - super(MessageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'attributes': payload['attributes'], - 'service_sid': payload['service_sid'], - 'to': payload['to'], - 'channel_sid': payload['channel_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'was_edited': payload['was_edited'], - 'from_': payload['from'], - 'body': payload['body'], - 'index': deserialize.integer(payload['index']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessageContext for this MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext - """ - if self._context is None: - self._context = MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def to(self): - """ - :returns: The to - :rtype: unicode - """ - return self._properties['to'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def was_edited(self): - """ - :returns: The was_edited - :rtype: bool - """ - return self._properties['was_edited'] - - @property - def from_(self): - """ - :returns: The from - :rtype: unicode - """ - return self._properties['from_'] - - @property - def body(self): - """ - :returns: The body - :rtype: unicode - """ - return self._properties['body'] - - @property - def index(self): - """ - :returns: The index - :rtype: unicode - """ - return self._properties['index'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a MessageInstance - - :returns: Fetched MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, body=values.unset, attributes=values.unset): - """ - Update the MessageInstance - - :param unicode body: The body - :param unicode attributes: The attributes - - :returns: Updated MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - return self._proxy.update(body=body, attributes=attributes, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.MessageInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v1/service/role.py b/twilio/rest/ip_messaging/v1/service/role.py deleted file mode 100644 index ff62493..0000000 --- a/twilio/rest/ip_messaging/v1/service/role.py +++ /dev/null @@ -1,460 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class RoleList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the RoleList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v1.service.role.RoleList - :rtype: twilio.rest.chat.v1.service.role.RoleList - """ - super(RoleList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Roles'.format(**self._solution) - - def create(self, friendly_name, type, permission): - """ - Create a new RoleInstance - - :param unicode friendly_name: The friendly_name - :param RoleInstance.RoleType type: The type - :param unicode permission: The permission - - :returns: Newly created RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Type': type, - 'Permission': serialize.map(permission, lambda e: e), - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams RoleInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.role.RoleInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists RoleInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.role.RoleInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RoleInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RolePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return RolePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RoleInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RolePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RolePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RoleContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.role.RoleContext - :rtype: twilio.rest.chat.v1.service.role.RoleContext - """ - return RoleContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RoleContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.role.RoleContext - :rtype: twilio.rest.chat.v1.service.role.RoleContext - """ - return RoleContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.RoleList>' - - -class RolePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the RolePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v1.service.role.RolePage - :rtype: twilio.rest.chat.v1.service.role.RolePage - """ - super(RolePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RoleInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.role.RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.RolePage>' - - -class RoleContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the RoleContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.role.RoleContext - :rtype: twilio.rest.chat.v1.service.role.RoleContext - """ - super(RoleContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Roles/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a RoleInstance - - :returns: Fetched RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return RoleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the RoleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, permission): - """ - Update the RoleInstance - - :param unicode permission: The permission - - :returns: Updated RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - data = values.of({'Permission': serialize.map(permission, lambda e: e), }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return RoleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.RoleContext {}>'.format(context) - - -class RoleInstance(InstanceResource): - """ """ - - class RoleType(object): - CHANNEL = "channel" - DEPLOYMENT = "deployment" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the RoleInstance - - :returns: twilio.rest.chat.v1.service.role.RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - super(RoleInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'friendly_name': payload['friendly_name'], - 'type': payload['type'], - 'permissions': payload['permissions'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoleContext for this RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleContext - """ - if self._context is None: - self._context = RoleContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type - :rtype: RoleInstance.RoleType - """ - return self._properties['type'] - - @property - def permissions(self): - """ - :returns: The permissions - :rtype: unicode - """ - return self._properties['permissions'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a RoleInstance - - :returns: Fetched RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the RoleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, permission): - """ - Update the RoleInstance - - :param unicode permission: The permission - - :returns: Updated RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - return self._proxy.update(permission, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.RoleInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v1/service/user/__init__.py b/twilio/rest/ip_messaging/v1/service/user/__init__.py deleted file mode 100644 index 01e1a45..0000000 --- a/twilio/rest/ip_messaging/v1/service/user/__init__.py +++ /dev/null @@ -1,539 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.ip_messaging.v1.service.user.user_channel import UserChannelList - - -class UserList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the UserList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v1.service.user.UserList - :rtype: twilio.rest.chat.v1.service.user.UserList - """ - super(UserList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Users'.format(**self._solution) - - def create(self, identity, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Create a new UserInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Newly created UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - data = values.of({ - 'Identity': identity, - 'RoleSid': role_sid, - 'Attributes': attributes, - 'FriendlyName': friendly_name, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams UserInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.user.UserInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.user.UserInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return UserPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.user.UserContext - :rtype: twilio.rest.chat.v1.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a UserContext - - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.user.UserContext - :rtype: twilio.rest.chat.v1.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.UserList>' - - -class UserPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the UserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v1.service.user.UserPage - :rtype: twilio.rest.chat.v1.service.user.UserPage - """ - super(UserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.user.UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.UserPage>' - - -class UserContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the UserContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v1.service.user.UserContext - :rtype: twilio.rest.chat.v1.service.user.UserContext - """ - super(UserContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Users/{sid}'.format(**self._solution) - - # Dependents - self._user_channels = None - - def fetch(self): - """ - Fetch a UserInstance - - :returns: Fetched UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Update the UserInstance - - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Updated UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - data = values.of({'RoleSid': role_sid, 'Attributes': attributes, 'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def user_channels(self): - """ - Access the user_channels - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - """ - if self._user_channels is None: - self._user_channels = UserChannelList( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['sid'], - ) - return self._user_channels - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.UserContext {}>'.format(context) - - -class UserInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the UserInstance - - :returns: twilio.rest.chat.v1.service.user.UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - super(UserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'attributes': payload['attributes'], - 'friendly_name': payload['friendly_name'], - 'role_sid': payload['role_sid'], - 'identity': payload['identity'], - 'is_online': payload['is_online'], - 'is_notifiable': payload['is_notifiable'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'joined_channels_count': deserialize.integer(payload['joined_channels_count']), - 'links': payload['links'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserContext for this UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserContext - """ - if self._context is None: - self._context = UserContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def is_online(self): - """ - :returns: The is_online - :rtype: bool - """ - return self._properties['is_online'] - - @property - def is_notifiable(self): - """ - :returns: The is_notifiable - :rtype: bool - """ - return self._properties['is_notifiable'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def joined_channels_count(self): - """ - :returns: The joined_channels_count - :rtype: unicode - """ - return self._properties['joined_channels_count'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a UserInstance - - :returns: Fetched UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Update the UserInstance - - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Updated UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - return self._proxy.update(role_sid=role_sid, attributes=attributes, friendly_name=friendly_name, ) - - @property - def user_channels(self): - """ - Access the user_channels - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - """ - return self._proxy.user_channels - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V1.UserInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v1/service/user/__pycache__/__init__.cpython-36.pyc b/twilio/rest/ip_messaging/v1/service/user/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 9dc7dc3..0000000 Binary files a/twilio/rest/ip_messaging/v1/service/user/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v1/service/user/__pycache__/user_channel.cpython-36.pyc b/twilio/rest/ip_messaging/v1/service/user/__pycache__/user_channel.cpython-36.pyc deleted file mode 100644 index 7996f2e..0000000 Binary files a/twilio/rest/ip_messaging/v1/service/user/__pycache__/user_channel.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v1/service/user/user_channel.py b/twilio/rest/ip_messaging/v1/service/user/user_channel.py deleted file mode 100644 index 9941c0b..0000000 --- a/twilio/rest/ip_messaging/v1/service/user/user_channel.py +++ /dev/null @@ -1,277 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UserChannelList(ListResource): - """ """ - - def __init__(self, version, service_sid, user_sid): - """ - Initialize the UserChannelList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param user_sid: The sid - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - """ - super(UserChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - self._uri = '/Services/{service_sid}/Users/{user_sid}/Channels'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams UserChannelInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserChannelInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserChannelInstance - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return UserChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserChannelInstance - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserChannelPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.UserChannelList>' - - -class UserChannelPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the UserChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param user_sid: The sid - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage - """ - super(UserChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance - """ - return UserChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.UserChannelPage>' - - -class UserChannelInstance(InstanceResource): - """ """ - - class ChannelStatus(object): - JOINED = "joined" - INVITED = "invited" - NOT_PARTICIPATING = "not_participating" - - def __init__(self, version, payload, service_sid, user_sid): - """ - Initialize the UserChannelInstance - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance - """ - super(UserChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'channel_sid': payload['channel_sid'], - 'member_sid': payload['member_sid'], - 'status': payload['status'], - 'last_consumed_message_index': deserialize.integer(payload['last_consumed_message_index']), - 'unread_messages_count': deserialize.integer(payload['unread_messages_count']), - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def member_sid(self): - """ - :returns: The member_sid - :rtype: unicode - """ - return self._properties['member_sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: UserChannelInstance.ChannelStatus - """ - return self._properties['status'] - - @property - def last_consumed_message_index(self): - """ - :returns: The last_consumed_message_index - :rtype: unicode - """ - return self._properties['last_consumed_message_index'] - - @property - def unread_messages_count(self): - """ - :returns: The unread_messages_count - :rtype: unicode - """ - return self._properties['unread_messages_count'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V1.UserChannelInstance>' diff --git a/twilio/rest/ip_messaging/v2/__init__.py b/twilio/rest/ip_messaging/v2/__init__.py deleted file mode 100644 index 7a7a438..0000000 --- a/twilio/rest/ip_messaging/v2/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.ip_messaging.v2.credential import CredentialList -from twilio.rest.ip_messaging.v2.service import ServiceList - - -class V2(Version): - - def __init__(self, domain): - """ - Initialize the V2 version of IpMessaging - - :returns: V2 version of IpMessaging - :rtype: twilio.rest.ip_messaging.v2.V2.V2 - """ - super(V2, self).__init__(domain) - self.version = 'v2' - self._credentials = None - self._services = None - - @property - def credentials(self): - """ - :rtype: twilio.rest.chat.v2.credential.CredentialList - """ - if self._credentials is None: - self._credentials = CredentialList(self) - return self._credentials - - @property - def services(self): - """ - :rtype: twilio.rest.chat.v2.service.ServiceList - """ - if self._services is None: - self._services = ServiceList(self) - return self._services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2>' diff --git a/twilio/rest/ip_messaging/v2/__pycache__/__init__.cpython-36.pyc b/twilio/rest/ip_messaging/v2/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 5faf7ce..0000000 Binary files a/twilio/rest/ip_messaging/v2/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v2/__pycache__/credential.cpython-36.pyc b/twilio/rest/ip_messaging/v2/__pycache__/credential.cpython-36.pyc deleted file mode 100644 index f3048a1..0000000 Binary files a/twilio/rest/ip_messaging/v2/__pycache__/credential.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v2/credential.py b/twilio/rest/ip_messaging/v2/credential.py deleted file mode 100644 index fe38d5e..0000000 --- a/twilio/rest/ip_messaging/v2/credential.py +++ /dev/null @@ -1,472 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class CredentialList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the CredentialList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.chat.v2.credential.CredentialList - :rtype: twilio.rest.chat.v2.credential.CredentialList - """ - super(CredentialList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Credentials'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.credential.CredentialInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.credential.CredentialInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CredentialPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialPage(self._version, response, self._solution) - - def create(self, type, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Create a new CredentialInstance - - :param CredentialInstance.PushService type: The type - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Newly created CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - data = values.of({ - 'Type': type, - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CredentialInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a CredentialContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.credential.CredentialContext - :rtype: twilio.rest.chat.v2.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CredentialContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.credential.CredentialContext - :rtype: twilio.rest.chat.v2.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.CredentialList>' - - -class CredentialPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the CredentialPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.chat.v2.credential.CredentialPage - :rtype: twilio.rest.chat.v2.credential.CredentialPage - """ - super(CredentialPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.credential.CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - return CredentialInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.CredentialPage>' - - -class CredentialContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the CredentialContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.chat.v2.credential.CredentialContext - :rtype: twilio.rest.chat.v2.credential.CredentialContext - """ - super(CredentialContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Credentials/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a CredentialInstance - - :returns: Fetched CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Updated CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.CredentialContext {}>'.format(context) - - -class CredentialInstance(InstanceResource): - """ """ - - class PushService(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - - def __init__(self, version, payload, sid=None): - """ - Initialize the CredentialInstance - - :returns: twilio.rest.chat.v2.credential.CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - super(CredentialInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'type': payload['type'], - 'sandbox': payload['sandbox'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialContext for this CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialContext - """ - if self._context is None: - self._context = CredentialContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type - :rtype: CredentialInstance.PushService - """ - return self._properties['type'] - - @property - def sandbox(self): - """ - :returns: The sandbox - :rtype: unicode - """ - return self._properties['sandbox'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a CredentialInstance - - :returns: Fetched CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Updated CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - certificate=certificate, - private_key=private_key, - sandbox=sandbox, - api_key=api_key, - secret=secret, - ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.CredentialInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v2/service/__init__.py b/twilio/rest/ip_messaging/v2/service/__init__.py deleted file mode 100644 index 8c305bc..0000000 --- a/twilio/rest/ip_messaging/v2/service/__init__.py +++ /dev/null @@ -1,835 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.ip_messaging.v2.service.binding import BindingList -from twilio.rest.ip_messaging.v2.service.channel import ChannelList -from twilio.rest.ip_messaging.v2.service.role import RoleList -from twilio.rest.ip_messaging.v2.service.user import UserList - - -class ServiceList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.chat.v2.service.ServiceList - :rtype: twilio.rest.chat.v2.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name): - """ - Create a new ServiceInstance - - :param unicode friendly_name: The friendly_name - - :returns: Newly created ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServicePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.ServiceContext - :rtype: twilio.rest.chat.v2.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.ServiceContext - :rtype: twilio.rest.chat.v2.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.ServiceList>' - - -class ServicePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.chat.v2.service.ServicePage - :rtype: twilio.rest.chat.v2.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.ServicePage>' - - -class ServiceContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.ServiceContext - :rtype: twilio.rest.chat.v2.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._channels = None - self._roles = None - self._users = None - self._bindings = None - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_new_message_sound=values.unset, - notifications_new_message_badge_count_enabled=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_added_to_channel_sound=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_removed_from_channel_sound=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - notifications_invited_to_channel_sound=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset, - media_compatibility_message=values.unset, - pre_webhook_retry_count=values.unset, - post_webhook_retry_count=values.unset, - notifications_log_enabled=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode default_service_role_sid: The default_service_role_sid - :param unicode default_channel_role_sid: The default_channel_role_sid - :param unicode default_channel_creator_role_sid: The default_channel_creator_role_sid - :param bool read_status_enabled: The read_status_enabled - :param bool reachability_enabled: The reachability_enabled - :param unicode typing_indicator_timeout: The typing_indicator_timeout - :param unicode consumption_report_interval: The consumption_report_interval - :param bool notifications_new_message_enabled: The notifications.new_message.enabled - :param unicode notifications_new_message_template: The notifications.new_message.template - :param unicode notifications_new_message_sound: The notifications.new_message.sound - :param bool notifications_new_message_badge_count_enabled: The notifications.new_message.badge_count_enabled - :param bool notifications_added_to_channel_enabled: The notifications.added_to_channel.enabled - :param unicode notifications_added_to_channel_template: The notifications.added_to_channel.template - :param unicode notifications_added_to_channel_sound: The notifications.added_to_channel.sound - :param bool notifications_removed_from_channel_enabled: The notifications.removed_from_channel.enabled - :param unicode notifications_removed_from_channel_template: The notifications.removed_from_channel.template - :param unicode notifications_removed_from_channel_sound: The notifications.removed_from_channel.sound - :param bool notifications_invited_to_channel_enabled: The notifications.invited_to_channel.enabled - :param unicode notifications_invited_to_channel_template: The notifications.invited_to_channel.template - :param unicode notifications_invited_to_channel_sound: The notifications.invited_to_channel.sound - :param unicode pre_webhook_url: The pre_webhook_url - :param unicode post_webhook_url: The post_webhook_url - :param unicode webhook_method: The webhook_method - :param unicode webhook_filters: The webhook_filters - :param unicode limits_channel_members: The limits.channel_members - :param unicode limits_user_channels: The limits.user_channels - :param unicode media_compatibility_message: The media.compatibility_message - :param unicode pre_webhook_retry_count: The pre_webhook_retry_count - :param unicode post_webhook_retry_count: The post_webhook_retry_count - :param bool notifications_log_enabled: The notifications.log_enabled - - :returns: Updated ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'DefaultServiceRoleSid': default_service_role_sid, - 'DefaultChannelRoleSid': default_channel_role_sid, - 'DefaultChannelCreatorRoleSid': default_channel_creator_role_sid, - 'ReadStatusEnabled': read_status_enabled, - 'ReachabilityEnabled': reachability_enabled, - 'TypingIndicatorTimeout': typing_indicator_timeout, - 'ConsumptionReportInterval': consumption_report_interval, - 'Notifications.NewMessage.Enabled': notifications_new_message_enabled, - 'Notifications.NewMessage.Template': notifications_new_message_template, - 'Notifications.NewMessage.Sound': notifications_new_message_sound, - 'Notifications.NewMessage.BadgeCountEnabled': notifications_new_message_badge_count_enabled, - 'Notifications.AddedToChannel.Enabled': notifications_added_to_channel_enabled, - 'Notifications.AddedToChannel.Template': notifications_added_to_channel_template, - 'Notifications.AddedToChannel.Sound': notifications_added_to_channel_sound, - 'Notifications.RemovedFromChannel.Enabled': notifications_removed_from_channel_enabled, - 'Notifications.RemovedFromChannel.Template': notifications_removed_from_channel_template, - 'Notifications.RemovedFromChannel.Sound': notifications_removed_from_channel_sound, - 'Notifications.InvitedToChannel.Enabled': notifications_invited_to_channel_enabled, - 'Notifications.InvitedToChannel.Template': notifications_invited_to_channel_template, - 'Notifications.InvitedToChannel.Sound': notifications_invited_to_channel_sound, - 'PreWebhookUrl': pre_webhook_url, - 'PostWebhookUrl': post_webhook_url, - 'WebhookMethod': webhook_method, - 'WebhookFilters': serialize.map(webhook_filters, lambda e: e), - 'Limits.ChannelMembers': limits_channel_members, - 'Limits.UserChannels': limits_user_channels, - 'Media.CompatibilityMessage': media_compatibility_message, - 'PreWebhookRetryCount': pre_webhook_retry_count, - 'PostWebhookRetryCount': post_webhook_retry_count, - 'Notifications.LogEnabled': notifications_log_enabled, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def channels(self): - """ - Access the channels - - :returns: twilio.rest.chat.v2.service.channel.ChannelList - :rtype: twilio.rest.chat.v2.service.channel.ChannelList - """ - if self._channels is None: - self._channels = ChannelList(self._version, service_sid=self._solution['sid'], ) - return self._channels - - @property - def roles(self): - """ - Access the roles - - :returns: twilio.rest.chat.v2.service.role.RoleList - :rtype: twilio.rest.chat.v2.service.role.RoleList - """ - if self._roles is None: - self._roles = RoleList(self._version, service_sid=self._solution['sid'], ) - return self._roles - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.chat.v2.service.user.UserList - :rtype: twilio.rest.chat.v2.service.user.UserList - """ - if self._users is None: - self._users = UserList(self._version, service_sid=self._solution['sid'], ) - return self._users - - @property - def bindings(self): - """ - Access the bindings - - :returns: twilio.rest.chat.v2.service.binding.BindingList - :rtype: twilio.rest.chat.v2.service.binding.BindingList - """ - if self._bindings is None: - self._bindings = BindingList(self._version, service_sid=self._solution['sid'], ) - return self._bindings - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.ServiceContext {}>'.format(context) - - -class ServiceInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.chat.v2.service.ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'default_service_role_sid': payload['default_service_role_sid'], - 'default_channel_role_sid': payload['default_channel_role_sid'], - 'default_channel_creator_role_sid': payload['default_channel_creator_role_sid'], - 'read_status_enabled': payload['read_status_enabled'], - 'reachability_enabled': payload['reachability_enabled'], - 'typing_indicator_timeout': deserialize.integer(payload['typing_indicator_timeout']), - 'consumption_report_interval': deserialize.integer(payload['consumption_report_interval']), - 'limits': payload['limits'], - 'pre_webhook_url': payload['pre_webhook_url'], - 'post_webhook_url': payload['post_webhook_url'], - 'webhook_method': payload['webhook_method'], - 'webhook_filters': payload['webhook_filters'], - 'pre_webhook_retry_count': deserialize.integer(payload['pre_webhook_retry_count']), - 'post_webhook_retry_count': deserialize.integer(payload['post_webhook_retry_count']), - 'notifications': payload['notifications'], - 'media': payload['media'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceContext - """ - if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def default_service_role_sid(self): - """ - :returns: The default_service_role_sid - :rtype: unicode - """ - return self._properties['default_service_role_sid'] - - @property - def default_channel_role_sid(self): - """ - :returns: The default_channel_role_sid - :rtype: unicode - """ - return self._properties['default_channel_role_sid'] - - @property - def default_channel_creator_role_sid(self): - """ - :returns: The default_channel_creator_role_sid - :rtype: unicode - """ - return self._properties['default_channel_creator_role_sid'] - - @property - def read_status_enabled(self): - """ - :returns: The read_status_enabled - :rtype: bool - """ - return self._properties['read_status_enabled'] - - @property - def reachability_enabled(self): - """ - :returns: The reachability_enabled - :rtype: bool - """ - return self._properties['reachability_enabled'] - - @property - def typing_indicator_timeout(self): - """ - :returns: The typing_indicator_timeout - :rtype: unicode - """ - return self._properties['typing_indicator_timeout'] - - @property - def consumption_report_interval(self): - """ - :returns: The consumption_report_interval - :rtype: unicode - """ - return self._properties['consumption_report_interval'] - - @property - def limits(self): - """ - :returns: The limits - :rtype: dict - """ - return self._properties['limits'] - - @property - def pre_webhook_url(self): - """ - :returns: The pre_webhook_url - :rtype: unicode - """ - return self._properties['pre_webhook_url'] - - @property - def post_webhook_url(self): - """ - :returns: The post_webhook_url - :rtype: unicode - """ - return self._properties['post_webhook_url'] - - @property - def webhook_method(self): - """ - :returns: The webhook_method - :rtype: unicode - """ - return self._properties['webhook_method'] - - @property - def webhook_filters(self): - """ - :returns: The webhook_filters - :rtype: unicode - """ - return self._properties['webhook_filters'] - - @property - def pre_webhook_retry_count(self): - """ - :returns: The pre_webhook_retry_count - :rtype: unicode - """ - return self._properties['pre_webhook_retry_count'] - - @property - def post_webhook_retry_count(self): - """ - :returns: The post_webhook_retry_count - :rtype: unicode - """ - return self._properties['post_webhook_retry_count'] - - @property - def notifications(self): - """ - :returns: The notifications - :rtype: dict - """ - return self._properties['notifications'] - - @property - def media(self): - """ - :returns: The media - :rtype: dict - """ - return self._properties['media'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_new_message_sound=values.unset, - notifications_new_message_badge_count_enabled=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_added_to_channel_sound=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_removed_from_channel_sound=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - notifications_invited_to_channel_sound=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset, - media_compatibility_message=values.unset, - pre_webhook_retry_count=values.unset, - post_webhook_retry_count=values.unset, - notifications_log_enabled=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode default_service_role_sid: The default_service_role_sid - :param unicode default_channel_role_sid: The default_channel_role_sid - :param unicode default_channel_creator_role_sid: The default_channel_creator_role_sid - :param bool read_status_enabled: The read_status_enabled - :param bool reachability_enabled: The reachability_enabled - :param unicode typing_indicator_timeout: The typing_indicator_timeout - :param unicode consumption_report_interval: The consumption_report_interval - :param bool notifications_new_message_enabled: The notifications.new_message.enabled - :param unicode notifications_new_message_template: The notifications.new_message.template - :param unicode notifications_new_message_sound: The notifications.new_message.sound - :param bool notifications_new_message_badge_count_enabled: The notifications.new_message.badge_count_enabled - :param bool notifications_added_to_channel_enabled: The notifications.added_to_channel.enabled - :param unicode notifications_added_to_channel_template: The notifications.added_to_channel.template - :param unicode notifications_added_to_channel_sound: The notifications.added_to_channel.sound - :param bool notifications_removed_from_channel_enabled: The notifications.removed_from_channel.enabled - :param unicode notifications_removed_from_channel_template: The notifications.removed_from_channel.template - :param unicode notifications_removed_from_channel_sound: The notifications.removed_from_channel.sound - :param bool notifications_invited_to_channel_enabled: The notifications.invited_to_channel.enabled - :param unicode notifications_invited_to_channel_template: The notifications.invited_to_channel.template - :param unicode notifications_invited_to_channel_sound: The notifications.invited_to_channel.sound - :param unicode pre_webhook_url: The pre_webhook_url - :param unicode post_webhook_url: The post_webhook_url - :param unicode webhook_method: The webhook_method - :param unicode webhook_filters: The webhook_filters - :param unicode limits_channel_members: The limits.channel_members - :param unicode limits_user_channels: The limits.user_channels - :param unicode media_compatibility_message: The media.compatibility_message - :param unicode pre_webhook_retry_count: The pre_webhook_retry_count - :param unicode post_webhook_retry_count: The post_webhook_retry_count - :param bool notifications_log_enabled: The notifications.log_enabled - - :returns: Updated ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - default_service_role_sid=default_service_role_sid, - default_channel_role_sid=default_channel_role_sid, - default_channel_creator_role_sid=default_channel_creator_role_sid, - read_status_enabled=read_status_enabled, - reachability_enabled=reachability_enabled, - typing_indicator_timeout=typing_indicator_timeout, - consumption_report_interval=consumption_report_interval, - notifications_new_message_enabled=notifications_new_message_enabled, - notifications_new_message_template=notifications_new_message_template, - notifications_new_message_sound=notifications_new_message_sound, - notifications_new_message_badge_count_enabled=notifications_new_message_badge_count_enabled, - notifications_added_to_channel_enabled=notifications_added_to_channel_enabled, - notifications_added_to_channel_template=notifications_added_to_channel_template, - notifications_added_to_channel_sound=notifications_added_to_channel_sound, - notifications_removed_from_channel_enabled=notifications_removed_from_channel_enabled, - notifications_removed_from_channel_template=notifications_removed_from_channel_template, - notifications_removed_from_channel_sound=notifications_removed_from_channel_sound, - notifications_invited_to_channel_enabled=notifications_invited_to_channel_enabled, - notifications_invited_to_channel_template=notifications_invited_to_channel_template, - notifications_invited_to_channel_sound=notifications_invited_to_channel_sound, - pre_webhook_url=pre_webhook_url, - post_webhook_url=post_webhook_url, - webhook_method=webhook_method, - webhook_filters=webhook_filters, - limits_channel_members=limits_channel_members, - limits_user_channels=limits_user_channels, - media_compatibility_message=media_compatibility_message, - pre_webhook_retry_count=pre_webhook_retry_count, - post_webhook_retry_count=post_webhook_retry_count, - notifications_log_enabled=notifications_log_enabled, - ) - - @property - def channels(self): - """ - Access the channels - - :returns: twilio.rest.chat.v2.service.channel.ChannelList - :rtype: twilio.rest.chat.v2.service.channel.ChannelList - """ - return self._proxy.channels - - @property - def roles(self): - """ - Access the roles - - :returns: twilio.rest.chat.v2.service.role.RoleList - :rtype: twilio.rest.chat.v2.service.role.RoleList - """ - return self._proxy.roles - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.chat.v2.service.user.UserList - :rtype: twilio.rest.chat.v2.service.user.UserList - """ - return self._proxy.users - - @property - def bindings(self): - """ - Access the bindings - - :returns: twilio.rest.chat.v2.service.binding.BindingList - :rtype: twilio.rest.chat.v2.service.binding.BindingList - """ - return self._proxy.bindings - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.ServiceInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v2/service/__pycache__/__init__.cpython-36.pyc b/twilio/rest/ip_messaging/v2/service/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 1549cce..0000000 Binary files a/twilio/rest/ip_messaging/v2/service/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v2/service/__pycache__/binding.cpython-36.pyc b/twilio/rest/ip_messaging/v2/service/__pycache__/binding.cpython-36.pyc deleted file mode 100644 index 00fa337..0000000 Binary files a/twilio/rest/ip_messaging/v2/service/__pycache__/binding.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v2/service/__pycache__/role.cpython-36.pyc b/twilio/rest/ip_messaging/v2/service/__pycache__/role.cpython-36.pyc deleted file mode 100644 index 6d2786a..0000000 Binary files a/twilio/rest/ip_messaging/v2/service/__pycache__/role.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v2/service/binding.py b/twilio/rest/ip_messaging/v2/service/binding.py deleted file mode 100644 index b0c9b8f..0000000 --- a/twilio/rest/ip_messaging/v2/service/binding.py +++ /dev/null @@ -1,448 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class BindingList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the BindingList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.binding.BindingList - :rtype: twilio.rest.chat.v2.service.binding.BindingList - """ - super(BindingList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Bindings'.format(**self._solution) - - def stream(self, binding_type=values.unset, identity=values.unset, limit=None, - page_size=None): - """ - Streams BindingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param BindingInstance.BindingType binding_type: The binding_type - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.binding.BindingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(binding_type=binding_type, identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, binding_type=values.unset, identity=values.unset, limit=None, - page_size=None): - """ - Lists BindingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param BindingInstance.BindingType binding_type: The binding_type - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.binding.BindingInstance] - """ - return list(self.stream( - binding_type=binding_type, - identity=identity, - limit=limit, - page_size=page_size, - )) - - def page(self, binding_type=values.unset, identity=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of BindingInstance records from the API. - Request is executed immediately - - :param BindingInstance.BindingType binding_type: The binding_type - :param unicode identity: The identity - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingPage - """ - params = values.of({ - 'BindingType': serialize.map(binding_type, lambda e: e), - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return BindingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of BindingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return BindingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a BindingContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.binding.BindingContext - :rtype: twilio.rest.chat.v2.service.binding.BindingContext - """ - return BindingContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a BindingContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.binding.BindingContext - :rtype: twilio.rest.chat.v2.service.binding.BindingContext - """ - return BindingContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.BindingList>' - - -class BindingPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the BindingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.binding.BindingPage - :rtype: twilio.rest.chat.v2.service.binding.BindingPage - """ - super(BindingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BindingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.binding.BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingInstance - """ - return BindingInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.BindingPage>' - - -class BindingContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the BindingContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.binding.BindingContext - :rtype: twilio.rest.chat.v2.service.binding.BindingContext - """ - super(BindingContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Bindings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a BindingInstance - - :returns: Fetched BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return BindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the BindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.BindingContext {}>'.format(context) - - -class BindingInstance(InstanceResource): - """ """ - - class BindingType(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the BindingInstance - - :returns: twilio.rest.chat.v2.service.binding.BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingInstance - """ - super(BindingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'endpoint': payload['endpoint'], - 'identity': payload['identity'], - 'credential_sid': payload['credential_sid'], - 'binding_type': payload['binding_type'], - 'message_types': payload['message_types'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: BindingContext for this BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingContext - """ - if self._context is None: - self._context = BindingContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def endpoint(self): - """ - :returns: The endpoint - :rtype: unicode - """ - return self._properties['endpoint'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def credential_sid(self): - """ - :returns: The credential_sid - :rtype: unicode - """ - return self._properties['credential_sid'] - - @property - def binding_type(self): - """ - :returns: The binding_type - :rtype: BindingInstance.BindingType - """ - return self._properties['binding_type'] - - @property - def message_types(self): - """ - :returns: The message_types - :rtype: unicode - """ - return self._properties['message_types'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a BindingInstance - - :returns: Fetched BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the BindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.BindingInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v2/service/channel/__init__.py b/twilio/rest/ip_messaging/v2/service/channel/__init__.py deleted file mode 100644 index a6111e3..0000000 --- a/twilio/rest/ip_messaging/v2/service/channel/__init__.py +++ /dev/null @@ -1,638 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.ip_messaging.v2.service.channel.invite import InviteList -from twilio.rest.ip_messaging.v2.service.channel.member import MemberList -from twilio.rest.ip_messaging.v2.service.channel.message import MessageList - - -class ChannelList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the ChannelList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.channel.ChannelList - :rtype: twilio.rest.chat.v2.service.channel.ChannelList - """ - super(ChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Channels'.format(**self._solution) - - def create(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, type=values.unset, - date_created=values.unset, date_updated=values.unset, - created_by=values.unset): - """ - Create a new ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - :param ChannelInstance.ChannelType type: The type - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode created_by: The created_by - - :returns: Newly created ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - 'Type': type, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'CreatedBy': created_by, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, type=values.unset, limit=None, page_size=None): - """ - Streams ChannelInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param ChannelInstance.ChannelType type: The type - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.ChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(type=type, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, type=values.unset, limit=None, page_size=None): - """ - Lists ChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param ChannelInstance.ChannelType type: The type - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.ChannelInstance] - """ - return list(self.stream(type=type, limit=limit, page_size=page_size, )) - - def page(self, type=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ChannelInstance records from the API. - Request is executed immediately - - :param ChannelInstance.ChannelType type: The type - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelPage - """ - params = values.of({ - 'Type': serialize.map(type, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ChannelPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ChannelContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.ChannelContext - :rtype: twilio.rest.chat.v2.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ChannelContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.ChannelContext - :rtype: twilio.rest.chat.v2.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.ChannelList>' - - -class ChannelPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.channel.ChannelPage - :rtype: twilio.rest.chat.v2.service.channel.ChannelPage - """ - super(ChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.channel.ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.ChannelPage>' - - -class ChannelContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the ChannelContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.ChannelContext - :rtype: twilio.rest.chat.v2.service.channel.ChannelContext - """ - super(ChannelContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{sid}'.format(**self._solution) - - # Dependents - self._members = None - self._messages = None - self._invites = None - - def fetch(self): - """ - Fetch a ChannelInstance - - :returns: Fetched ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the ChannelInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, date_created=values.unset, - date_updated=values.unset, created_by=values.unset): - """ - Update the ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode created_by: The created_by - - :returns: Updated ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'CreatedBy': created_by, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def members(self): - """ - Access the members - - :returns: twilio.rest.chat.v2.service.channel.member.MemberList - :rtype: twilio.rest.chat.v2.service.channel.member.MemberList - """ - if self._members is None: - self._members = MemberList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._members - - @property - def messages(self): - """ - Access the messages - - :returns: twilio.rest.chat.v2.service.channel.message.MessageList - :rtype: twilio.rest.chat.v2.service.channel.message.MessageList - """ - if self._messages is None: - self._messages = MessageList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._messages - - @property - def invites(self): - """ - Access the invites - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteList - """ - if self._invites is None: - self._invites = InviteList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._invites - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.ChannelContext {}>'.format(context) - - -class ChannelInstance(InstanceResource): - """ """ - - class ChannelType(object): - PUBLIC = "public" - PRIVATE = "private" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ChannelInstance - - :returns: twilio.rest.chat.v2.service.channel.ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - super(ChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'friendly_name': payload['friendly_name'], - 'unique_name': payload['unique_name'], - 'attributes': payload['attributes'], - 'type': payload['type'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - 'members_count': deserialize.integer(payload['members_count']), - 'messages_count': deserialize.integer(payload['messages_count']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ChannelContext for this ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelContext - """ - if self._context is None: - self._context = ChannelContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def type(self): - """ - :returns: The type - :rtype: ChannelInstance.ChannelType - """ - return self._properties['type'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def members_count(self): - """ - :returns: The members_count - :rtype: unicode - """ - return self._properties['members_count'] - - @property - def messages_count(self): - """ - :returns: The messages_count - :rtype: unicode - """ - return self._properties['messages_count'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ChannelInstance - - :returns: Fetched ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ChannelInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, date_created=values.unset, - date_updated=values.unset, created_by=values.unset): - """ - Update the ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode created_by: The created_by - - :returns: Updated ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - unique_name=unique_name, - attributes=attributes, - date_created=date_created, - date_updated=date_updated, - created_by=created_by, - ) - - @property - def members(self): - """ - Access the members - - :returns: twilio.rest.chat.v2.service.channel.member.MemberList - :rtype: twilio.rest.chat.v2.service.channel.member.MemberList - """ - return self._proxy.members - - @property - def messages(self): - """ - Access the messages - - :returns: twilio.rest.chat.v2.service.channel.message.MessageList - :rtype: twilio.rest.chat.v2.service.channel.message.MessageList - """ - return self._proxy.messages - - @property - def invites(self): - """ - Access the invites - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteList - """ - return self._proxy.invites - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.ChannelInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v2/service/channel/__pycache__/__init__.cpython-36.pyc b/twilio/rest/ip_messaging/v2/service/channel/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 69a332a..0000000 Binary files a/twilio/rest/ip_messaging/v2/service/channel/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v2/service/channel/__pycache__/invite.cpython-36.pyc b/twilio/rest/ip_messaging/v2/service/channel/__pycache__/invite.cpython-36.pyc deleted file mode 100644 index bcf9a23..0000000 Binary files a/twilio/rest/ip_messaging/v2/service/channel/__pycache__/invite.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v2/service/channel/__pycache__/member.cpython-36.pyc b/twilio/rest/ip_messaging/v2/service/channel/__pycache__/member.cpython-36.pyc deleted file mode 100644 index 9664a6c..0000000 Binary files a/twilio/rest/ip_messaging/v2/service/channel/__pycache__/member.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v2/service/channel/__pycache__/message.cpython-36.pyc b/twilio/rest/ip_messaging/v2/service/channel/__pycache__/message.cpython-36.pyc deleted file mode 100644 index c84dc4d..0000000 Binary files a/twilio/rest/ip_messaging/v2/service/channel/__pycache__/message.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v2/service/channel/invite.py b/twilio/rest/ip_messaging/v2/service/channel/invite.py deleted file mode 100644 index 205135f..0000000 --- a/twilio/rest/ip_messaging/v2/service/channel/invite.py +++ /dev/null @@ -1,462 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class InviteList(ListResource): - """ """ - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the InviteList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteList - """ - super(InviteList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Invites'.format(**self._solution) - - def create(self, identity, role_sid=values.unset): - """ - Create a new InviteInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - - :returns: Newly created InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - data = values.of({'Identity': identity, 'RoleSid': role_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, identity=values.unset, limit=None, page_size=None): - """ - Streams InviteInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.invite.InviteInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, identity=values.unset, limit=None, page_size=None): - """ - Lists InviteInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.invite.InviteInstance] - """ - return list(self.stream(identity=identity, limit=limit, page_size=page_size, )) - - def page(self, identity=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of InviteInstance records from the API. - Request is executed immediately - - :param unicode identity: The identity - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InvitePage - """ - params = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return InvitePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of InviteInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InvitePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InvitePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InviteContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteContext - """ - return InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a InviteContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteContext - """ - return InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.InviteList>' - - -class InvitePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the InvitePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v2.service.channel.invite.InvitePage - :rtype: twilio.rest.chat.v2.service.channel.invite.InvitePage - """ - super(InvitePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InviteInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.InvitePage>' - - -class InviteContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the InviteContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteContext - """ - super(InviteContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Invites/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a InviteInstance - - :returns: Fetched InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the InviteInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.InviteContext {}>'.format(context) - - -class InviteInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the InviteInstance - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - super(InviteInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'channel_sid': payload['channel_sid'], - 'service_sid': payload['service_sid'], - 'identity': payload['identity'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'role_sid': payload['role_sid'], - 'created_by': payload['created_by'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InviteContext for this InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteContext - """ - if self._context is None: - self._context = InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a InviteInstance - - :returns: Fetched InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the InviteInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.InviteInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v2/service/channel/member.py b/twilio/rest/ip_messaging/v2/service/channel/member.py deleted file mode 100644 index d79cd49..0000000 --- a/twilio/rest/ip_messaging/v2/service/channel/member.py +++ /dev/null @@ -1,547 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class MemberList(ListResource): - """ """ - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the MemberList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v2.service.channel.member.MemberList - :rtype: twilio.rest.chat.v2.service.channel.member.MemberList - """ - super(MemberList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Members'.format(**self._solution) - - def create(self, identity, role_sid=values.unset, - last_consumed_message_index=values.unset, - last_consumption_timestamp=values.unset, date_created=values.unset, - date_updated=values.unset): - """ - Create a new MemberInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - :param unicode last_consumed_message_index: The last_consumed_message_index - :param datetime last_consumption_timestamp: The last_consumption_timestamp - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - - :returns: Newly created MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - data = values.of({ - 'Identity': identity, - 'RoleSid': role_sid, - 'LastConsumedMessageIndex': last_consumed_message_index, - 'LastConsumptionTimestamp': serialize.iso8601_datetime(last_consumption_timestamp), - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, identity=values.unset, limit=None, page_size=None): - """ - Streams MemberInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.member.MemberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, identity=values.unset, limit=None, page_size=None): - """ - Lists MemberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode identity: The identity - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.member.MemberInstance] - """ - return list(self.stream(identity=identity, limit=limit, page_size=page_size, )) - - def page(self, identity=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MemberInstance records from the API. - Request is executed immediately - - :param unicode identity: The identity - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage - """ - params = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MemberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MemberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MemberPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MemberContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext - """ - return MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MemberContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext - """ - return MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.MemberList>' - - -class MemberPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MemberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v2.service.channel.member.MemberPage - :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage - """ - super(MemberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MemberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.channel.member.MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.MemberPage>' - - -class MemberContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the MemberContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext - """ - super(MemberContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Members/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a MemberInstance - - :returns: Fetched MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the MemberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, role_sid=values.unset, - last_consumed_message_index=values.unset, - last_consumption_timestamp=values.unset, date_created=values.unset, - date_updated=values.unset): - """ - Update the MemberInstance - - :param unicode role_sid: The role_sid - :param unicode last_consumed_message_index: The last_consumed_message_index - :param datetime last_consumption_timestamp: The last_consumption_timestamp - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - - :returns: Updated MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - data = values.of({ - 'RoleSid': role_sid, - 'LastConsumedMessageIndex': last_consumed_message_index, - 'LastConsumptionTimestamp': serialize.iso8601_datetime(last_consumption_timestamp), - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.MemberContext {}>'.format(context) - - -class MemberInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the MemberInstance - - :returns: twilio.rest.chat.v2.service.channel.member.MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - super(MemberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'channel_sid': payload['channel_sid'], - 'service_sid': payload['service_sid'], - 'identity': payload['identity'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'role_sid': payload['role_sid'], - 'last_consumed_message_index': deserialize.integer(payload['last_consumed_message_index']), - 'last_consumption_timestamp': deserialize.iso8601_datetime(payload['last_consumption_timestamp']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MemberContext for this MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext - """ - if self._context is None: - self._context = MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def last_consumed_message_index(self): - """ - :returns: The last_consumed_message_index - :rtype: unicode - """ - return self._properties['last_consumed_message_index'] - - @property - def last_consumption_timestamp(self): - """ - :returns: The last_consumption_timestamp - :rtype: datetime - """ - return self._properties['last_consumption_timestamp'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a MemberInstance - - :returns: Fetched MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the MemberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, role_sid=values.unset, - last_consumed_message_index=values.unset, - last_consumption_timestamp=values.unset, date_created=values.unset, - date_updated=values.unset): - """ - Update the MemberInstance - - :param unicode role_sid: The role_sid - :param unicode last_consumed_message_index: The last_consumed_message_index - :param datetime last_consumption_timestamp: The last_consumption_timestamp - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - - :returns: Updated MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - return self._proxy.update( - role_sid=role_sid, - last_consumed_message_index=last_consumed_message_index, - last_consumption_timestamp=last_consumption_timestamp, - date_created=date_created, - date_updated=date_updated, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.MemberInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v2/service/channel/message.py b/twilio/rest/ip_messaging/v2/service/channel/message.py deleted file mode 100644 index 8a39633..0000000 --- a/twilio/rest/ip_messaging/v2/service/channel/message.py +++ /dev/null @@ -1,596 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class MessageList(ListResource): - """ """ - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the MessageList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v2.service.channel.message.MessageList - :rtype: twilio.rest.chat.v2.service.channel.message.MessageList - """ - super(MessageList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Messages'.format(**self._solution) - - def create(self, from_=values.unset, attributes=values.unset, - date_created=values.unset, date_updated=values.unset, - last_updated_by=values.unset, body=values.unset, - media_sid=values.unset): - """ - Create a new MessageInstance - - :param unicode from_: The from - :param unicode attributes: The attributes - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode last_updated_by: The last_updated_by - :param unicode body: The body - :param unicode media_sid: The media_sid - - :returns: Newly created MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - data = values.of({ - 'From': from_, - 'Attributes': attributes, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'LastUpdatedBy': last_updated_by, - 'Body': body, - 'MediaSid': media_sid, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, order=values.unset, limit=None, page_size=None): - """ - Streams MessageInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param MessageInstance.OrderType order: The order - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.message.MessageInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, order=values.unset, limit=None, page_size=None): - """ - Lists MessageInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param MessageInstance.OrderType order: The order - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.message.MessageInstance] - """ - return list(self.stream(order=order, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MessageInstance records from the API. - Request is executed immediately - - :param MessageInstance.OrderType order: The order - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessagePage - """ - params = values.of({ - 'Order': order, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MessagePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessageInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessagePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessagePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MessageContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext - """ - return MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MessageContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext - """ - return MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.MessageList>' - - -class MessagePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MessagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param channel_sid: The channel_sid - - :returns: twilio.rest.chat.v2.service.channel.message.MessagePage - :rtype: twilio.rest.chat.v2.service.channel.message.MessagePage - """ - super(MessagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessageInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.channel.message.MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.MessagePage>' - - -class MessageContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the MessageContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param channel_sid: The channel_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext - """ - super(MessageContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Messages/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a MessageInstance - - :returns: Fetched MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, body=values.unset, attributes=values.unset, - date_created=values.unset, date_updated=values.unset, - last_updated_by=values.unset): - """ - Update the MessageInstance - - :param unicode body: The body - :param unicode attributes: The attributes - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode last_updated_by: The last_updated_by - - :returns: Updated MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - data = values.of({ - 'Body': body, - 'Attributes': attributes, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'LastUpdatedBy': last_updated_by, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.MessageContext {}>'.format(context) - - -class MessageInstance(InstanceResource): - """ """ - - class OrderType(object): - ASC = "asc" - DESC = "desc" - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the MessageInstance - - :returns: twilio.rest.chat.v2.service.channel.message.MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - super(MessageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'attributes': payload['attributes'], - 'service_sid': payload['service_sid'], - 'to': payload['to'], - 'channel_sid': payload['channel_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'last_updated_by': payload['last_updated_by'], - 'was_edited': payload['was_edited'], - 'from_': payload['from'], - 'body': payload['body'], - 'index': deserialize.integer(payload['index']), - 'type': payload['type'], - 'media': payload['media'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessageContext for this MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext - """ - if self._context is None: - self._context = MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def to(self): - """ - :returns: The to - :rtype: unicode - """ - return self._properties['to'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def last_updated_by(self): - """ - :returns: The last_updated_by - :rtype: unicode - """ - return self._properties['last_updated_by'] - - @property - def was_edited(self): - """ - :returns: The was_edited - :rtype: bool - """ - return self._properties['was_edited'] - - @property - def from_(self): - """ - :returns: The from - :rtype: unicode - """ - return self._properties['from_'] - - @property - def body(self): - """ - :returns: The body - :rtype: unicode - """ - return self._properties['body'] - - @property - def index(self): - """ - :returns: The index - :rtype: unicode - """ - return self._properties['index'] - - @property - def type(self): - """ - :returns: The type - :rtype: unicode - """ - return self._properties['type'] - - @property - def media(self): - """ - :returns: The media - :rtype: dict - """ - return self._properties['media'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a MessageInstance - - :returns: Fetched MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, body=values.unset, attributes=values.unset, - date_created=values.unset, date_updated=values.unset, - last_updated_by=values.unset): - """ - Update the MessageInstance - - :param unicode body: The body - :param unicode attributes: The attributes - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode last_updated_by: The last_updated_by - - :returns: Updated MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - return self._proxy.update( - body=body, - attributes=attributes, - date_created=date_created, - date_updated=date_updated, - last_updated_by=last_updated_by, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.MessageInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v2/service/role.py b/twilio/rest/ip_messaging/v2/service/role.py deleted file mode 100644 index d4145d3..0000000 --- a/twilio/rest/ip_messaging/v2/service/role.py +++ /dev/null @@ -1,460 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class RoleList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the RoleList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.role.RoleList - :rtype: twilio.rest.chat.v2.service.role.RoleList - """ - super(RoleList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Roles'.format(**self._solution) - - def create(self, friendly_name, type, permission): - """ - Create a new RoleInstance - - :param unicode friendly_name: The friendly_name - :param RoleInstance.RoleType type: The type - :param unicode permission: The permission - - :returns: Newly created RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Type': type, - 'Permission': serialize.map(permission, lambda e: e), - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams RoleInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.role.RoleInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists RoleInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.role.RoleInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RoleInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RolePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return RolePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RoleInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RolePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RolePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RoleContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.role.RoleContext - :rtype: twilio.rest.chat.v2.service.role.RoleContext - """ - return RoleContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RoleContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.role.RoleContext - :rtype: twilio.rest.chat.v2.service.role.RoleContext - """ - return RoleContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.RoleList>' - - -class RolePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the RolePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.role.RolePage - :rtype: twilio.rest.chat.v2.service.role.RolePage - """ - super(RolePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RoleInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.role.RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.RolePage>' - - -class RoleContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the RoleContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.role.RoleContext - :rtype: twilio.rest.chat.v2.service.role.RoleContext - """ - super(RoleContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Roles/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a RoleInstance - - :returns: Fetched RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return RoleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the RoleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, permission): - """ - Update the RoleInstance - - :param unicode permission: The permission - - :returns: Updated RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - data = values.of({'Permission': serialize.map(permission, lambda e: e), }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return RoleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.RoleContext {}>'.format(context) - - -class RoleInstance(InstanceResource): - """ """ - - class RoleType(object): - CHANNEL = "channel" - DEPLOYMENT = "deployment" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the RoleInstance - - :returns: twilio.rest.chat.v2.service.role.RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - super(RoleInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'friendly_name': payload['friendly_name'], - 'type': payload['type'], - 'permissions': payload['permissions'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoleContext for this RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleContext - """ - if self._context is None: - self._context = RoleContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type - :rtype: RoleInstance.RoleType - """ - return self._properties['type'] - - @property - def permissions(self): - """ - :returns: The permissions - :rtype: unicode - """ - return self._properties['permissions'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a RoleInstance - - :returns: Fetched RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the RoleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, permission): - """ - Update the RoleInstance - - :param unicode permission: The permission - - :returns: Updated RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - return self._proxy.update(permission, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.RoleInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v2/service/user/__init__.py b/twilio/rest/ip_messaging/v2/service/user/__init__.py deleted file mode 100644 index bd5acc2..0000000 --- a/twilio/rest/ip_messaging/v2/service/user/__init__.py +++ /dev/null @@ -1,567 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.ip_messaging.v2.service.user.user_binding import UserBindingList -from twilio.rest.ip_messaging.v2.service.user.user_channel import UserChannelList - - -class UserList(ListResource): - """ """ - - def __init__(self, version, service_sid): - """ - Initialize the UserList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.user.UserList - :rtype: twilio.rest.chat.v2.service.user.UserList - """ - super(UserList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Users'.format(**self._solution) - - def create(self, identity, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Create a new UserInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Newly created UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - data = values.of({ - 'Identity': identity, - 'RoleSid': role_sid, - 'Attributes': attributes, - 'FriendlyName': friendly_name, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams UserInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.user.UserInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.user.UserInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return UserPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.user.UserContext - :rtype: twilio.rest.chat.v2.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a UserContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.user.UserContext - :rtype: twilio.rest.chat.v2.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.UserList>' - - -class UserPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the UserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.chat.v2.service.user.UserPage - :rtype: twilio.rest.chat.v2.service.user.UserPage - """ - super(UserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.user.UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.UserPage>' - - -class UserContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the UserContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.user.UserContext - :rtype: twilio.rest.chat.v2.service.user.UserContext - """ - super(UserContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Users/{sid}'.format(**self._solution) - - # Dependents - self._user_channels = None - self._user_bindings = None - - def fetch(self): - """ - Fetch a UserInstance - - :returns: Fetched UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Update the UserInstance - - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Updated UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - data = values.of({'RoleSid': role_sid, 'Attributes': attributes, 'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def user_channels(self): - """ - Access the user_channels - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - """ - if self._user_channels is None: - self._user_channels = UserChannelList( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['sid'], - ) - return self._user_channels - - @property - def user_bindings(self): - """ - Access the user_bindings - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - """ - if self._user_bindings is None: - self._user_bindings = UserBindingList( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['sid'], - ) - return self._user_bindings - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.UserContext {}>'.format(context) - - -class UserInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the UserInstance - - :returns: twilio.rest.chat.v2.service.user.UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - super(UserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'attributes': payload['attributes'], - 'friendly_name': payload['friendly_name'], - 'role_sid': payload['role_sid'], - 'identity': payload['identity'], - 'is_online': payload['is_online'], - 'is_notifiable': payload['is_notifiable'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'joined_channels_count': deserialize.integer(payload['joined_channels_count']), - 'links': payload['links'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserContext for this UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserContext - """ - if self._context is None: - self._context = UserContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def is_online(self): - """ - :returns: The is_online - :rtype: bool - """ - return self._properties['is_online'] - - @property - def is_notifiable(self): - """ - :returns: The is_notifiable - :rtype: bool - """ - return self._properties['is_notifiable'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def joined_channels_count(self): - """ - :returns: The joined_channels_count - :rtype: unicode - """ - return self._properties['joined_channels_count'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a UserInstance - - :returns: Fetched UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Update the UserInstance - - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Updated UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - return self._proxy.update(role_sid=role_sid, attributes=attributes, friendly_name=friendly_name, ) - - @property - def user_channels(self): - """ - Access the user_channels - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - """ - return self._proxy.user_channels - - @property - def user_bindings(self): - """ - Access the user_bindings - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - """ - return self._proxy.user_bindings - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.UserInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v2/service/user/__pycache__/__init__.cpython-36.pyc b/twilio/rest/ip_messaging/v2/service/user/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 8244cac..0000000 Binary files a/twilio/rest/ip_messaging/v2/service/user/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v2/service/user/__pycache__/user_binding.cpython-36.pyc b/twilio/rest/ip_messaging/v2/service/user/__pycache__/user_binding.cpython-36.pyc deleted file mode 100644 index 9c747c1..0000000 Binary files a/twilio/rest/ip_messaging/v2/service/user/__pycache__/user_binding.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v2/service/user/__pycache__/user_channel.cpython-36.pyc b/twilio/rest/ip_messaging/v2/service/user/__pycache__/user_channel.cpython-36.pyc deleted file mode 100644 index 45ec0ac..0000000 Binary files a/twilio/rest/ip_messaging/v2/service/user/__pycache__/user_channel.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/ip_messaging/v2/service/user/user_binding.py b/twilio/rest/ip_messaging/v2/service/user/user_binding.py deleted file mode 100644 index cfa607f..0000000 --- a/twilio/rest/ip_messaging/v2/service/user/user_binding.py +++ /dev/null @@ -1,460 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class UserBindingList(ListResource): - """ """ - - def __init__(self, version, service_sid, user_sid): - """ - Initialize the UserBindingList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param user_sid: The user_sid - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - """ - super(UserBindingList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - self._uri = '/Services/{service_sid}/Users/{user_sid}/Bindings'.format(**self._solution) - - def stream(self, binding_type=values.unset, limit=None, page_size=None): - """ - Streams UserBindingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param UserBindingInstance.BindingType binding_type: The binding_type - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(binding_type=binding_type, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, binding_type=values.unset, limit=None, page_size=None): - """ - Lists UserBindingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param UserBindingInstance.BindingType binding_type: The binding_type - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance] - """ - return list(self.stream(binding_type=binding_type, limit=limit, page_size=page_size, )) - - def page(self, binding_type=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of UserBindingInstance records from the API. - Request is executed immediately - - :param UserBindingInstance.BindingType binding_type: The binding_type - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingPage - """ - params = values.of({ - 'BindingType': serialize.map(binding_type, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return UserBindingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserBindingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserBindingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserBindingContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - """ - return UserBindingContext( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a UserBindingContext - - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - """ - return UserBindingContext( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.UserBindingList>' - - -class UserBindingPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the UserBindingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param user_sid: The user_sid - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingPage - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingPage - """ - super(UserBindingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserBindingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - """ - return UserBindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.UserBindingPage>' - - -class UserBindingContext(InstanceContext): - """ """ - - def __init__(self, version, service_sid, user_sid, sid): - """ - Initialize the UserBindingContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param user_sid: The user_sid - :param sid: The sid - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - """ - super(UserBindingContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Users/{user_sid}/Bindings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a UserBindingInstance - - :returns: Fetched UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return UserBindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the UserBindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.UserBindingContext {}>'.format(context) - - -class UserBindingInstance(InstanceResource): - """ """ - - class BindingType(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - - def __init__(self, version, payload, service_sid, user_sid, sid=None): - """ - Initialize the UserBindingInstance - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - """ - super(UserBindingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'endpoint': payload['endpoint'], - 'identity': payload['identity'], - 'user_sid': payload['user_sid'], - 'credential_sid': payload['credential_sid'], - 'binding_type': payload['binding_type'], - 'message_types': payload['message_types'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'user_sid': user_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserBindingContext for this UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - """ - if self._context is None: - self._context = UserBindingContext( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def endpoint(self): - """ - :returns: The endpoint - :rtype: unicode - """ - return self._properties['endpoint'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def user_sid(self): - """ - :returns: The user_sid - :rtype: unicode - """ - return self._properties['user_sid'] - - @property - def credential_sid(self): - """ - :returns: The credential_sid - :rtype: unicode - """ - return self._properties['credential_sid'] - - @property - def binding_type(self): - """ - :returns: The binding_type - :rtype: UserBindingInstance.BindingType - """ - return self._properties['binding_type'] - - @property - def message_types(self): - """ - :returns: The message_types - :rtype: unicode - """ - return self._properties['message_types'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a UserBindingInstance - - :returns: Fetched UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the UserBindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.IpMessaging.V2.UserBindingInstance {}>'.format(context) diff --git a/twilio/rest/ip_messaging/v2/service/user/user_channel.py b/twilio/rest/ip_messaging/v2/service/user/user_channel.py deleted file mode 100644 index a17aa43..0000000 --- a/twilio/rest/ip_messaging/v2/service/user/user_channel.py +++ /dev/null @@ -1,277 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UserChannelList(ListResource): - """ """ - - def __init__(self, version, service_sid, user_sid): - """ - Initialize the UserChannelList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param user_sid: The sid - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - """ - super(UserChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - self._uri = '/Services/{service_sid}/Users/{user_sid}/Channels'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams UserChannelInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserChannelInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return UserChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserChannelPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.UserChannelList>' - - -class UserChannelPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the UserChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param user_sid: The sid - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage - """ - super(UserChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance - """ - return UserChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.UserChannelPage>' - - -class UserChannelInstance(InstanceResource): - """ """ - - class ChannelStatus(object): - JOINED = "joined" - INVITED = "invited" - NOT_PARTICIPATING = "not_participating" - - def __init__(self, version, payload, service_sid, user_sid): - """ - Initialize the UserChannelInstance - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance - """ - super(UserChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'channel_sid': payload['channel_sid'], - 'member_sid': payload['member_sid'], - 'status': payload['status'], - 'last_consumed_message_index': deserialize.integer(payload['last_consumed_message_index']), - 'unread_messages_count': deserialize.integer(payload['unread_messages_count']), - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def channel_sid(self): - """ - :returns: The channel_sid - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def member_sid(self): - """ - :returns: The member_sid - :rtype: unicode - """ - return self._properties['member_sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: UserChannelInstance.ChannelStatus - """ - return self._properties['status'] - - @property - def last_consumed_message_index(self): - """ - :returns: The last_consumed_message_index - :rtype: unicode - """ - return self._properties['last_consumed_message_index'] - - @property - def unread_messages_count(self): - """ - :returns: The unread_messages_count - :rtype: unicode - """ - return self._properties['unread_messages_count'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.IpMessaging.V2.UserChannelInstance>' diff --git a/twilio/rest/lookups/__init__.py b/twilio/rest/lookups/__init__.py deleted file mode 100644 index c0cf6e3..0000000 --- a/twilio/rest/lookups/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.lookups.v1 import V1 - - -class Lookups(Domain): - - def __init__(self, twilio): - """ - Initialize the Lookups Domain - - :returns: Domain for Lookups - :rtype: twilio.rest.lookups.Lookups - """ - super(Lookups, self).__init__(twilio) - - self.base_url = 'https://lookups.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of lookups - :rtype: twilio.rest.lookups.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def phone_numbers(self): - """ - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberList - """ - return self.v1.phone_numbers - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Lookups>' diff --git a/twilio/rest/lookups/__pycache__/__init__.cpython-36.pyc b/twilio/rest/lookups/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 2bbdd01..0000000 Binary files a/twilio/rest/lookups/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/lookups/v1/__init__.py b/twilio/rest/lookups/v1/__init__.py deleted file mode 100644 index 7ea2239..0000000 --- a/twilio/rest/lookups/v1/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.lookups.v1.phone_number import PhoneNumberList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Lookups - - :returns: V1 version of Lookups - :rtype: twilio.rest.lookups.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._phone_numbers = None - - @property - def phone_numbers(self): - """ - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberList - """ - if self._phone_numbers is None: - self._phone_numbers = PhoneNumberList(self) - return self._phone_numbers - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Lookups.V1>' diff --git a/twilio/rest/lookups/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/lookups/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index c651823..0000000 Binary files a/twilio/rest/lookups/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/lookups/v1/__pycache__/phone_number.cpython-36.pyc b/twilio/rest/lookups/v1/__pycache__/phone_number.cpython-36.pyc deleted file mode 100644 index 69282e5..0000000 Binary files a/twilio/rest/lookups/v1/__pycache__/phone_number.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/lookups/v1/phone_number.py b/twilio/rest/lookups/v1/phone_number.py deleted file mode 100644 index 3a8047c..0000000 --- a/twilio/rest/lookups/v1/phone_number.py +++ /dev/null @@ -1,301 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class PhoneNumberList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the PhoneNumberList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberList - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberList - """ - super(PhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, phone_number): - """ - Constructs a PhoneNumberContext - - :param phone_number: The phone_number - - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, phone_number=phone_number, ) - - def __call__(self, phone_number): - """ - Constructs a PhoneNumberContext - - :param phone_number: The phone_number - - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, phone_number=phone_number, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Lookups.V1.PhoneNumberList>' - - -class PhoneNumberPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the PhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberPage - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberPage - """ - super(PhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance - """ - return PhoneNumberInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Lookups.V1.PhoneNumberPage>' - - -class PhoneNumberContext(InstanceContext): - """ """ - - def __init__(self, version, phone_number): - """ - Initialize the PhoneNumberContext - - :param Version version: Version that contains the resource - :param phone_number: The phone_number - - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - """ - super(PhoneNumberContext, self).__init__(version) - - # Path Solution - self._solution = {'phone_number': phone_number, } - self._uri = '/PhoneNumbers/{phone_number}'.format(**self._solution) - - def fetch(self, country_code=values.unset, type=values.unset, - add_ons=values.unset, add_ons_data=values.unset): - """ - Fetch a PhoneNumberInstance - - :param unicode country_code: The country_code - :param unicode type: The type - :param unicode add_ons: The add_ons - :param dict add_ons_data: The add_ons_data - - :returns: Fetched PhoneNumberInstance - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance - """ - params = values.of({ - 'CountryCode': country_code, - 'Type': serialize.map(type, lambda e: e), - 'AddOns': serialize.map(add_ons, lambda e: e), - }) - - params.update(serialize.prefixed_collapsible_map(add_ons_data, 'AddOns')) - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return PhoneNumberInstance(self._version, payload, phone_number=self._solution['phone_number'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Lookups.V1.PhoneNumberContext {}>'.format(context) - - -class PhoneNumberInstance(InstanceResource): - """ """ - - class Type(object): - LANDLINE = "landline" - MOBILE = "mobile" - VOIP = "voip" - - def __init__(self, version, payload, phone_number=None): - """ - Initialize the PhoneNumberInstance - - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance - """ - super(PhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'caller_name': payload['caller_name'], - 'country_code': payload['country_code'], - 'phone_number': payload['phone_number'], - 'national_format': payload['national_format'], - 'carrier': payload['carrier'], - 'fraud': payload['fraud'], - 'add_ons': payload['add_ons'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'phone_number': phone_number or self._properties['phone_number'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PhoneNumberContext for this PhoneNumberInstance - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - """ - if self._context is None: - self._context = PhoneNumberContext(self._version, phone_number=self._solution['phone_number'], ) - return self._context - - @property - def caller_name(self): - """ - :returns: The caller_name - :rtype: unicode - """ - return self._properties['caller_name'] - - @property - def country_code(self): - """ - :returns: The country_code - :rtype: unicode - """ - return self._properties['country_code'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def national_format(self): - """ - :returns: The national_format - :rtype: unicode - """ - return self._properties['national_format'] - - @property - def carrier(self): - """ - :returns: The carrier - :rtype: unicode - """ - return self._properties['carrier'] - - @property - def fraud(self): - """ - :returns: The fraud - :rtype: unicode - """ - return self._properties['fraud'] - - @property - def add_ons(self): - """ - :returns: The add_ons - :rtype: dict - """ - return self._properties['add_ons'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, country_code=values.unset, type=values.unset, - add_ons=values.unset, add_ons_data=values.unset): - """ - Fetch a PhoneNumberInstance - - :param unicode country_code: The country_code - :param unicode type: The type - :param unicode add_ons: The add_ons - :param dict add_ons_data: The add_ons_data - - :returns: Fetched PhoneNumberInstance - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance - """ - return self._proxy.fetch( - country_code=country_code, - type=type, - add_ons=add_ons, - add_ons_data=add_ons_data, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Lookups.V1.PhoneNumberInstance {}>'.format(context) diff --git a/twilio/rest/messaging/__init__.py b/twilio/rest/messaging/__init__.py deleted file mode 100644 index aa5f3db..0000000 --- a/twilio/rest/messaging/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.messaging.v1 import V1 - - -class Messaging(Domain): - - def __init__(self, twilio): - """ - Initialize the Messaging Domain - - :returns: Domain for Messaging - :rtype: twilio.rest.messaging.Messaging - """ - super(Messaging, self).__init__(twilio) - - self.base_url = 'https://messaging.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of messaging - :rtype: twilio.rest.messaging.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def services(self): - """ - :rtype: twilio.rest.messaging.v1.service.ServiceList - """ - return self.v1.services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Messaging>' diff --git a/twilio/rest/messaging/__pycache__/__init__.cpython-36.pyc b/twilio/rest/messaging/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index f7e1286..0000000 Binary files a/twilio/rest/messaging/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/messaging/v1/__init__.py b/twilio/rest/messaging/v1/__init__.py deleted file mode 100644 index d816dfa..0000000 --- a/twilio/rest/messaging/v1/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.messaging.v1.service import ServiceList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Messaging - - :returns: V1 version of Messaging - :rtype: twilio.rest.messaging.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._services = None - - @property - def services(self): - """ - :rtype: twilio.rest.messaging.v1.service.ServiceList - """ - if self._services is None: - self._services = ServiceList(self) - return self._services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Messaging.V1>' diff --git a/twilio/rest/messaging/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/messaging/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index b646eee..0000000 Binary files a/twilio/rest/messaging/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py deleted file mode 100644 index 49d9d08..0000000 --- a/twilio/rest/messaging/v1/service/__init__.py +++ /dev/null @@ -1,716 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.messaging.v1.service.alpha_sender import AlphaSenderList -from twilio.rest.messaging.v1.service.phone_number import PhoneNumberList -from twilio.rest.messaging.v1.service.short_code import ShortCodeList - - -class ServiceList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.messaging.v1.service.ServiceList - :rtype: twilio.rest.messaging.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name, inbound_request_url=values.unset, - inbound_method=values.unset, fallback_url=values.unset, - fallback_method=values.unset, status_callback=values.unset, - sticky_sender=values.unset, mms_converter=values.unset, - smart_encoding=values.unset, scan_message_content=values.unset, - fallback_to_long_code=values.unset, area_code_geomatch=values.unset, - validity_period=values.unset, synchronous_validation=values.unset): - """ - Create a new ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode inbound_request_url: The inbound_request_url - :param unicode inbound_method: The inbound_method - :param unicode fallback_url: The fallback_url - :param unicode fallback_method: The fallback_method - :param unicode status_callback: The status_callback - :param bool sticky_sender: The sticky_sender - :param bool mms_converter: The mms_converter - :param bool smart_encoding: The smart_encoding - :param ServiceInstance.ScanMessageContent scan_message_content: The scan_message_content - :param bool fallback_to_long_code: The fallback_to_long_code - :param bool area_code_geomatch: The area_code_geomatch - :param unicode validity_period: The validity_period - :param bool synchronous_validation: The synchronous_validation - - :returns: Newly created ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'InboundRequestUrl': inbound_request_url, - 'InboundMethod': inbound_method, - 'FallbackUrl': fallback_url, - 'FallbackMethod': fallback_method, - 'StatusCallback': status_callback, - 'StickySender': sticky_sender, - 'MmsConverter': mms_converter, - 'SmartEncoding': smart_encoding, - 'ScanMessageContent': scan_message_content, - 'FallbackToLongCode': fallback_to_long_code, - 'AreaCodeGeomatch': area_code_geomatch, - 'ValidityPeriod': validity_period, - 'SynchronousValidation': synchronous_validation, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.messaging.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.messaging.v1.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServicePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.messaging.v1.service.ServiceContext - :rtype: twilio.rest.messaging.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.messaging.v1.service.ServiceContext - :rtype: twilio.rest.messaging.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Messaging.V1.ServiceList>' - - -class ServicePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.messaging.v1.service.ServicePage - :rtype: twilio.rest.messaging.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.service.ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Messaging.V1.ServicePage>' - - -class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.messaging.v1.service.ServiceContext - :rtype: twilio.rest.messaging.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._phone_numbers = None - self._short_codes = None - self._alpha_senders = None - - def update(self, friendly_name=values.unset, inbound_request_url=values.unset, - inbound_method=values.unset, fallback_url=values.unset, - fallback_method=values.unset, status_callback=values.unset, - sticky_sender=values.unset, mms_converter=values.unset, - smart_encoding=values.unset, scan_message_content=values.unset, - fallback_to_long_code=values.unset, area_code_geomatch=values.unset, - validity_period=values.unset, synchronous_validation=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode inbound_request_url: The inbound_request_url - :param unicode inbound_method: The inbound_method - :param unicode fallback_url: The fallback_url - :param unicode fallback_method: The fallback_method - :param unicode status_callback: The status_callback - :param bool sticky_sender: The sticky_sender - :param bool mms_converter: The mms_converter - :param bool smart_encoding: The smart_encoding - :param ServiceInstance.ScanMessageContent scan_message_content: The scan_message_content - :param bool fallback_to_long_code: The fallback_to_long_code - :param bool area_code_geomatch: The area_code_geomatch - :param unicode validity_period: The validity_period - :param bool synchronous_validation: The synchronous_validation - - :returns: Updated ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'InboundRequestUrl': inbound_request_url, - 'InboundMethod': inbound_method, - 'FallbackUrl': fallback_url, - 'FallbackMethod': fallback_method, - 'StatusCallback': status_callback, - 'StickySender': sticky_sender, - 'MmsConverter': mms_converter, - 'SmartEncoding': smart_encoding, - 'ScanMessageContent': scan_message_content, - 'FallbackToLongCode': fallback_to_long_code, - 'AreaCodeGeomatch': area_code_geomatch, - 'ValidityPeriod': validity_period, - 'SynchronousValidation': synchronous_validation, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def phone_numbers(self): - """ - Access the phone_numbers - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList - """ - if self._phone_numbers is None: - self._phone_numbers = PhoneNumberList(self._version, service_sid=self._solution['sid'], ) - return self._phone_numbers - - @property - def short_codes(self): - """ - Access the short_codes - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeList - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeList - """ - if self._short_codes is None: - self._short_codes = ShortCodeList(self._version, service_sid=self._solution['sid'], ) - return self._short_codes - - @property - def alpha_senders(self): - """ - Access the alpha_senders - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList - """ - if self._alpha_senders is None: - self._alpha_senders = AlphaSenderList(self._version, service_sid=self._solution['sid'], ) - return self._alpha_senders - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Messaging.V1.ServiceContext {}>'.format(context) - - -class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class ScanMessageContent(object): - INHERIT = "inherit" - ENABLE = "enable" - DISABLE = "disable" - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.messaging.v1.service.ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'inbound_request_url': payload['inbound_request_url'], - 'inbound_method': payload['inbound_method'], - 'fallback_url': payload['fallback_url'], - 'fallback_method': payload['fallback_method'], - 'status_callback': payload['status_callback'], - 'sticky_sender': payload['sticky_sender'], - 'mms_converter': payload['mms_converter'], - 'smart_encoding': payload['smart_encoding'], - 'scan_message_content': payload['scan_message_content'], - 'fallback_to_long_code': payload['fallback_to_long_code'], - 'area_code_geomatch': payload['area_code_geomatch'], - 'synchronous_validation': payload['synchronous_validation'], - 'validity_period': deserialize.integer(payload['validity_period']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceContext - """ - if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def inbound_request_url(self): - """ - :returns: The inbound_request_url - :rtype: unicode - """ - return self._properties['inbound_request_url'] - - @property - def inbound_method(self): - """ - :returns: The inbound_method - :rtype: unicode - """ - return self._properties['inbound_method'] - - @property - def fallback_url(self): - """ - :returns: The fallback_url - :rtype: unicode - """ - return self._properties['fallback_url'] - - @property - def fallback_method(self): - """ - :returns: The fallback_method - :rtype: unicode - """ - return self._properties['fallback_method'] - - @property - def status_callback(self): - """ - :returns: The status_callback - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def sticky_sender(self): - """ - :returns: The sticky_sender - :rtype: bool - """ - return self._properties['sticky_sender'] - - @property - def mms_converter(self): - """ - :returns: The mms_converter - :rtype: bool - """ - return self._properties['mms_converter'] - - @property - def smart_encoding(self): - """ - :returns: The smart_encoding - :rtype: bool - """ - return self._properties['smart_encoding'] - - @property - def scan_message_content(self): - """ - :returns: The scan_message_content - :rtype: ServiceInstance.ScanMessageContent - """ - return self._properties['scan_message_content'] - - @property - def fallback_to_long_code(self): - """ - :returns: The fallback_to_long_code - :rtype: bool - """ - return self._properties['fallback_to_long_code'] - - @property - def area_code_geomatch(self): - """ - :returns: The area_code_geomatch - :rtype: bool - """ - return self._properties['area_code_geomatch'] - - @property - def synchronous_validation(self): - """ - :returns: The synchronous_validation - :rtype: bool - """ - return self._properties['synchronous_validation'] - - @property - def validity_period(self): - """ - :returns: The validity_period - :rtype: unicode - """ - return self._properties['validity_period'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def update(self, friendly_name=values.unset, inbound_request_url=values.unset, - inbound_method=values.unset, fallback_url=values.unset, - fallback_method=values.unset, status_callback=values.unset, - sticky_sender=values.unset, mms_converter=values.unset, - smart_encoding=values.unset, scan_message_content=values.unset, - fallback_to_long_code=values.unset, area_code_geomatch=values.unset, - validity_period=values.unset, synchronous_validation=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode inbound_request_url: The inbound_request_url - :param unicode inbound_method: The inbound_method - :param unicode fallback_url: The fallback_url - :param unicode fallback_method: The fallback_method - :param unicode status_callback: The status_callback - :param bool sticky_sender: The sticky_sender - :param bool mms_converter: The mms_converter - :param bool smart_encoding: The smart_encoding - :param ServiceInstance.ScanMessageContent scan_message_content: The scan_message_content - :param bool fallback_to_long_code: The fallback_to_long_code - :param bool area_code_geomatch: The area_code_geomatch - :param unicode validity_period: The validity_period - :param bool synchronous_validation: The synchronous_validation - - :returns: Updated ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - inbound_request_url=inbound_request_url, - inbound_method=inbound_method, - fallback_url=fallback_url, - fallback_method=fallback_method, - status_callback=status_callback, - sticky_sender=sticky_sender, - mms_converter=mms_converter, - smart_encoding=smart_encoding, - scan_message_content=scan_message_content, - fallback_to_long_code=fallback_to_long_code, - area_code_geomatch=area_code_geomatch, - validity_period=validity_period, - synchronous_validation=synchronous_validation, - ) - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def phone_numbers(self): - """ - Access the phone_numbers - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList - """ - return self._proxy.phone_numbers - - @property - def short_codes(self): - """ - Access the short_codes - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeList - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeList - """ - return self._proxy.short_codes - - @property - def alpha_senders(self): - """ - Access the alpha_senders - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList - """ - return self._proxy.alpha_senders - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Messaging.V1.ServiceInstance {}>'.format(context) diff --git a/twilio/rest/messaging/v1/service/__pycache__/__init__.cpython-36.pyc b/twilio/rest/messaging/v1/service/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 55c6b05..0000000 Binary files a/twilio/rest/messaging/v1/service/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/messaging/v1/service/__pycache__/alpha_sender.cpython-36.pyc b/twilio/rest/messaging/v1/service/__pycache__/alpha_sender.cpython-36.pyc deleted file mode 100644 index 0b14df5..0000000 Binary files a/twilio/rest/messaging/v1/service/__pycache__/alpha_sender.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/messaging/v1/service/__pycache__/phone_number.cpython-36.pyc b/twilio/rest/messaging/v1/service/__pycache__/phone_number.cpython-36.pyc deleted file mode 100644 index b3dae44..0000000 Binary files a/twilio/rest/messaging/v1/service/__pycache__/phone_number.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/messaging/v1/service/__pycache__/short_code.cpython-36.pyc b/twilio/rest/messaging/v1/service/__pycache__/short_code.cpython-36.pyc deleted file mode 100644 index 7c71791..0000000 Binary files a/twilio/rest/messaging/v1/service/__pycache__/short_code.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/messaging/v1/service/alpha_sender.py b/twilio/rest/messaging/v1/service/alpha_sender.py deleted file mode 100644 index e096bd8..0000000 --- a/twilio/rest/messaging/v1/service/alpha_sender.py +++ /dev/null @@ -1,409 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class AlphaSenderList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the AlphaSenderList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList - """ - super(AlphaSenderList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/AlphaSenders'.format(**self._solution) - - def create(self, alpha_sender): - """ - Create a new AlphaSenderInstance - - :param unicode alpha_sender: The alpha_sender - - :returns: Newly created AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - """ - data = values.of({'AlphaSender': alpha_sender, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return AlphaSenderInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams AlphaSenderInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AlphaSenderInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AlphaSenderInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AlphaSenderPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AlphaSenderInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AlphaSenderPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AlphaSenderContext - - :param sid: The sid - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - """ - return AlphaSenderContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AlphaSenderContext - - :param sid: The sid - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - """ - return AlphaSenderContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Messaging.V1.AlphaSenderList>' - - -class AlphaSenderPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the AlphaSenderPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderPage - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderPage - """ - super(AlphaSenderPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AlphaSenderInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - """ - return AlphaSenderInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Messaging.V1.AlphaSenderPage>' - - -class AlphaSenderContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the AlphaSenderContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - """ - super(AlphaSenderContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/AlphaSenders/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a AlphaSenderInstance - - :returns: Fetched AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return AlphaSenderInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the AlphaSenderInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Messaging.V1.AlphaSenderContext {}>'.format(context) - - -class AlphaSenderInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the AlphaSenderInstance - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - """ - super(AlphaSenderInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'alpha_sender': payload['alpha_sender'], - 'capabilities': payload['capabilities'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AlphaSenderContext for this AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - """ - if self._context is None: - self._context = AlphaSenderContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def alpha_sender(self): - """ - :returns: The alpha_sender - :rtype: unicode - """ - return self._properties['alpha_sender'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: dict - """ - return self._properties['capabilities'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a AlphaSenderInstance - - :returns: Fetched AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the AlphaSenderInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Messaging.V1.AlphaSenderInstance {}>'.format(context) diff --git a/twilio/rest/messaging/v1/service/phone_number.py b/twilio/rest/messaging/v1/service/phone_number.py deleted file mode 100644 index 01b1624..0000000 --- a/twilio/rest/messaging/v1/service/phone_number.py +++ /dev/null @@ -1,418 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class PhoneNumberList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the PhoneNumberList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList - """ - super(PhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/PhoneNumbers'.format(**self._solution) - - def create(self, phone_number_sid): - """ - Create a new PhoneNumberInstance - - :param unicode phone_number_sid: The phone_number_sid - - :returns: Newly created PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - """ - data = values.of({'PhoneNumberSid': phone_number_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return PhoneNumberInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams PhoneNumberInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PhoneNumberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PhoneNumberInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return PhoneNumberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PhoneNumberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PhoneNumberPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a PhoneNumberContext - - :param sid: The sid - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a PhoneNumberContext - - :param sid: The sid - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Messaging.V1.PhoneNumberList>' - - -class PhoneNumberPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the PhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberPage - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberPage - """ - super(PhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - """ - return PhoneNumberInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Messaging.V1.PhoneNumberPage>' - - -class PhoneNumberContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the PhoneNumberContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - """ - super(PhoneNumberContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/PhoneNumbers/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the PhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a PhoneNumberInstance - - :returns: Fetched PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return PhoneNumberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Messaging.V1.PhoneNumberContext {}>'.format(context) - - -class PhoneNumberInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the PhoneNumberInstance - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - """ - super(PhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'phone_number': payload['phone_number'], - 'country_code': payload['country_code'], - 'capabilities': payload['capabilities'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PhoneNumberContext for this PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - """ - if self._context is None: - self._context = PhoneNumberContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def country_code(self): - """ - :returns: The country_code - :rtype: unicode - """ - return self._properties['country_code'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def delete(self): - """ - Deletes the PhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a PhoneNumberInstance - - :returns: Fetched PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Messaging.V1.PhoneNumberInstance {}>'.format(context) diff --git a/twilio/rest/messaging/v1/service/short_code.py b/twilio/rest/messaging/v1/service/short_code.py deleted file mode 100644 index 05cbbb7..0000000 --- a/twilio/rest/messaging/v1/service/short_code.py +++ /dev/null @@ -1,418 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class ShortCodeList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the ShortCodeList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeList - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeList - """ - super(ShortCodeList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/ShortCodes'.format(**self._solution) - - def create(self, short_code_sid): - """ - Create a new ShortCodeInstance - - :param unicode short_code_sid: The short_code_sid - - :returns: Newly created ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - """ - data = values.of({'ShortCodeSid': short_code_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams ShortCodeInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.messaging.v1.service.short_code.ShortCodeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ShortCodeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.messaging.v1.service.short_code.ShortCodeInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ShortCodeInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ShortCodePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ShortCodeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ShortCodePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ShortCodeContext - - :param sid: The sid - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ShortCodeContext - - :param sid: The sid - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Messaging.V1.ShortCodeList>' - - -class ShortCodePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ShortCodePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodePage - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodePage - """ - super(ShortCodePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ShortCodeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - """ - return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Messaging.V1.ShortCodePage>' - - -class ShortCodeContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the ShortCodeContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - """ - super(ShortCodeContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/ShortCodes/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the ShortCodeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a ShortCodeInstance - - :returns: Fetched ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ShortCodeInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Messaging.V1.ShortCodeContext {}>'.format(context) - - -class ShortCodeInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ShortCodeInstance - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - """ - super(ShortCodeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'short_code': payload['short_code'], - 'country_code': payload['country_code'], - 'capabilities': payload['capabilities'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ShortCodeContext for this ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - """ - if self._context is None: - self._context = ShortCodeContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def short_code(self): - """ - :returns: The short_code - :rtype: unicode - """ - return self._properties['short_code'] - - @property - def country_code(self): - """ - :returns: The country_code - :rtype: unicode - """ - return self._properties['country_code'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: dict - """ - return self._properties['capabilities'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def delete(self): - """ - Deletes the ShortCodeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a ShortCodeInstance - - :returns: Fetched ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Messaging.V1.ShortCodeInstance {}>'.format(context) diff --git a/twilio/rest/monitor/__init__.py b/twilio/rest/monitor/__init__.py deleted file mode 100644 index c686ca9..0000000 --- a/twilio/rest/monitor/__init__.py +++ /dev/null @@ -1,60 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.monitor.v1 import V1 - - -class Monitor(Domain): - - def __init__(self, twilio): - """ - Initialize the Monitor Domain - - :returns: Domain for Monitor - :rtype: twilio.rest.monitor.Monitor - """ - super(Monitor, self).__init__(twilio) - - self.base_url = 'https://monitor.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of monitor - :rtype: twilio.rest.monitor.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def alerts(self): - """ - :rtype: twilio.rest.monitor.v1.alert.AlertList - """ - return self.v1.alerts - - @property - def events(self): - """ - :rtype: twilio.rest.monitor.v1.event.EventList - """ - return self.v1.events - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Monitor>' diff --git a/twilio/rest/monitor/__pycache__/__init__.cpython-36.pyc b/twilio/rest/monitor/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 5b23acf..0000000 Binary files a/twilio/rest/monitor/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/monitor/v1/__init__.py b/twilio/rest/monitor/v1/__init__.py deleted file mode 100644 index efa1a5a..0000000 --- a/twilio/rest/monitor/v1/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.monitor.v1.alert import AlertList -from twilio.rest.monitor.v1.event import EventList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Monitor - - :returns: V1 version of Monitor - :rtype: twilio.rest.monitor.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._alerts = None - self._events = None - - @property - def alerts(self): - """ - :rtype: twilio.rest.monitor.v1.alert.AlertList - """ - if self._alerts is None: - self._alerts = AlertList(self) - return self._alerts - - @property - def events(self): - """ - :rtype: twilio.rest.monitor.v1.event.EventList - """ - if self._events is None: - self._events = EventList(self) - return self._events - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Monitor.V1>' diff --git a/twilio/rest/monitor/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/monitor/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 474483e..0000000 Binary files a/twilio/rest/monitor/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/monitor/v1/__pycache__/alert.cpython-36.pyc b/twilio/rest/monitor/v1/__pycache__/alert.cpython-36.pyc deleted file mode 100644 index 60a3067..0000000 Binary files a/twilio/rest/monitor/v1/__pycache__/alert.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/monitor/v1/__pycache__/event.cpython-36.pyc b/twilio/rest/monitor/v1/__pycache__/event.cpython-36.pyc deleted file mode 100644 index 757a2b0..0000000 Binary files a/twilio/rest/monitor/v1/__pycache__/event.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/monitor/v1/alert.py b/twilio/rest/monitor/v1/alert.py deleted file mode 100644 index 07b023a..0000000 --- a/twilio/rest/monitor/v1/alert.py +++ /dev/null @@ -1,486 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class AlertList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the AlertList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.monitor.v1.alert.AlertList - :rtype: twilio.rest.monitor.v1.alert.AlertList - """ - super(AlertList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Alerts'.format(**self._solution) - - def stream(self, log_level=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Streams AlertInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode log_level: The log_level - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.monitor.v1.alert.AlertInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - log_level=log_level, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, log_level=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Lists AlertInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode log_level: The log_level - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.monitor.v1.alert.AlertInstance] - """ - return list(self.stream( - log_level=log_level, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, log_level=values.unset, start_date=values.unset, - end_date=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of AlertInstance records from the API. - Request is executed immediately - - :param unicode log_level: The log_level - :param date start_date: The start_date - :param date end_date: The end_date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertPage - """ - params = values.of({ - 'LogLevel': log_level, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AlertPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AlertInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AlertPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AlertContext - - :param sid: The sid - - :returns: twilio.rest.monitor.v1.alert.AlertContext - :rtype: twilio.rest.monitor.v1.alert.AlertContext - """ - return AlertContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AlertContext - - :param sid: The sid - - :returns: twilio.rest.monitor.v1.alert.AlertContext - :rtype: twilio.rest.monitor.v1.alert.AlertContext - """ - return AlertContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Monitor.V1.AlertList>' - - -class AlertPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the AlertPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.monitor.v1.alert.AlertPage - :rtype: twilio.rest.monitor.v1.alert.AlertPage - """ - super(AlertPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AlertInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.monitor.v1.alert.AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertInstance - """ - return AlertInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Monitor.V1.AlertPage>' - - -class AlertContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the AlertContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.monitor.v1.alert.AlertContext - :rtype: twilio.rest.monitor.v1.alert.AlertContext - """ - super(AlertContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Alerts/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a AlertInstance - - :returns: Fetched AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return AlertInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the AlertInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Monitor.V1.AlertContext {}>'.format(context) - - -class AlertInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the AlertInstance - - :returns: twilio.rest.monitor.v1.alert.AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertInstance - """ - super(AlertInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'alert_text': payload['alert_text'], - 'api_version': payload['api_version'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_generated': deserialize.iso8601_datetime(payload['date_generated']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'error_code': payload['error_code'], - 'log_level': payload['log_level'], - 'more_info': payload['more_info'], - 'request_method': payload['request_method'], - 'request_url': payload['request_url'], - 'resource_sid': payload['resource_sid'], - 'sid': payload['sid'], - 'url': payload['url'], - 'request_variables': payload.get('request_variables'), - 'response_body': payload.get('response_body'), - 'response_headers': payload.get('response_headers'), - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AlertContext for this AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertContext - """ - if self._context is None: - self._context = AlertContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def alert_text(self): - """ - :returns: The alert_text - :rtype: unicode - """ - return self._properties['alert_text'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_generated(self): - """ - :returns: The date_generated - :rtype: datetime - """ - return self._properties['date_generated'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def error_code(self): - """ - :returns: The error_code - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def log_level(self): - """ - :returns: The log_level - :rtype: unicode - """ - return self._properties['log_level'] - - @property - def more_info(self): - """ - :returns: The more_info - :rtype: unicode - """ - return self._properties['more_info'] - - @property - def request_method(self): - """ - :returns: The request_method - :rtype: unicode - """ - return self._properties['request_method'] - - @property - def request_url(self): - """ - :returns: The request_url - :rtype: unicode - """ - return self._properties['request_url'] - - @property - def request_variables(self): - """ - :returns: The request_variables - :rtype: unicode - """ - return self._properties['request_variables'] - - @property - def resource_sid(self): - """ - :returns: The resource_sid - :rtype: unicode - """ - return self._properties['resource_sid'] - - @property - def response_body(self): - """ - :returns: The response_body - :rtype: unicode - """ - return self._properties['response_body'] - - @property - def response_headers(self): - """ - :returns: The response_headers - :rtype: unicode - """ - return self._properties['response_headers'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a AlertInstance - - :returns: Fetched AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the AlertInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Monitor.V1.AlertInstance {}>'.format(context) diff --git a/twilio/rest/monitor/v1/event.py b/twilio/rest/monitor/v1/event.py deleted file mode 100644 index b10f74a..0000000 --- a/twilio/rest/monitor/v1/event.py +++ /dev/null @@ -1,465 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class EventList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the EventList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.monitor.v1.event.EventList - :rtype: twilio.rest.monitor.v1.event.EventList - """ - super(EventList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Events'.format(**self._solution) - - def stream(self, actor_sid=values.unset, event_type=values.unset, - resource_sid=values.unset, source_ip_address=values.unset, - start_date=values.unset, end_date=values.unset, limit=None, - page_size=None): - """ - Streams EventInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode actor_sid: The actor_sid - :param unicode event_type: The event_type - :param unicode resource_sid: The resource_sid - :param unicode source_ip_address: The source_ip_address - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.monitor.v1.event.EventInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - actor_sid=actor_sid, - event_type=event_type, - resource_sid=resource_sid, - source_ip_address=source_ip_address, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, actor_sid=values.unset, event_type=values.unset, - resource_sid=values.unset, source_ip_address=values.unset, - start_date=values.unset, end_date=values.unset, limit=None, - page_size=None): - """ - Lists EventInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode actor_sid: The actor_sid - :param unicode event_type: The event_type - :param unicode resource_sid: The resource_sid - :param unicode source_ip_address: The source_ip_address - :param date start_date: The start_date - :param date end_date: The end_date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.monitor.v1.event.EventInstance] - """ - return list(self.stream( - actor_sid=actor_sid, - event_type=event_type, - resource_sid=resource_sid, - source_ip_address=source_ip_address, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, actor_sid=values.unset, event_type=values.unset, - resource_sid=values.unset, source_ip_address=values.unset, - start_date=values.unset, end_date=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EventInstance records from the API. - Request is executed immediately - - :param unicode actor_sid: The actor_sid - :param unicode event_type: The event_type - :param unicode resource_sid: The resource_sid - :param unicode source_ip_address: The source_ip_address - :param date start_date: The start_date - :param date end_date: The end_date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of EventInstance - :rtype: twilio.rest.monitor.v1.event.EventPage - """ - params = values.of({ - 'ActorSid': actor_sid, - 'EventType': event_type, - 'ResourceSid': resource_sid, - 'SourceIpAddress': source_ip_address, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return EventPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EventInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EventInstance - :rtype: twilio.rest.monitor.v1.event.EventPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EventPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a EventContext - - :param sid: The sid - - :returns: twilio.rest.monitor.v1.event.EventContext - :rtype: twilio.rest.monitor.v1.event.EventContext - """ - return EventContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EventContext - - :param sid: The sid - - :returns: twilio.rest.monitor.v1.event.EventContext - :rtype: twilio.rest.monitor.v1.event.EventContext - """ - return EventContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Monitor.V1.EventList>' - - -class EventPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the EventPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.monitor.v1.event.EventPage - :rtype: twilio.rest.monitor.v1.event.EventPage - """ - super(EventPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EventInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.monitor.v1.event.EventInstance - :rtype: twilio.rest.monitor.v1.event.EventInstance - """ - return EventInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Monitor.V1.EventPage>' - - -class EventContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the EventContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.monitor.v1.event.EventContext - :rtype: twilio.rest.monitor.v1.event.EventContext - """ - super(EventContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Events/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a EventInstance - - :returns: Fetched EventInstance - :rtype: twilio.rest.monitor.v1.event.EventInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return EventInstance(self._version, payload, sid=self._solution['sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Monitor.V1.EventContext {}>'.format(context) - - -class EventInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the EventInstance - - :returns: twilio.rest.monitor.v1.event.EventInstance - :rtype: twilio.rest.monitor.v1.event.EventInstance - """ - super(EventInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'actor_sid': payload['actor_sid'], - 'actor_type': payload['actor_type'], - 'description': payload['description'], - 'event_data': payload['event_data'], - 'event_date': deserialize.iso8601_datetime(payload['event_date']), - 'event_type': payload['event_type'], - 'resource_sid': payload['resource_sid'], - 'resource_type': payload['resource_type'], - 'sid': payload['sid'], - 'source': payload['source'], - 'source_ip_address': payload['source_ip_address'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EventContext for this EventInstance - :rtype: twilio.rest.monitor.v1.event.EventContext - """ - if self._context is None: - self._context = EventContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def actor_sid(self): - """ - :returns: The actor_sid - :rtype: unicode - """ - return self._properties['actor_sid'] - - @property - def actor_type(self): - """ - :returns: The actor_type - :rtype: unicode - """ - return self._properties['actor_type'] - - @property - def description(self): - """ - :returns: The description - :rtype: unicode - """ - return self._properties['description'] - - @property - def event_data(self): - """ - :returns: The event_data - :rtype: dict - """ - return self._properties['event_data'] - - @property - def event_date(self): - """ - :returns: The event_date - :rtype: datetime - """ - return self._properties['event_date'] - - @property - def event_type(self): - """ - :returns: The event_type - :rtype: unicode - """ - return self._properties['event_type'] - - @property - def resource_sid(self): - """ - :returns: The resource_sid - :rtype: unicode - """ - return self._properties['resource_sid'] - - @property - def resource_type(self): - """ - :returns: The resource_type - :rtype: unicode - """ - return self._properties['resource_type'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def source(self): - """ - :returns: The source - :rtype: unicode - """ - return self._properties['source'] - - @property - def source_ip_address(self): - """ - :returns: The source_ip_address - :rtype: unicode - """ - return self._properties['source_ip_address'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a EventInstance - - :returns: Fetched EventInstance - :rtype: twilio.rest.monitor.v1.event.EventInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Monitor.V1.EventInstance {}>'.format(context) diff --git a/twilio/rest/notify/__init__.py b/twilio/rest/notify/__init__.py deleted file mode 100644 index 5dabaa6..0000000 --- a/twilio/rest/notify/__init__.py +++ /dev/null @@ -1,60 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.notify.v1 import V1 - - -class Notify(Domain): - - def __init__(self, twilio): - """ - Initialize the Notify Domain - - :returns: Domain for Notify - :rtype: twilio.rest.notify.Notify - """ - super(Notify, self).__init__(twilio) - - self.base_url = 'https://notify.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of notify - :rtype: twilio.rest.notify.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def credentials(self): - """ - :rtype: twilio.rest.notify.v1.credential.CredentialList - """ - return self.v1.credentials - - @property - def services(self): - """ - :rtype: twilio.rest.notify.v1.service.ServiceList - """ - return self.v1.services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify>' diff --git a/twilio/rest/notify/__pycache__/__init__.cpython-36.pyc b/twilio/rest/notify/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 2502d92..0000000 Binary files a/twilio/rest/notify/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/notify/v1/__init__.py b/twilio/rest/notify/v1/__init__.py deleted file mode 100644 index 2003033..0000000 --- a/twilio/rest/notify/v1/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.notify.v1.credential import CredentialList -from twilio.rest.notify.v1.service import ServiceList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Notify - - :returns: V1 version of Notify - :rtype: twilio.rest.notify.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._credentials = None - self._services = None - - @property - def credentials(self): - """ - :rtype: twilio.rest.notify.v1.credential.CredentialList - """ - if self._credentials is None: - self._credentials = CredentialList(self) - return self._credentials - - @property - def services(self): - """ - :rtype: twilio.rest.notify.v1.service.ServiceList - """ - if self._services is None: - self._services = ServiceList(self) - return self._services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1>' diff --git a/twilio/rest/notify/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/notify/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 367f03f..0000000 Binary files a/twilio/rest/notify/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/notify/v1/__pycache__/credential.cpython-36.pyc b/twilio/rest/notify/v1/__pycache__/credential.cpython-36.pyc deleted file mode 100644 index 4276a11..0000000 Binary files a/twilio/rest/notify/v1/__pycache__/credential.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/notify/v1/credential.py b/twilio/rest/notify/v1/credential.py deleted file mode 100644 index 969bff6..0000000 --- a/twilio/rest/notify/v1/credential.py +++ /dev/null @@ -1,476 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class CredentialList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the CredentialList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.notify.v1.credential.CredentialList - :rtype: twilio.rest.notify.v1.credential.CredentialList - """ - super(CredentialList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Credentials'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.notify.v1.credential.CredentialInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.notify.v1.credential.CredentialInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CredentialPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialPage(self._version, response, self._solution) - - def create(self, type, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Create a new CredentialInstance - - :param CredentialInstance.PushService type: The type - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Newly created CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance - """ - data = values.of({ - 'Type': type, - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CredentialInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a CredentialContext - - :param sid: The sid - - :returns: twilio.rest.notify.v1.credential.CredentialContext - :rtype: twilio.rest.notify.v1.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CredentialContext - - :param sid: The sid - - :returns: twilio.rest.notify.v1.credential.CredentialContext - :rtype: twilio.rest.notify.v1.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.CredentialList>' - - -class CredentialPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the CredentialPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.notify.v1.credential.CredentialPage - :rtype: twilio.rest.notify.v1.credential.CredentialPage - """ - super(CredentialPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.notify.v1.credential.CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance - """ - return CredentialInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.CredentialPage>' - - -class CredentialContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the CredentialContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.notify.v1.credential.CredentialContext - :rtype: twilio.rest.notify.v1.credential.CredentialContext - """ - super(CredentialContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Credentials/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a CredentialInstance - - :returns: Fetched CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Updated CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Notify.V1.CredentialContext {}>'.format(context) - - -class CredentialInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class PushService(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - - def __init__(self, version, payload, sid=None): - """ - Initialize the CredentialInstance - - :returns: twilio.rest.notify.v1.credential.CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance - """ - super(CredentialInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'type': payload['type'], - 'sandbox': payload['sandbox'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialContext for this CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialContext - """ - if self._context is None: - self._context = CredentialContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type - :rtype: CredentialInstance.PushService - """ - return self._properties['type'] - - @property - def sandbox(self): - """ - :returns: The sandbox - :rtype: unicode - """ - return self._properties['sandbox'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a CredentialInstance - - :returns: Fetched CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - - :param unicode friendly_name: The friendly_name - :param unicode certificate: The certificate - :param unicode private_key: The private_key - :param bool sandbox: The sandbox - :param unicode api_key: The api_key - :param unicode secret: The secret - - :returns: Updated CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - certificate=certificate, - private_key=private_key, - sandbox=sandbox, - api_key=api_key, - secret=secret, - ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Notify.V1.CredentialInstance {}>'.format(context) diff --git a/twilio/rest/notify/v1/service/__init__.py b/twilio/rest/notify/v1/service/__init__.py deleted file mode 100644 index 6c96faf..0000000 --- a/twilio/rest/notify/v1/service/__init__.py +++ /dev/null @@ -1,719 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.notify.v1.service.binding import BindingList -from twilio.rest.notify.v1.service.notification import NotificationList -from twilio.rest.notify.v1.service.segment import SegmentList -from twilio.rest.notify.v1.service.user import UserList - - -class ServiceList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.notify.v1.service.ServiceList - :rtype: twilio.rest.notify.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name=values.unset, apn_credential_sid=values.unset, - gcm_credential_sid=values.unset, messaging_service_sid=values.unset, - facebook_messenger_page_id=values.unset, - default_apn_notification_protocol_version=values.unset, - default_gcm_notification_protocol_version=values.unset, - fcm_credential_sid=values.unset, - default_fcm_notification_protocol_version=values.unset, - log_enabled=values.unset, alexa_skill_id=values.unset, - default_alexa_notification_protocol_version=values.unset): - """ - Create a new ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode apn_credential_sid: The apn_credential_sid - :param unicode gcm_credential_sid: The gcm_credential_sid - :param unicode messaging_service_sid: The messaging_service_sid - :param unicode facebook_messenger_page_id: The facebook_messenger_page_id - :param unicode default_apn_notification_protocol_version: The default_apn_notification_protocol_version - :param unicode default_gcm_notification_protocol_version: The default_gcm_notification_protocol_version - :param unicode fcm_credential_sid: The fcm_credential_sid - :param unicode default_fcm_notification_protocol_version: The default_fcm_notification_protocol_version - :param bool log_enabled: The log_enabled - :param unicode alexa_skill_id: The alexa_skill_id - :param unicode default_alexa_notification_protocol_version: The default_alexa_notification_protocol_version - - :returns: Newly created ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'ApnCredentialSid': apn_credential_sid, - 'GcmCredentialSid': gcm_credential_sid, - 'MessagingServiceSid': messaging_service_sid, - 'FacebookMessengerPageId': facebook_messenger_page_id, - 'DefaultApnNotificationProtocolVersion': default_apn_notification_protocol_version, - 'DefaultGcmNotificationProtocolVersion': default_gcm_notification_protocol_version, - 'FcmCredentialSid': fcm_credential_sid, - 'DefaultFcmNotificationProtocolVersion': default_fcm_notification_protocol_version, - 'LogEnabled': log_enabled, - 'AlexaSkillId': alexa_skill_id, - 'DefaultAlexaNotificationProtocolVersion': default_alexa_notification_protocol_version, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode friendly_name: The friendly_name - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.notify.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: The friendly_name - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.notify.v1.service.ServiceInstance] - """ - return list(self.stream(friendly_name=friendly_name, limit=limit, page_size=page_size, )) - - def page(self, friendly_name=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: The friendly_name - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServicePage - """ - params = values.of({ - 'FriendlyName': friendly_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.notify.v1.service.ServiceContext - :rtype: twilio.rest.notify.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.notify.v1.service.ServiceContext - :rtype: twilio.rest.notify.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.ServiceList>' - - -class ServicePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.notify.v1.service.ServicePage - :rtype: twilio.rest.notify.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.notify.v1.service.ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.ServicePage>' - - -class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.notify.v1.service.ServiceContext - :rtype: twilio.rest.notify.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._bindings = None - self._notifications = None - self._users = None - self._segments = None - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, apn_credential_sid=values.unset, - gcm_credential_sid=values.unset, messaging_service_sid=values.unset, - facebook_messenger_page_id=values.unset, - default_apn_notification_protocol_version=values.unset, - default_gcm_notification_protocol_version=values.unset, - fcm_credential_sid=values.unset, - default_fcm_notification_protocol_version=values.unset, - log_enabled=values.unset, alexa_skill_id=values.unset, - default_alexa_notification_protocol_version=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode apn_credential_sid: The apn_credential_sid - :param unicode gcm_credential_sid: The gcm_credential_sid - :param unicode messaging_service_sid: The messaging_service_sid - :param unicode facebook_messenger_page_id: The facebook_messenger_page_id - :param unicode default_apn_notification_protocol_version: The default_apn_notification_protocol_version - :param unicode default_gcm_notification_protocol_version: The default_gcm_notification_protocol_version - :param unicode fcm_credential_sid: The fcm_credential_sid - :param unicode default_fcm_notification_protocol_version: The default_fcm_notification_protocol_version - :param bool log_enabled: The log_enabled - :param unicode alexa_skill_id: The alexa_skill_id - :param unicode default_alexa_notification_protocol_version: The default_alexa_notification_protocol_version - - :returns: Updated ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'ApnCredentialSid': apn_credential_sid, - 'GcmCredentialSid': gcm_credential_sid, - 'MessagingServiceSid': messaging_service_sid, - 'FacebookMessengerPageId': facebook_messenger_page_id, - 'DefaultApnNotificationProtocolVersion': default_apn_notification_protocol_version, - 'DefaultGcmNotificationProtocolVersion': default_gcm_notification_protocol_version, - 'FcmCredentialSid': fcm_credential_sid, - 'DefaultFcmNotificationProtocolVersion': default_fcm_notification_protocol_version, - 'LogEnabled': log_enabled, - 'AlexaSkillId': alexa_skill_id, - 'DefaultAlexaNotificationProtocolVersion': default_alexa_notification_protocol_version, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def bindings(self): - """ - Access the bindings - - :returns: twilio.rest.notify.v1.service.binding.BindingList - :rtype: twilio.rest.notify.v1.service.binding.BindingList - """ - if self._bindings is None: - self._bindings = BindingList(self._version, service_sid=self._solution['sid'], ) - return self._bindings - - @property - def notifications(self): - """ - Access the notifications - - :returns: twilio.rest.notify.v1.service.notification.NotificationList - :rtype: twilio.rest.notify.v1.service.notification.NotificationList - """ - if self._notifications is None: - self._notifications = NotificationList(self._version, service_sid=self._solution['sid'], ) - return self._notifications - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.notify.v1.service.user.UserList - :rtype: twilio.rest.notify.v1.service.user.UserList - """ - if self._users is None: - self._users = UserList(self._version, service_sid=self._solution['sid'], ) - return self._users - - @property - def segments(self): - """ - Access the segments - - :returns: twilio.rest.notify.v1.service.segment.SegmentList - :rtype: twilio.rest.notify.v1.service.segment.SegmentList - """ - if self._segments is None: - self._segments = SegmentList(self._version, service_sid=self._solution['sid'], ) - return self._segments - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Notify.V1.ServiceContext {}>'.format(context) - - -class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.notify.v1.service.ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'apn_credential_sid': payload['apn_credential_sid'], - 'gcm_credential_sid': payload['gcm_credential_sid'], - 'fcm_credential_sid': payload['fcm_credential_sid'], - 'messaging_service_sid': payload['messaging_service_sid'], - 'facebook_messenger_page_id': payload['facebook_messenger_page_id'], - 'default_apn_notification_protocol_version': payload['default_apn_notification_protocol_version'], - 'default_gcm_notification_protocol_version': payload['default_gcm_notification_protocol_version'], - 'default_fcm_notification_protocol_version': payload['default_fcm_notification_protocol_version'], - 'log_enabled': payload['log_enabled'], - 'url': payload['url'], - 'links': payload['links'], - 'alexa_skill_id': payload['alexa_skill_id'], - 'default_alexa_notification_protocol_version': payload['default_alexa_notification_protocol_version'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceContext - """ - if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def apn_credential_sid(self): - """ - :returns: The apn_credential_sid - :rtype: unicode - """ - return self._properties['apn_credential_sid'] - - @property - def gcm_credential_sid(self): - """ - :returns: The gcm_credential_sid - :rtype: unicode - """ - return self._properties['gcm_credential_sid'] - - @property - def fcm_credential_sid(self): - """ - :returns: The fcm_credential_sid - :rtype: unicode - """ - return self._properties['fcm_credential_sid'] - - @property - def messaging_service_sid(self): - """ - :returns: The messaging_service_sid - :rtype: unicode - """ - return self._properties['messaging_service_sid'] - - @property - def facebook_messenger_page_id(self): - """ - :returns: The facebook_messenger_page_id - :rtype: unicode - """ - return self._properties['facebook_messenger_page_id'] - - @property - def default_apn_notification_protocol_version(self): - """ - :returns: The default_apn_notification_protocol_version - :rtype: unicode - """ - return self._properties['default_apn_notification_protocol_version'] - - @property - def default_gcm_notification_protocol_version(self): - """ - :returns: The default_gcm_notification_protocol_version - :rtype: unicode - """ - return self._properties['default_gcm_notification_protocol_version'] - - @property - def default_fcm_notification_protocol_version(self): - """ - :returns: The default_fcm_notification_protocol_version - :rtype: unicode - """ - return self._properties['default_fcm_notification_protocol_version'] - - @property - def log_enabled(self): - """ - :returns: The log_enabled - :rtype: bool - """ - return self._properties['log_enabled'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def alexa_skill_id(self): - """ - :returns: The alexa_skill_id - :rtype: unicode - """ - return self._properties['alexa_skill_id'] - - @property - def default_alexa_notification_protocol_version(self): - """ - :returns: The default_alexa_notification_protocol_version - :rtype: unicode - """ - return self._properties['default_alexa_notification_protocol_version'] - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, apn_credential_sid=values.unset, - gcm_credential_sid=values.unset, messaging_service_sid=values.unset, - facebook_messenger_page_id=values.unset, - default_apn_notification_protocol_version=values.unset, - default_gcm_notification_protocol_version=values.unset, - fcm_credential_sid=values.unset, - default_fcm_notification_protocol_version=values.unset, - log_enabled=values.unset, alexa_skill_id=values.unset, - default_alexa_notification_protocol_version=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode apn_credential_sid: The apn_credential_sid - :param unicode gcm_credential_sid: The gcm_credential_sid - :param unicode messaging_service_sid: The messaging_service_sid - :param unicode facebook_messenger_page_id: The facebook_messenger_page_id - :param unicode default_apn_notification_protocol_version: The default_apn_notification_protocol_version - :param unicode default_gcm_notification_protocol_version: The default_gcm_notification_protocol_version - :param unicode fcm_credential_sid: The fcm_credential_sid - :param unicode default_fcm_notification_protocol_version: The default_fcm_notification_protocol_version - :param bool log_enabled: The log_enabled - :param unicode alexa_skill_id: The alexa_skill_id - :param unicode default_alexa_notification_protocol_version: The default_alexa_notification_protocol_version - - :returns: Updated ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - apn_credential_sid=apn_credential_sid, - gcm_credential_sid=gcm_credential_sid, - messaging_service_sid=messaging_service_sid, - facebook_messenger_page_id=facebook_messenger_page_id, - default_apn_notification_protocol_version=default_apn_notification_protocol_version, - default_gcm_notification_protocol_version=default_gcm_notification_protocol_version, - fcm_credential_sid=fcm_credential_sid, - default_fcm_notification_protocol_version=default_fcm_notification_protocol_version, - log_enabled=log_enabled, - alexa_skill_id=alexa_skill_id, - default_alexa_notification_protocol_version=default_alexa_notification_protocol_version, - ) - - @property - def bindings(self): - """ - Access the bindings - - :returns: twilio.rest.notify.v1.service.binding.BindingList - :rtype: twilio.rest.notify.v1.service.binding.BindingList - """ - return self._proxy.bindings - - @property - def notifications(self): - """ - Access the notifications - - :returns: twilio.rest.notify.v1.service.notification.NotificationList - :rtype: twilio.rest.notify.v1.service.notification.NotificationList - """ - return self._proxy.notifications - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.notify.v1.service.user.UserList - :rtype: twilio.rest.notify.v1.service.user.UserList - """ - return self._proxy.users - - @property - def segments(self): - """ - Access the segments - - :returns: twilio.rest.notify.v1.service.segment.SegmentList - :rtype: twilio.rest.notify.v1.service.segment.SegmentList - """ - return self._proxy.segments - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Notify.V1.ServiceInstance {}>'.format(context) diff --git a/twilio/rest/notify/v1/service/__pycache__/__init__.cpython-36.pyc b/twilio/rest/notify/v1/service/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 409a2bb..0000000 Binary files a/twilio/rest/notify/v1/service/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/notify/v1/service/__pycache__/binding.cpython-36.pyc b/twilio/rest/notify/v1/service/__pycache__/binding.cpython-36.pyc deleted file mode 100644 index d3cfd02..0000000 Binary files a/twilio/rest/notify/v1/service/__pycache__/binding.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/notify/v1/service/__pycache__/notification.cpython-36.pyc b/twilio/rest/notify/v1/service/__pycache__/notification.cpython-36.pyc deleted file mode 100644 index 1fda580..0000000 Binary files a/twilio/rest/notify/v1/service/__pycache__/notification.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/notify/v1/service/__pycache__/segment.cpython-36.pyc b/twilio/rest/notify/v1/service/__pycache__/segment.cpython-36.pyc deleted file mode 100644 index c0e002f..0000000 Binary files a/twilio/rest/notify/v1/service/__pycache__/segment.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/notify/v1/service/binding.py b/twilio/rest/notify/v1/service/binding.py deleted file mode 100644 index a3769ce..0000000 --- a/twilio/rest/notify/v1/service/binding.py +++ /dev/null @@ -1,524 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class BindingList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the BindingList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.notify.v1.service.binding.BindingList - :rtype: twilio.rest.notify.v1.service.binding.BindingList - """ - super(BindingList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Bindings'.format(**self._solution) - - def create(self, identity, binding_type, address, tag=values.unset, - notification_protocol_version=values.unset, - credential_sid=values.unset, endpoint=values.unset): - """ - Create a new BindingInstance - - :param unicode identity: The identity - :param BindingInstance.BindingType binding_type: The binding_type - :param unicode address: The address - :param unicode tag: The tag - :param unicode notification_protocol_version: The notification_protocol_version - :param unicode credential_sid: The credential_sid - :param unicode endpoint: The endpoint - - :returns: Newly created BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingInstance - """ - data = values.of({ - 'Identity': identity, - 'BindingType': binding_type, - 'Address': address, - 'Tag': serialize.map(tag, lambda e: e), - 'NotificationProtocolVersion': notification_protocol_version, - 'CredentialSid': credential_sid, - 'Endpoint': endpoint, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return BindingInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, start_date=values.unset, end_date=values.unset, - identity=values.unset, tag=values.unset, limit=None, page_size=None): - """ - Streams BindingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param date start_date: The start_date - :param date end_date: The end_date - :param unicode identity: The identity - :param unicode tag: The tag - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.notify.v1.service.binding.BindingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - start_date=start_date, - end_date=end_date, - identity=identity, - tag=tag, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, start_date=values.unset, end_date=values.unset, - identity=values.unset, tag=values.unset, limit=None, page_size=None): - """ - Lists BindingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param date start_date: The start_date - :param date end_date: The end_date - :param unicode identity: The identity - :param unicode tag: The tag - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.notify.v1.service.binding.BindingInstance] - """ - return list(self.stream( - start_date=start_date, - end_date=end_date, - identity=identity, - tag=tag, - limit=limit, - page_size=page_size, - )) - - def page(self, start_date=values.unset, end_date=values.unset, - identity=values.unset, tag=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of BindingInstance records from the API. - Request is executed immediately - - :param date start_date: The start_date - :param date end_date: The end_date - :param unicode identity: The identity - :param unicode tag: The tag - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingPage - """ - params = values.of({ - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'Identity': serialize.map(identity, lambda e: e), - 'Tag': serialize.map(tag, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return BindingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of BindingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return BindingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a BindingContext - - :param sid: The sid - - :returns: twilio.rest.notify.v1.service.binding.BindingContext - :rtype: twilio.rest.notify.v1.service.binding.BindingContext - """ - return BindingContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a BindingContext - - :param sid: The sid - - :returns: twilio.rest.notify.v1.service.binding.BindingContext - :rtype: twilio.rest.notify.v1.service.binding.BindingContext - """ - return BindingContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.BindingList>' - - -class BindingPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the BindingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.notify.v1.service.binding.BindingPage - :rtype: twilio.rest.notify.v1.service.binding.BindingPage - """ - super(BindingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BindingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.notify.v1.service.binding.BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingInstance - """ - return BindingInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.BindingPage>' - - -class BindingContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the BindingContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.notify.v1.service.binding.BindingContext - :rtype: twilio.rest.notify.v1.service.binding.BindingContext - """ - super(BindingContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Bindings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a BindingInstance - - :returns: Fetched BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return BindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the BindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Notify.V1.BindingContext {}>'.format(context) - - -class BindingInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class BindingType(object): - APN = "apn" - GCM = "gcm" - SMS = "sms" - FCM = "fcm" - FACEBOOK_MESSENGER = "facebook-messenger" - ALEXA = "alexa" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the BindingInstance - - :returns: twilio.rest.notify.v1.service.binding.BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingInstance - """ - super(BindingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'credential_sid': payload['credential_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'notification_protocol_version': payload['notification_protocol_version'], - 'endpoint': payload['endpoint'], - 'identity': payload['identity'], - 'binding_type': payload['binding_type'], - 'address': payload['address'], - 'tags': payload['tags'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: BindingContext for this BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingContext - """ - if self._context is None: - self._context = BindingContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def credential_sid(self): - """ - :returns: The credential_sid - :rtype: unicode - """ - return self._properties['credential_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def notification_protocol_version(self): - """ - :returns: The notification_protocol_version - :rtype: unicode - """ - return self._properties['notification_protocol_version'] - - @property - def endpoint(self): - """ - :returns: The endpoint - :rtype: unicode - """ - return self._properties['endpoint'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def binding_type(self): - """ - :returns: The binding_type - :rtype: unicode - """ - return self._properties['binding_type'] - - @property - def address(self): - """ - :returns: The address - :rtype: unicode - """ - return self._properties['address'] - - @property - def tags(self): - """ - :returns: The tags - :rtype: unicode - """ - return self._properties['tags'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a BindingInstance - - :returns: Fetched BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the BindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Notify.V1.BindingInstance {}>'.format(context) diff --git a/twilio/rest/notify/v1/service/notification.py b/twilio/rest/notify/v1/service/notification.py deleted file mode 100644 index aebfd21..0000000 --- a/twilio/rest/notify/v1/service/notification.py +++ /dev/null @@ -1,358 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NotificationList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the NotificationList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.notify.v1.service.notification.NotificationList - :rtype: twilio.rest.notify.v1.service.notification.NotificationList - """ - super(NotificationList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Notifications'.format(**self._solution) - - def create(self, body=values.unset, priority=values.unset, ttl=values.unset, - title=values.unset, sound=values.unset, action=values.unset, - data=values.unset, apn=values.unset, gcm=values.unset, - sms=values.unset, facebook_messenger=values.unset, fcm=values.unset, - segment=values.unset, alexa=values.unset, to_binding=values.unset, - identity=values.unset, tag=values.unset): - """ - Create a new NotificationInstance - - :param unicode body: The body - :param NotificationInstance.Priority priority: The priority - :param unicode ttl: The ttl - :param unicode title: The title - :param unicode sound: The sound - :param unicode action: The action - :param dict data: The data - :param dict apn: The apn - :param dict gcm: The gcm - :param dict sms: The sms - :param dict facebook_messenger: The facebook_messenger - :param dict fcm: The fcm - :param unicode segment: The segment - :param dict alexa: The alexa - :param unicode to_binding: The to_binding - :param unicode identity: The identity - :param unicode tag: The tag - - :returns: Newly created NotificationInstance - :rtype: twilio.rest.notify.v1.service.notification.NotificationInstance - """ - data = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'Tag': serialize.map(tag, lambda e: e), - 'Body': body, - 'Priority': priority, - 'Ttl': ttl, - 'Title': title, - 'Sound': sound, - 'Action': action, - 'Data': serialize.object(data), - 'Apn': serialize.object(apn), - 'Gcm': serialize.object(gcm), - 'Sms': serialize.object(sms), - 'FacebookMessenger': serialize.object(facebook_messenger), - 'Fcm': serialize.object(fcm), - 'Segment': serialize.map(segment, lambda e: e), - 'Alexa': serialize.object(alexa), - 'ToBinding': serialize.map(to_binding, lambda e: e), - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return NotificationInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.NotificationList>' - - -class NotificationPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the NotificationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.notify.v1.service.notification.NotificationPage - :rtype: twilio.rest.notify.v1.service.notification.NotificationPage - """ - super(NotificationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NotificationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.notify.v1.service.notification.NotificationInstance - :rtype: twilio.rest.notify.v1.service.notification.NotificationInstance - """ - return NotificationInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.NotificationPage>' - - -class NotificationInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Priority(object): - HIGH = "high" - LOW = "low" - - def __init__(self, version, payload, service_sid): - """ - Initialize the NotificationInstance - - :returns: twilio.rest.notify.v1.service.notification.NotificationInstance - :rtype: twilio.rest.notify.v1.service.notification.NotificationInstance - """ - super(NotificationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'identities': payload['identities'], - 'tags': payload['tags'], - 'segments': payload['segments'], - 'priority': payload['priority'], - 'ttl': deserialize.integer(payload['ttl']), - 'title': payload['title'], - 'body': payload['body'], - 'sound': payload['sound'], - 'action': payload['action'], - 'data': payload['data'], - 'apn': payload['apn'], - 'gcm': payload['gcm'], - 'fcm': payload['fcm'], - 'sms': payload['sms'], - 'facebook_messenger': payload['facebook_messenger'], - 'alexa': payload['alexa'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, } - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def identities(self): - """ - :returns: The identities - :rtype: unicode - """ - return self._properties['identities'] - - @property - def tags(self): - """ - :returns: The tags - :rtype: unicode - """ - return self._properties['tags'] - - @property - def segments(self): - """ - :returns: The segments - :rtype: unicode - """ - return self._properties['segments'] - - @property - def priority(self): - """ - :returns: The priority - :rtype: NotificationInstance.Priority - """ - return self._properties['priority'] - - @property - def ttl(self): - """ - :returns: The ttl - :rtype: unicode - """ - return self._properties['ttl'] - - @property - def title(self): - """ - :returns: The title - :rtype: unicode - """ - return self._properties['title'] - - @property - def body(self): - """ - :returns: The body - :rtype: unicode - """ - return self._properties['body'] - - @property - def sound(self): - """ - :returns: The sound - :rtype: unicode - """ - return self._properties['sound'] - - @property - def action(self): - """ - :returns: The action - :rtype: unicode - """ - return self._properties['action'] - - @property - def data(self): - """ - :returns: The data - :rtype: dict - """ - return self._properties['data'] - - @property - def apn(self): - """ - :returns: The apn - :rtype: dict - """ - return self._properties['apn'] - - @property - def gcm(self): - """ - :returns: The gcm - :rtype: dict - """ - return self._properties['gcm'] - - @property - def fcm(self): - """ - :returns: The fcm - :rtype: dict - """ - return self._properties['fcm'] - - @property - def sms(self): - """ - :returns: The sms - :rtype: dict - """ - return self._properties['sms'] - - @property - def facebook_messenger(self): - """ - :returns: The facebook_messenger - :rtype: dict - """ - return self._properties['facebook_messenger'] - - @property - def alexa(self): - """ - :returns: The alexa - :rtype: dict - """ - return self._properties['alexa'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.NotificationInstance>' diff --git a/twilio/rest/notify/v1/service/segment.py b/twilio/rest/notify/v1/service/segment.py deleted file mode 100644 index 270f563..0000000 --- a/twilio/rest/notify/v1/service/segment.py +++ /dev/null @@ -1,250 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SegmentList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the SegmentList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.notify.v1.service.segment.SegmentList - :rtype: twilio.rest.notify.v1.service.segment.SegmentList - """ - super(SegmentList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Segments'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SegmentInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.notify.v1.service.segment.SegmentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SegmentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.notify.v1.service.segment.SegmentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SegmentInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SegmentInstance - :rtype: twilio.rest.notify.v1.service.segment.SegmentPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SegmentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SegmentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SegmentInstance - :rtype: twilio.rest.notify.v1.service.segment.SegmentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SegmentPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.SegmentList>' - - -class SegmentPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SegmentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.notify.v1.service.segment.SegmentPage - :rtype: twilio.rest.notify.v1.service.segment.SegmentPage - """ - super(SegmentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SegmentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.notify.v1.service.segment.SegmentInstance - :rtype: twilio.rest.notify.v1.service.segment.SegmentInstance - """ - return SegmentInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.SegmentPage>' - - -class SegmentInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid): - """ - Initialize the SegmentInstance - - :returns: twilio.rest.notify.v1.service.segment.SegmentInstance - :rtype: twilio.rest.notify.v1.service.segment.SegmentInstance - """ - super(SegmentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'unique_name': payload['unique_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, } - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.SegmentInstance>' diff --git a/twilio/rest/notify/v1/service/user/__init__.py b/twilio/rest/notify/v1/service/user/__init__.py deleted file mode 100644 index ee79f66..0000000 --- a/twilio/rest/notify/v1/service/user/__init__.py +++ /dev/null @@ -1,493 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.notify.v1.service.user.segment_memberships import SegmentMembershipList -from twilio.rest.notify.v1.service.user.user_binding import UserBindingList - - -class UserList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the UserList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.notify.v1.service.user.UserList - :rtype: twilio.rest.notify.v1.service.user.UserList - """ - super(UserList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Users'.format(**self._solution) - - def create(self, identity, segment=values.unset): - """ - Create a new UserInstance - - :param unicode identity: The identity - :param unicode segment: The segment - - :returns: Newly created UserInstance - :rtype: twilio.rest.notify.v1.service.user.UserInstance - """ - data = values.of({'Identity': identity, 'Segment': serialize.map(segment, lambda e: e), }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, identity=values.unset, segment=values.unset, limit=None, - page_size=None): - """ - Streams UserInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode identity: The identity - :param unicode segment: The segment - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.notify.v1.service.user.UserInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, segment=segment, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, identity=values.unset, segment=values.unset, limit=None, - page_size=None): - """ - Lists UserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode identity: The identity - :param unicode segment: The segment - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.notify.v1.service.user.UserInstance] - """ - return list(self.stream(identity=identity, segment=segment, limit=limit, page_size=page_size, )) - - def page(self, identity=values.unset, segment=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserInstance records from the API. - Request is executed immediately - - :param unicode identity: The identity - :param unicode segment: The segment - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserInstance - :rtype: twilio.rest.notify.v1.service.user.UserPage - """ - params = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'Segment': segment, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return UserPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserInstance - :rtype: twilio.rest.notify.v1.service.user.UserPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserPage(self._version, response, self._solution) - - def get(self, identity): - """ - Constructs a UserContext - - :param identity: The identity - - :returns: twilio.rest.notify.v1.service.user.UserContext - :rtype: twilio.rest.notify.v1.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], identity=identity, ) - - def __call__(self, identity): - """ - Constructs a UserContext - - :param identity: The identity - - :returns: twilio.rest.notify.v1.service.user.UserContext - :rtype: twilio.rest.notify.v1.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], identity=identity, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.UserList>' - - -class UserPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the UserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.notify.v1.service.user.UserPage - :rtype: twilio.rest.notify.v1.service.user.UserPage - """ - super(UserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.notify.v1.service.user.UserInstance - :rtype: twilio.rest.notify.v1.service.user.UserInstance - """ - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.UserPage>' - - -class UserContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, identity): - """ - Initialize the UserContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param identity: The identity - - :returns: twilio.rest.notify.v1.service.user.UserContext - :rtype: twilio.rest.notify.v1.service.user.UserContext - """ - super(UserContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Users/{identity}'.format(**self._solution) - - # Dependents - self._bindings = None - self._segment_memberships = None - - def delete(self): - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a UserInstance - - :returns: Fetched UserInstance - :rtype: twilio.rest.notify.v1.service.user.UserInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - - @property - def bindings(self): - """ - Access the bindings - - :returns: twilio.rest.notify.v1.service.user.user_binding.UserBindingList - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingList - """ - if self._bindings is None: - self._bindings = UserBindingList( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - return self._bindings - - @property - def segment_memberships(self): - """ - Access the segment_memberships - - :returns: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipList - :rtype: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipList - """ - if self._segment_memberships is None: - self._segment_memberships = SegmentMembershipList( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - return self._segment_memberships - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Notify.V1.UserContext {}>'.format(context) - - -class UserInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, identity=None): - """ - Initialize the UserInstance - - :returns: twilio.rest.notify.v1.service.user.UserInstance - :rtype: twilio.rest.notify.v1.service.user.UserInstance - """ - super(UserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'identity': payload['identity'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'segments': payload['segments'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'identity': identity or self._properties['identity'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserContext for this UserInstance - :rtype: twilio.rest.notify.v1.service.user.UserContext - """ - if self._context is None: - self._context = UserContext( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def segments(self): - """ - :returns: The segments - :rtype: unicode - """ - return self._properties['segments'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def delete(self): - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a UserInstance - - :returns: Fetched UserInstance - :rtype: twilio.rest.notify.v1.service.user.UserInstance - """ - return self._proxy.fetch() - - @property - def bindings(self): - """ - Access the bindings - - :returns: twilio.rest.notify.v1.service.user.user_binding.UserBindingList - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingList - """ - return self._proxy.bindings - - @property - def segment_memberships(self): - """ - Access the segment_memberships - - :returns: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipList - :rtype: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipList - """ - return self._proxy.segment_memberships - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Notify.V1.UserInstance {}>'.format(context) diff --git a/twilio/rest/notify/v1/service/user/__pycache__/__init__.cpython-36.pyc b/twilio/rest/notify/v1/service/user/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 5aa551b..0000000 Binary files a/twilio/rest/notify/v1/service/user/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/notify/v1/service/user/__pycache__/segment_memberships.cpython-36.pyc b/twilio/rest/notify/v1/service/user/__pycache__/segment_memberships.cpython-36.pyc deleted file mode 100644 index 9a7da2b..0000000 Binary files a/twilio/rest/notify/v1/service/user/__pycache__/segment_memberships.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/notify/v1/service/user/__pycache__/user_binding.cpython-36.pyc b/twilio/rest/notify/v1/service/user/__pycache__/user_binding.cpython-36.pyc deleted file mode 100644 index 5f586be..0000000 Binary files a/twilio/rest/notify/v1/service/user/__pycache__/user_binding.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/notify/v1/service/user/segment_memberships.py b/twilio/rest/notify/v1/service/user/segment_memberships.py deleted file mode 100644 index c34dbf3..0000000 --- a/twilio/rest/notify/v1/service/user/segment_memberships.py +++ /dev/null @@ -1,329 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class SegmentMembershipList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, identity): - """ - Initialize the SegmentMembershipList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param identity: The identity - - :returns: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipList - :rtype: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipList - """ - super(SegmentMembershipList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Users/{identity}/SegmentMemberships'.format(**self._solution) - - def create(self, segment): - """ - Create a new SegmentMembershipInstance - - :param unicode segment: The segment - - :returns: Newly created SegmentMembershipInstance - :rtype: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipInstance - """ - data = values.of({'Segment': segment, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return SegmentMembershipInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - - def get(self, segment): - """ - Constructs a SegmentMembershipContext - - :param segment: The segment - - :returns: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipContext - :rtype: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipContext - """ - return SegmentMembershipContext( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - segment=segment, - ) - - def __call__(self, segment): - """ - Constructs a SegmentMembershipContext - - :param segment: The segment - - :returns: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipContext - :rtype: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipContext - """ - return SegmentMembershipContext( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - segment=segment, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.SegmentMembershipList>' - - -class SegmentMembershipPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SegmentMembershipPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param identity: The identity - - :returns: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipPage - :rtype: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipPage - """ - super(SegmentMembershipPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SegmentMembershipInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipInstance - :rtype: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipInstance - """ - return SegmentMembershipInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.SegmentMembershipPage>' - - -class SegmentMembershipContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, identity, segment): - """ - Initialize the SegmentMembershipContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param identity: The identity - :param segment: The segment - - :returns: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipContext - :rtype: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipContext - """ - super(SegmentMembershipContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'identity': identity, 'segment': segment, } - self._uri = '/Services/{service_sid}/Users/{identity}/SegmentMemberships/{segment}'.format(**self._solution) - - def delete(self): - """ - Deletes the SegmentMembershipInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a SegmentMembershipInstance - - :returns: Fetched SegmentMembershipInstance - :rtype: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SegmentMembershipInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - segment=self._solution['segment'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Notify.V1.SegmentMembershipContext {}>'.format(context) - - -class SegmentMembershipInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, identity, segment=None): - """ - Initialize the SegmentMembershipInstance - - :returns: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipInstance - :rtype: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipInstance - """ - super(SegmentMembershipInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'identity': payload['identity'], - 'segment': payload['segment'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'identity': identity, - 'segment': segment or self._properties['segment'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SegmentMembershipContext for this SegmentMembershipInstance - :rtype: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipContext - """ - if self._context is None: - self._context = SegmentMembershipContext( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - segment=self._solution['segment'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def segment(self): - """ - :returns: The segment - :rtype: unicode - """ - return self._properties['segment'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def delete(self): - """ - Deletes the SegmentMembershipInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a SegmentMembershipInstance - - :returns: Fetched SegmentMembershipInstance - :rtype: twilio.rest.notify.v1.service.user.segment_memberships.SegmentMembershipInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Notify.V1.SegmentMembershipInstance {}>'.format(context) diff --git a/twilio/rest/notify/v1/service/user/user_binding.py b/twilio/rest/notify/v1/service/user/user_binding.py deleted file mode 100644 index 8112af6..0000000 --- a/twilio/rest/notify/v1/service/user/user_binding.py +++ /dev/null @@ -1,540 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class UserBindingList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, identity): - """ - Initialize the UserBindingList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param identity: The identity - - :returns: twilio.rest.notify.v1.service.user.user_binding.UserBindingList - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingList - """ - super(UserBindingList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Users/{identity}/Bindings'.format(**self._solution) - - def create(self, binding_type, address, tag=values.unset, - notification_protocol_version=values.unset, - credential_sid=values.unset, endpoint=values.unset): - """ - Create a new UserBindingInstance - - :param UserBindingInstance.BindingType binding_type: The binding_type - :param unicode address: The address - :param unicode tag: The tag - :param unicode notification_protocol_version: The notification_protocol_version - :param unicode credential_sid: The credential_sid - :param unicode endpoint: The endpoint - - :returns: Newly created UserBindingInstance - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingInstance - """ - data = values.of({ - 'BindingType': binding_type, - 'Address': address, - 'Tag': serialize.map(tag, lambda e: e), - 'NotificationProtocolVersion': notification_protocol_version, - 'CredentialSid': credential_sid, - 'Endpoint': endpoint, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return UserBindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - - def stream(self, start_date=values.unset, end_date=values.unset, - tag=values.unset, limit=None, page_size=None): - """ - Streams UserBindingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param date start_date: The start_date - :param date end_date: The end_date - :param unicode tag: The tag - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.notify.v1.service.user.user_binding.UserBindingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(start_date=start_date, end_date=end_date, tag=tag, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, start_date=values.unset, end_date=values.unset, tag=values.unset, - limit=None, page_size=None): - """ - Lists UserBindingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param date start_date: The start_date - :param date end_date: The end_date - :param unicode tag: The tag - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.notify.v1.service.user.user_binding.UserBindingInstance] - """ - return list(self.stream( - start_date=start_date, - end_date=end_date, - tag=tag, - limit=limit, - page_size=page_size, - )) - - def page(self, start_date=values.unset, end_date=values.unset, tag=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserBindingInstance records from the API. - Request is executed immediately - - :param date start_date: The start_date - :param date end_date: The end_date - :param unicode tag: The tag - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserBindingInstance - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingPage - """ - params = values.of({ - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'Tag': serialize.map(tag, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return UserBindingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserBindingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserBindingInstance - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserBindingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserBindingContext - - :param sid: The sid - - :returns: twilio.rest.notify.v1.service.user.user_binding.UserBindingContext - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingContext - """ - return UserBindingContext( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a UserBindingContext - - :param sid: The sid - - :returns: twilio.rest.notify.v1.service.user.user_binding.UserBindingContext - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingContext - """ - return UserBindingContext( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.UserBindingList>' - - -class UserBindingPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the UserBindingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param identity: The identity - - :returns: twilio.rest.notify.v1.service.user.user_binding.UserBindingPage - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingPage - """ - super(UserBindingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserBindingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.notify.v1.service.user.user_binding.UserBindingInstance - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingInstance - """ - return UserBindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Notify.V1.UserBindingPage>' - - -class UserBindingContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, identity, sid): - """ - Initialize the UserBindingContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param identity: The identity - :param sid: The sid - - :returns: twilio.rest.notify.v1.service.user.user_binding.UserBindingContext - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingContext - """ - super(UserBindingContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'identity': identity, 'sid': sid, } - self._uri = '/Services/{service_sid}/Users/{identity}/Bindings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a UserBindingInstance - - :returns: Fetched UserBindingInstance - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return UserBindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the UserBindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Notify.V1.UserBindingContext {}>'.format(context) - - -class UserBindingInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class BindingType(object): - APN = "apn" - GCM = "gcm" - SMS = "sms" - FCM = "fcm" - FACEBOOK_MESSENGER = "facebook-messenger" - ALEXA = "alexa" - - def __init__(self, version, payload, service_sid, identity, sid=None): - """ - Initialize the UserBindingInstance - - :returns: twilio.rest.notify.v1.service.user.user_binding.UserBindingInstance - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingInstance - """ - super(UserBindingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'credential_sid': payload['credential_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'notification_protocol_version': payload['notification_protocol_version'], - 'endpoint': payload['endpoint'], - 'identity': payload['identity'], - 'binding_type': payload['binding_type'], - 'address': payload['address'], - 'tags': payload['tags'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'identity': identity, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserBindingContext for this UserBindingInstance - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingContext - """ - if self._context is None: - self._context = UserBindingContext( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def credential_sid(self): - """ - :returns: The credential_sid - :rtype: unicode - """ - return self._properties['credential_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def notification_protocol_version(self): - """ - :returns: The notification_protocol_version - :rtype: unicode - """ - return self._properties['notification_protocol_version'] - - @property - def endpoint(self): - """ - :returns: The endpoint - :rtype: unicode - """ - return self._properties['endpoint'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def binding_type(self): - """ - :returns: The binding_type - :rtype: unicode - """ - return self._properties['binding_type'] - - @property - def address(self): - """ - :returns: The address - :rtype: unicode - """ - return self._properties['address'] - - @property - def tags(self): - """ - :returns: The tags - :rtype: unicode - """ - return self._properties['tags'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a UserBindingInstance - - :returns: Fetched UserBindingInstance - :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the UserBindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Notify.V1.UserBindingInstance {}>'.format(context) diff --git a/twilio/rest/preview/__init__.py b/twilio/rest/preview/__init__.py deleted file mode 100644 index c0f6291..0000000 --- a/twilio/rest/preview/__init__.py +++ /dev/null @@ -1,238 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.preview.acc_security import AccSecurity -from twilio.rest.preview.bulk_exports import BulkExports -from twilio.rest.preview.deployed_devices import DeployedDevices -from twilio.rest.preview.hosted_numbers import HostedNumbers -from twilio.rest.preview.marketplace import Marketplace -from twilio.rest.preview.proxy import Proxy -from twilio.rest.preview.studio import Studio -from twilio.rest.preview.sync import Sync -from twilio.rest.preview.understand import Understand -from twilio.rest.preview.wireless import Wireless - - -class Preview(Domain): - - def __init__(self, twilio): - """ - Initialize the Preview Domain - - :returns: Domain for Preview - :rtype: twilio.rest.preview.Preview - """ - super(Preview, self).__init__(twilio) - - self.base_url = 'https://preview.twilio.com' - - # Versions - self._bulk_exports = None - self._deployed_devices = None - self._hosted_numbers = None - self._marketplace = None - self._proxy = None - self._studio = None - self._acc_security = None - self._sync = None - self._understand = None - self._wireless = None - - @property - def bulk_exports(self): - """ - :returns: Version bulk_exports of preview - :rtype: twilio.rest.preview.bulk_exports.BulkExports - """ - if self._bulk_exports is None: - self._bulk_exports = BulkExports(self) - return self._bulk_exports - - @property - def deployed_devices(self): - """ - :returns: Version deployed_devices of preview - :rtype: twilio.rest.preview.deployed_devices.DeployedDevices - """ - if self._deployed_devices is None: - self._deployed_devices = DeployedDevices(self) - return self._deployed_devices - - @property - def hosted_numbers(self): - """ - :returns: Version hosted_numbers of preview - :rtype: twilio.rest.preview.hosted_numbers.HostedNumbers - """ - if self._hosted_numbers is None: - self._hosted_numbers = HostedNumbers(self) - return self._hosted_numbers - - @property - def marketplace(self): - """ - :returns: Version marketplace of preview - :rtype: twilio.rest.preview.marketplace.Marketplace - """ - if self._marketplace is None: - self._marketplace = Marketplace(self) - return self._marketplace - - @property - def proxy(self): - """ - :returns: Version proxy of preview - :rtype: twilio.rest.preview.proxy.Proxy - """ - if self._proxy is None: - self._proxy = Proxy(self) - return self._proxy - - @property - def studio(self): - """ - :returns: Version studio of preview - :rtype: twilio.rest.preview.studio.Studio - """ - if self._studio is None: - self._studio = Studio(self) - return self._studio - - @property - def acc_security(self): - """ - :returns: Version acc_security of preview - :rtype: twilio.rest.preview.acc_security.AccSecurity - """ - if self._acc_security is None: - self._acc_security = AccSecurity(self) - return self._acc_security - - @property - def sync(self): - """ - :returns: Version sync of preview - :rtype: twilio.rest.preview.sync.Sync - """ - if self._sync is None: - self._sync = Sync(self) - return self._sync - - @property - def understand(self): - """ - :returns: Version understand of preview - :rtype: twilio.rest.preview.understand.Understand - """ - if self._understand is None: - self._understand = Understand(self) - return self._understand - - @property - def wireless(self): - """ - :returns: Version wireless of preview - :rtype: twilio.rest.preview.wireless.Wireless - """ - if self._wireless is None: - self._wireless = Wireless(self) - return self._wireless - - @property - def exports(self): - """ - :rtype: twilio.rest.preview.bulk_exports.export.ExportList - """ - return self.bulk_exports.exports - - @property - def export_configuration(self): - """ - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationList - """ - return self.bulk_exports.export_configuration - - @property - def fleets(self): - """ - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetList - """ - return self.deployed_devices.fleets - - @property - def authorization_documents(self): - """ - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentList - """ - return self.hosted_numbers.authorization_documents - - @property - def hosted_number_orders(self): - """ - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderList - """ - return self.hosted_numbers.hosted_number_orders - - @property - def available_add_ons(self): - """ - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnList - """ - return self.marketplace.available_add_ons - - @property - def installed_add_ons(self): - """ - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnList - """ - return self.marketplace.installed_add_ons - - @property - def services(self): - """ - :rtype: twilio.rest.preview.understand.service.ServiceList - """ - return self.understand.services - - @property - def flows(self): - """ - :rtype: twilio.rest.preview.studio.flow.FlowList - """ - return self.studio.flows - - @property - def commands(self): - """ - :rtype: twilio.rest.preview.wireless.command.CommandList - """ - return self.wireless.commands - - @property - def rate_plans(self): - """ - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanList - """ - return self.wireless.rate_plans - - @property - def sims(self): - """ - :rtype: twilio.rest.preview.wireless.sim.SimList - """ - return self.wireless.sims - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview>' diff --git a/twilio/rest/preview/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 54042ee..0000000 Binary files a/twilio/rest/preview/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/acc_security/__init__.py b/twilio/rest/preview/acc_security/__init__.py deleted file mode 100644 index e63b8d9..0000000 --- a/twilio/rest/preview/acc_security/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.preview.acc_security.service import ServiceList - - -class AccSecurity(Version): - - def __init__(self, domain): - """ - Initialize the AccSecurity version of Preview - - :returns: AccSecurity version of Preview - :rtype: twilio.rest.preview.acc_security.AccSecurity.AccSecurity - """ - super(AccSecurity, self).__init__(domain) - self.version = 'Verification' - self._services = None - - @property - def services(self): - """ - :rtype: twilio.rest.preview.acc_security.service.ServiceList - """ - if self._services is None: - self._services = ServiceList(self) - return self._services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.AccSecurity>' diff --git a/twilio/rest/preview/acc_security/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/acc_security/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index c373c4b..0000000 Binary files a/twilio/rest/preview/acc_security/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/acc_security/service/__init__.py b/twilio/rest/preview/acc_security/service/__init__.py deleted file mode 100644 index eebdb94..0000000 --- a/twilio/rest/preview/acc_security/service/__init__.py +++ /dev/null @@ -1,466 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.preview.acc_security.service.verification import VerificationList -from twilio.rest.preview.acc_security.service.verification_check import VerificationCheckList - - -class ServiceList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.acc_security.service.ServiceList - :rtype: twilio.rest.preview.acc_security.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, name, code_length=values.unset): - """ - Create a new ServiceInstance - - :param unicode name: Friendly name of the service - :param unicode code_length: Length of verification code. Valid values are 4-10 - - :returns: Newly created ServiceInstance - :rtype: twilio.rest.preview.acc_security.service.ServiceInstance - """ - data = values.of({'Name': name, 'CodeLength': code_length, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.acc_security.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.acc_security.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.preview.acc_security.service.ServicePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.preview.acc_security.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: Verification Service Instance SID. - - :returns: twilio.rest.preview.acc_security.service.ServiceContext - :rtype: twilio.rest.preview.acc_security.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: Verification Service Instance SID. - - :returns: twilio.rest.preview.acc_security.service.ServiceContext - :rtype: twilio.rest.preview.acc_security.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.AccSecurity.ServiceList>' - - -class ServicePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.acc_security.service.ServicePage - :rtype: twilio.rest.preview.acc_security.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.acc_security.service.ServiceInstance - :rtype: twilio.rest.preview.acc_security.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.AccSecurity.ServicePage>' - - -class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: Verification Service Instance SID. - - :returns: twilio.rest.preview.acc_security.service.ServiceContext - :rtype: twilio.rest.preview.acc_security.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._verifications = None - self._verification_checks = None - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.preview.acc_security.service.ServiceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, name=values.unset, code_length=values.unset): - """ - Update the ServiceInstance - - :param unicode name: Friendly name of the service - :param unicode code_length: Length of verification code. Valid values are 4-10 - - :returns: Updated ServiceInstance - :rtype: twilio.rest.preview.acc_security.service.ServiceInstance - """ - data = values.of({'Name': name, 'CodeLength': code_length, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def verifications(self): - """ - Access the verifications - - :returns: twilio.rest.preview.acc_security.service.verification.VerificationList - :rtype: twilio.rest.preview.acc_security.service.verification.VerificationList - """ - if self._verifications is None: - self._verifications = VerificationList(self._version, service_sid=self._solution['sid'], ) - return self._verifications - - @property - def verification_checks(self): - """ - Access the verification_checks - - :returns: twilio.rest.preview.acc_security.service.verification_check.VerificationCheckList - :rtype: twilio.rest.preview.acc_security.service.verification_check.VerificationCheckList - """ - if self._verification_checks is None: - self._verification_checks = VerificationCheckList(self._version, service_sid=self._solution['sid'], ) - return self._verification_checks - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.AccSecurity.ServiceContext {}>'.format(context) - - -class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.preview.acc_security.service.ServiceInstance - :rtype: twilio.rest.preview.acc_security.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'name': payload['name'], - 'code_length': deserialize.integer(payload['code_length']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.preview.acc_security.service.ServiceContext - """ - if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Service. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def name(self): - """ - :returns: Friendly name of the service - :rtype: unicode - """ - return self._properties['name'] - - @property - def code_length(self): - """ - :returns: Length of verification code. Valid values are 4-10 - :rtype: unicode - """ - return self._properties['code_length'] - - @property - def date_created(self): - """ - :returns: The date this Service was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Service was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.preview.acc_security.service.ServiceInstance - """ - return self._proxy.fetch() - - def update(self, name=values.unset, code_length=values.unset): - """ - Update the ServiceInstance - - :param unicode name: Friendly name of the service - :param unicode code_length: Length of verification code. Valid values are 4-10 - - :returns: Updated ServiceInstance - :rtype: twilio.rest.preview.acc_security.service.ServiceInstance - """ - return self._proxy.update(name=name, code_length=code_length, ) - - @property - def verifications(self): - """ - Access the verifications - - :returns: twilio.rest.preview.acc_security.service.verification.VerificationList - :rtype: twilio.rest.preview.acc_security.service.verification.VerificationList - """ - return self._proxy.verifications - - @property - def verification_checks(self): - """ - Access the verification_checks - - :returns: twilio.rest.preview.acc_security.service.verification_check.VerificationCheckList - :rtype: twilio.rest.preview.acc_security.service.verification_check.VerificationCheckList - """ - return self._proxy.verification_checks - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.AccSecurity.ServiceInstance {}>'.format(context) diff --git a/twilio/rest/preview/acc_security/service/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/acc_security/service/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index cc4af05..0000000 Binary files a/twilio/rest/preview/acc_security/service/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/acc_security/service/__pycache__/verification.cpython-36.pyc b/twilio/rest/preview/acc_security/service/__pycache__/verification.cpython-36.pyc deleted file mode 100644 index 64e6b22..0000000 Binary files a/twilio/rest/preview/acc_security/service/__pycache__/verification.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/acc_security/service/__pycache__/verification_check.cpython-36.pyc b/twilio/rest/preview/acc_security/service/__pycache__/verification_check.cpython-36.pyc deleted file mode 100644 index c491664..0000000 Binary files a/twilio/rest/preview/acc_security/service/__pycache__/verification_check.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/acc_security/service/verification.py b/twilio/rest/preview/acc_security/service/verification.py deleted file mode 100644 index eefc462..0000000 --- a/twilio/rest/preview/acc_security/service/verification.py +++ /dev/null @@ -1,224 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class VerificationList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the VerificationList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - - :returns: twilio.rest.preview.acc_security.service.verification.VerificationList - :rtype: twilio.rest.preview.acc_security.service.verification.VerificationList - """ - super(VerificationList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Verifications'.format(**self._solution) - - def create(self, to, channel, custom_message=values.unset): - """ - Create a new VerificationInstance - - :param unicode to: To phonenumber - :param unicode channel: sms or call - :param unicode custom_message: A custom message for this verification - - :returns: Newly created VerificationInstance - :rtype: twilio.rest.preview.acc_security.service.verification.VerificationInstance - """ - data = values.of({'To': to, 'Channel': channel, 'CustomMessage': custom_message, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return VerificationInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.AccSecurity.VerificationList>' - - -class VerificationPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the VerificationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - - :returns: twilio.rest.preview.acc_security.service.verification.VerificationPage - :rtype: twilio.rest.preview.acc_security.service.verification.VerificationPage - """ - super(VerificationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of VerificationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.acc_security.service.verification.VerificationInstance - :rtype: twilio.rest.preview.acc_security.service.verification.VerificationInstance - """ - return VerificationInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.AccSecurity.VerificationPage>' - - -class VerificationInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Channel(object): - SMS = "sms" - CALL = "call" - - def __init__(self, version, payload, service_sid): - """ - Initialize the VerificationInstance - - :returns: twilio.rest.preview.acc_security.service.verification.VerificationInstance - :rtype: twilio.rest.preview.acc_security.service.verification.VerificationInstance - """ - super(VerificationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'service_sid': payload['service_sid'], - 'account_sid': payload['account_sid'], - 'to': payload['to'], - 'channel': payload['channel'], - 'status': payload['status'], - 'valid': payload['valid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, } - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Verification. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def to(self): - """ - :returns: To phonenumber - :rtype: unicode - """ - return self._properties['to'] - - @property - def channel(self): - """ - :returns: sms or call - :rtype: VerificationInstance.Channel - """ - return self._properties['channel'] - - @property - def status(self): - """ - :returns: pending, approved, denied or expired - :rtype: unicode - """ - return self._properties['status'] - - @property - def valid(self): - """ - :returns: successful verification - :rtype: bool - """ - return self._properties['valid'] - - @property - def date_created(self): - """ - :returns: The date this Verification was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Verification was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.AccSecurity.VerificationInstance>' diff --git a/twilio/rest/preview/acc_security/service/verification_check.py b/twilio/rest/preview/acc_security/service/verification_check.py deleted file mode 100644 index d739987..0000000 --- a/twilio/rest/preview/acc_security/service/verification_check.py +++ /dev/null @@ -1,223 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class VerificationCheckList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the VerificationCheckList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - - :returns: twilio.rest.preview.acc_security.service.verification_check.VerificationCheckList - :rtype: twilio.rest.preview.acc_security.service.verification_check.VerificationCheckList - """ - super(VerificationCheckList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/VerificationCheck'.format(**self._solution) - - def create(self, code, to=values.unset): - """ - Create a new VerificationCheckInstance - - :param unicode code: The verification string - :param unicode to: To phonenumber - - :returns: Newly created VerificationCheckInstance - :rtype: twilio.rest.preview.acc_security.service.verification_check.VerificationCheckInstance - """ - data = values.of({'Code': code, 'To': to, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return VerificationCheckInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.AccSecurity.VerificationCheckList>' - - -class VerificationCheckPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the VerificationCheckPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - - :returns: twilio.rest.preview.acc_security.service.verification_check.VerificationCheckPage - :rtype: twilio.rest.preview.acc_security.service.verification_check.VerificationCheckPage - """ - super(VerificationCheckPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of VerificationCheckInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.acc_security.service.verification_check.VerificationCheckInstance - :rtype: twilio.rest.preview.acc_security.service.verification_check.VerificationCheckInstance - """ - return VerificationCheckInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.AccSecurity.VerificationCheckPage>' - - -class VerificationCheckInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Channel(object): - SMS = "sms" - CALL = "call" - - def __init__(self, version, payload, service_sid): - """ - Initialize the VerificationCheckInstance - - :returns: twilio.rest.preview.acc_security.service.verification_check.VerificationCheckInstance - :rtype: twilio.rest.preview.acc_security.service.verification_check.VerificationCheckInstance - """ - super(VerificationCheckInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'service_sid': payload['service_sid'], - 'account_sid': payload['account_sid'], - 'to': payload['to'], - 'channel': payload['channel'], - 'status': payload['status'], - 'valid': payload['valid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, } - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Verification Check. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def to(self): - """ - :returns: To phonenumber - :rtype: unicode - """ - return self._properties['to'] - - @property - def channel(self): - """ - :returns: sms or call - :rtype: VerificationCheckInstance.Channel - """ - return self._properties['channel'] - - @property - def status(self): - """ - :returns: pending, approved, denied or expired - :rtype: unicode - """ - return self._properties['status'] - - @property - def valid(self): - """ - :returns: successful verification - :rtype: bool - """ - return self._properties['valid'] - - @property - def date_created(self): - """ - :returns: The date this Verification Check was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Verification Check was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.AccSecurity.VerificationCheckInstance>' diff --git a/twilio/rest/preview/bulk_exports/__init__.py b/twilio/rest/preview/bulk_exports/__init__.py deleted file mode 100644 index cab14d8..0000000 --- a/twilio/rest/preview/bulk_exports/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.preview.bulk_exports.export import ExportList -from twilio.rest.preview.bulk_exports.export_configuration import ExportConfigurationList - - -class BulkExports(Version): - - def __init__(self, domain): - """ - Initialize the BulkExports version of Preview - - :returns: BulkExports version of Preview - :rtype: twilio.rest.preview.bulk_exports.BulkExports.BulkExports - """ - super(BulkExports, self).__init__(domain) - self.version = 'BulkExports' - self._exports = None - self._export_configuration = None - - @property - def exports(self): - """ - :rtype: twilio.rest.preview.bulk_exports.export.ExportList - """ - if self._exports is None: - self._exports = ExportList(self) - return self._exports - - @property - def export_configuration(self): - """ - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationList - """ - if self._export_configuration is None: - self._export_configuration = ExportConfigurationList(self) - return self._export_configuration - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.BulkExports>' diff --git a/twilio/rest/preview/bulk_exports/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/bulk_exports/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 28dd512..0000000 Binary files a/twilio/rest/preview/bulk_exports/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/bulk_exports/__pycache__/export_configuration.cpython-36.pyc b/twilio/rest/preview/bulk_exports/__pycache__/export_configuration.cpython-36.pyc deleted file mode 100644 index cb5d2e5..0000000 Binary files a/twilio/rest/preview/bulk_exports/__pycache__/export_configuration.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/bulk_exports/export/__init__.py b/twilio/rest/preview/bulk_exports/export/__init__.py deleted file mode 100644 index b43caf4..0000000 --- a/twilio/rest/preview/bulk_exports/export/__init__.py +++ /dev/null @@ -1,262 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page -from twilio.rest.preview.bulk_exports.export.day import DayList - - -class ExportList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the ExportList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.bulk_exports.export.ExportList - :rtype: twilio.rest.preview.bulk_exports.export.ExportList - """ - super(ExportList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, resource_type): - """ - Constructs a ExportContext - - :param resource_type: The resource_type - - :returns: twilio.rest.preview.bulk_exports.export.ExportContext - :rtype: twilio.rest.preview.bulk_exports.export.ExportContext - """ - return ExportContext(self._version, resource_type=resource_type, ) - - def __call__(self, resource_type): - """ - Constructs a ExportContext - - :param resource_type: The resource_type - - :returns: twilio.rest.preview.bulk_exports.export.ExportContext - :rtype: twilio.rest.preview.bulk_exports.export.ExportContext - """ - return ExportContext(self._version, resource_type=resource_type, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.BulkExports.ExportList>' - - -class ExportPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ExportPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.bulk_exports.export.ExportPage - :rtype: twilio.rest.preview.bulk_exports.export.ExportPage - """ - super(ExportPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ExportInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.bulk_exports.export.ExportInstance - :rtype: twilio.rest.preview.bulk_exports.export.ExportInstance - """ - return ExportInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.BulkExports.ExportPage>' - - -class ExportContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, resource_type): - """ - Initialize the ExportContext - - :param Version version: Version that contains the resource - :param resource_type: The resource_type - - :returns: twilio.rest.preview.bulk_exports.export.ExportContext - :rtype: twilio.rest.preview.bulk_exports.export.ExportContext - """ - super(ExportContext, self).__init__(version) - - # Path Solution - self._solution = {'resource_type': resource_type, } - self._uri = '/Exports/{resource_type}'.format(**self._solution) - - # Dependents - self._days = None - - def fetch(self): - """ - Fetch a ExportInstance - - :returns: Fetched ExportInstance - :rtype: twilio.rest.preview.bulk_exports.export.ExportInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ExportInstance(self._version, payload, resource_type=self._solution['resource_type'], ) - - @property - def days(self): - """ - Access the days - - :returns: twilio.rest.preview.bulk_exports.export.day.DayList - :rtype: twilio.rest.preview.bulk_exports.export.day.DayList - """ - if self._days is None: - self._days = DayList(self._version, resource_type=self._solution['resource_type'], ) - return self._days - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.BulkExports.ExportContext {}>'.format(context) - - -class ExportInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, resource_type=None): - """ - Initialize the ExportInstance - - :returns: twilio.rest.preview.bulk_exports.export.ExportInstance - :rtype: twilio.rest.preview.bulk_exports.export.ExportInstance - """ - super(ExportInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'resource_type': payload['resource_type'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'resource_type': resource_type or self._properties['resource_type'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ExportContext for this ExportInstance - :rtype: twilio.rest.preview.bulk_exports.export.ExportContext - """ - if self._context is None: - self._context = ExportContext(self._version, resource_type=self._solution['resource_type'], ) - return self._context - - @property - def resource_type(self): - """ - :returns: The resource_type - :rtype: unicode - """ - return self._properties['resource_type'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ExportInstance - - :returns: Fetched ExportInstance - :rtype: twilio.rest.preview.bulk_exports.export.ExportInstance - """ - return self._proxy.fetch() - - @property - def days(self): - """ - Access the days - - :returns: twilio.rest.preview.bulk_exports.export.day.DayList - :rtype: twilio.rest.preview.bulk_exports.export.day.DayList - """ - return self._proxy.days - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.BulkExports.ExportInstance {}>'.format(context) diff --git a/twilio/rest/preview/bulk_exports/export/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/bulk_exports/export/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 19b86df..0000000 Binary files a/twilio/rest/preview/bulk_exports/export/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/bulk_exports/export/__pycache__/day.cpython-36.pyc b/twilio/rest/preview/bulk_exports/export/__pycache__/day.cpython-36.pyc deleted file mode 100644 index 429de6f..0000000 Binary files a/twilio/rest/preview/bulk_exports/export/__pycache__/day.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/bulk_exports/export/day.py b/twilio/rest/preview/bulk_exports/export/day.py deleted file mode 100644 index 62896fb..0000000 --- a/twilio/rest/preview/bulk_exports/export/day.py +++ /dev/null @@ -1,235 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DayList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, resource_type): - """ - Initialize the DayList - - :param Version version: Version that contains the resource - :param resource_type: The resource_type - - :returns: twilio.rest.preview.bulk_exports.export.day.DayList - :rtype: twilio.rest.preview.bulk_exports.export.day.DayList - """ - super(DayList, self).__init__(version) - - # Path Solution - self._solution = {'resource_type': resource_type, } - self._uri = '/Exports/{resource_type}/Days'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DayInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.bulk_exports.export.day.DayInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DayInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.bulk_exports.export.day.DayInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DayInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DayInstance - :rtype: twilio.rest.preview.bulk_exports.export.day.DayPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return DayPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DayInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DayInstance - :rtype: twilio.rest.preview.bulk_exports.export.day.DayPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DayPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.BulkExports.DayList>' - - -class DayPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DayPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param resource_type: The resource_type - - :returns: twilio.rest.preview.bulk_exports.export.day.DayPage - :rtype: twilio.rest.preview.bulk_exports.export.day.DayPage - """ - super(DayPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DayInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.bulk_exports.export.day.DayInstance - :rtype: twilio.rest.preview.bulk_exports.export.day.DayInstance - """ - return DayInstance(self._version, payload, resource_type=self._solution['resource_type'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.BulkExports.DayPage>' - - -class DayInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, resource_type): - """ - Initialize the DayInstance - - :returns: twilio.rest.preview.bulk_exports.export.day.DayInstance - :rtype: twilio.rest.preview.bulk_exports.export.day.DayInstance - """ - super(DayInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'redirect_to': payload.get('redirect_to'), - 'day': payload.get('day'), - 'size': deserialize.integer(payload.get('size')), - 'resource_type': payload.get('resource_type'), - } - - # Context - self._context = None - self._solution = {'resource_type': resource_type, } - - @property - def redirect_to(self): - """ - :returns: The redirect_to - :rtype: unicode - """ - return self._properties['redirect_to'] - - @property - def day(self): - """ - :returns: The day - :rtype: unicode - """ - return self._properties['day'] - - @property - def size(self): - """ - :returns: The size - :rtype: unicode - """ - return self._properties['size'] - - @property - def resource_type(self): - """ - :returns: The resource_type - :rtype: unicode - """ - return self._properties['resource_type'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.BulkExports.DayInstance>' diff --git a/twilio/rest/preview/bulk_exports/export_configuration.py b/twilio/rest/preview/bulk_exports/export_configuration.py deleted file mode 100644 index e211d31..0000000 --- a/twilio/rest/preview/bulk_exports/export_configuration.py +++ /dev/null @@ -1,301 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class ExportConfigurationList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the ExportConfigurationList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationList - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationList - """ - super(ExportConfigurationList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, resource_type): - """ - Constructs a ExportConfigurationContext - - :param resource_type: The resource_type - - :returns: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationContext - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationContext - """ - return ExportConfigurationContext(self._version, resource_type=resource_type, ) - - def __call__(self, resource_type): - """ - Constructs a ExportConfigurationContext - - :param resource_type: The resource_type - - :returns: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationContext - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationContext - """ - return ExportConfigurationContext(self._version, resource_type=resource_type, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.BulkExports.ExportConfigurationList>' - - -class ExportConfigurationPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ExportConfigurationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationPage - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationPage - """ - super(ExportConfigurationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ExportConfigurationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationInstance - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationInstance - """ - return ExportConfigurationInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.BulkExports.ExportConfigurationPage>' - - -class ExportConfigurationContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, resource_type): - """ - Initialize the ExportConfigurationContext - - :param Version version: Version that contains the resource - :param resource_type: The resource_type - - :returns: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationContext - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationContext - """ - super(ExportConfigurationContext, self).__init__(version) - - # Path Solution - self._solution = {'resource_type': resource_type, } - self._uri = '/Exports/{resource_type}/Configuration'.format(**self._solution) - - def fetch(self): - """ - Fetch a ExportConfigurationInstance - - :returns: Fetched ExportConfigurationInstance - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ExportConfigurationInstance( - self._version, - payload, - resource_type=self._solution['resource_type'], - ) - - def update(self, enabled=values.unset, webhook_url=values.unset, - webhook_method=values.unset): - """ - Update the ExportConfigurationInstance - - :param bool enabled: The enabled - :param unicode webhook_url: The webhook_url - :param unicode webhook_method: The webhook_method - - :returns: Updated ExportConfigurationInstance - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationInstance - """ - data = values.of({'Enabled': enabled, 'WebhookUrl': webhook_url, 'WebhookMethod': webhook_method, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ExportConfigurationInstance( - self._version, - payload, - resource_type=self._solution['resource_type'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.BulkExports.ExportConfigurationContext {}>'.format(context) - - -class ExportConfigurationInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, resource_type=None): - """ - Initialize the ExportConfigurationInstance - - :returns: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationInstance - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationInstance - """ - super(ExportConfigurationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'enabled': payload['enabled'], - 'webhook_url': payload['webhook_url'], - 'webhook_method': payload['webhook_method'], - 'resource_type': payload['resource_type'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'resource_type': resource_type or self._properties['resource_type'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ExportConfigurationContext for this ExportConfigurationInstance - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationContext - """ - if self._context is None: - self._context = ExportConfigurationContext( - self._version, - resource_type=self._solution['resource_type'], - ) - return self._context - - @property - def enabled(self): - """ - :returns: The enabled - :rtype: bool - """ - return self._properties['enabled'] - - @property - def webhook_url(self): - """ - :returns: The webhook_url - :rtype: unicode - """ - return self._properties['webhook_url'] - - @property - def webhook_method(self): - """ - :returns: The webhook_method - :rtype: unicode - """ - return self._properties['webhook_method'] - - @property - def resource_type(self): - """ - :returns: The resource_type - :rtype: unicode - """ - return self._properties['resource_type'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a ExportConfigurationInstance - - :returns: Fetched ExportConfigurationInstance - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationInstance - """ - return self._proxy.fetch() - - def update(self, enabled=values.unset, webhook_url=values.unset, - webhook_method=values.unset): - """ - Update the ExportConfigurationInstance - - :param bool enabled: The enabled - :param unicode webhook_url: The webhook_url - :param unicode webhook_method: The webhook_method - - :returns: Updated ExportConfigurationInstance - :rtype: twilio.rest.preview.bulk_exports.export_configuration.ExportConfigurationInstance - """ - return self._proxy.update(enabled=enabled, webhook_url=webhook_url, webhook_method=webhook_method, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.BulkExports.ExportConfigurationInstance {}>'.format(context) diff --git a/twilio/rest/preview/deployed_devices/__init__.py b/twilio/rest/preview/deployed_devices/__init__.py deleted file mode 100644 index 56d9d37..0000000 --- a/twilio/rest/preview/deployed_devices/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.preview.deployed_devices.fleet import FleetList - - -class DeployedDevices(Version): - - def __init__(self, domain): - """ - Initialize the DeployedDevices version of Preview - - :returns: DeployedDevices version of Preview - :rtype: twilio.rest.preview.deployed_devices.DeployedDevices.DeployedDevices - """ - super(DeployedDevices, self).__init__(domain) - self.version = 'DeployedDevices' - self._fleets = None - - @property - def fleets(self): - """ - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetList - """ - if self._fleets is None: - self._fleets = FleetList(self) - return self._fleets - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.DeployedDevices>' diff --git a/twilio/rest/preview/deployed_devices/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/deployed_devices/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 8424d37..0000000 Binary files a/twilio/rest/preview/deployed_devices/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/deployed_devices/fleet/__init__.py b/twilio/rest/preview/deployed_devices/fleet/__init__.py deleted file mode 100644 index 59c27b8..0000000 --- a/twilio/rest/preview/deployed_devices/fleet/__init__.py +++ /dev/null @@ -1,545 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.preview.deployed_devices.fleet.certificate import CertificateList -from twilio.rest.preview.deployed_devices.fleet.deployment import DeploymentList -from twilio.rest.preview.deployed_devices.fleet.device import DeviceList -from twilio.rest.preview.deployed_devices.fleet.key import KeyList - - -class FleetList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the FleetList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetList - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetList - """ - super(FleetList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Fleets'.format(**self._solution) - - def create(self, friendly_name=values.unset): - """ - Create a new FleetInstance - - :param unicode friendly_name: A human readable description for this Fleet. - - :returns: Newly created FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return FleetInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams FleetInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.deployed_devices.fleet.FleetInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FleetInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.deployed_devices.fleet.FleetInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FleetInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return FleetPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FleetInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FleetPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a FleetContext - - :param sid: A string that uniquely identifies the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetContext - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetContext - """ - return FleetContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FleetContext - - :param sid: A string that uniquely identifies the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetContext - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetContext - """ - return FleetContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.DeployedDevices.FleetList>' - - -class FleetPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the FleetPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetPage - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetPage - """ - super(FleetPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FleetInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance - """ - return FleetInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.DeployedDevices.FleetPage>' - - -class FleetContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the FleetContext - - :param Version version: Version that contains the resource - :param sid: A string that uniquely identifies the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetContext - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetContext - """ - super(FleetContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Fleets/{sid}'.format(**self._solution) - - # Dependents - self._devices = None - self._deployments = None - self._certificates = None - self._keys = None - - def fetch(self): - """ - Fetch a FleetInstance - - :returns: Fetched FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return FleetInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the FleetInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, - default_deployment_sid=values.unset): - """ - Update the FleetInstance - - :param unicode friendly_name: A human readable description for this Fleet. - :param unicode default_deployment_sid: A default Deployment SID. - - :returns: Updated FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance - """ - data = values.of({'FriendlyName': friendly_name, 'DefaultDeploymentSid': default_deployment_sid, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return FleetInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def devices(self): - """ - Access the devices - - :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceList - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceList - """ - if self._devices is None: - self._devices = DeviceList(self._version, fleet_sid=self._solution['sid'], ) - return self._devices - - @property - def deployments(self): - """ - Access the deployments - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentList - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentList - """ - if self._deployments is None: - self._deployments = DeploymentList(self._version, fleet_sid=self._solution['sid'], ) - return self._deployments - - @property - def certificates(self): - """ - Access the certificates - - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateList - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateList - """ - if self._certificates is None: - self._certificates = CertificateList(self._version, fleet_sid=self._solution['sid'], ) - return self._certificates - - @property - def keys(self): - """ - Access the keys - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyList - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyList - """ - if self._keys is None: - self._keys = KeyList(self._version, fleet_sid=self._solution['sid'], ) - return self._keys - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.DeployedDevices.FleetContext {}>'.format(context) - - -class FleetInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the FleetInstance - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance - """ - super(FleetInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'url': payload['url'], - 'unique_name': payload['unique_name'], - 'friendly_name': payload['friendly_name'], - 'account_sid': payload['account_sid'], - 'default_deployment_sid': payload['default_deployment_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FleetContext for this FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetContext - """ - if self._context is None: - self._context = FleetContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Fleet. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: URL of this Fleet. - :rtype: unicode - """ - return self._properties['url'] - - @property - def unique_name(self): - """ - :returns: A unique, addressable name of this Fleet. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def friendly_name(self): - """ - :returns: A human readable description for this Fleet. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def account_sid(self): - """ - :returns: The unique SID that identifies this Account. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def default_deployment_sid(self): - """ - :returns: The unique SID that identifies this Fleet's default Deployment. - :rtype: unicode - """ - return self._properties['default_deployment_sid'] - - @property - def date_created(self): - """ - :returns: The date this Fleet was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Fleet was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a FleetInstance - - :returns: Fetched FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the FleetInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, - default_deployment_sid=values.unset): - """ - Update the FleetInstance - - :param unicode friendly_name: A human readable description for this Fleet. - :param unicode default_deployment_sid: A default Deployment SID. - - :returns: Updated FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - default_deployment_sid=default_deployment_sid, - ) - - @property - def devices(self): - """ - Access the devices - - :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceList - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceList - """ - return self._proxy.devices - - @property - def deployments(self): - """ - Access the deployments - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentList - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentList - """ - return self._proxy.deployments - - @property - def certificates(self): - """ - Access the certificates - - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateList - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateList - """ - return self._proxy.certificates - - @property - def keys(self): - """ - Access the keys - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyList - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyList - """ - return self._proxy.keys - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.DeployedDevices.FleetInstance {}>'.format(context) diff --git a/twilio/rest/preview/deployed_devices/fleet/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/deployed_devices/fleet/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 9c85b95..0000000 Binary files a/twilio/rest/preview/deployed_devices/fleet/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/deployed_devices/fleet/__pycache__/certificate.cpython-36.pyc b/twilio/rest/preview/deployed_devices/fleet/__pycache__/certificate.cpython-36.pyc deleted file mode 100644 index 8e0e86d..0000000 Binary files a/twilio/rest/preview/deployed_devices/fleet/__pycache__/certificate.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/deployed_devices/fleet/__pycache__/deployment.cpython-36.pyc b/twilio/rest/preview/deployed_devices/fleet/__pycache__/deployment.cpython-36.pyc deleted file mode 100644 index 5cfa75d..0000000 Binary files a/twilio/rest/preview/deployed_devices/fleet/__pycache__/deployment.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/deployed_devices/fleet/__pycache__/device.cpython-36.pyc b/twilio/rest/preview/deployed_devices/fleet/__pycache__/device.cpython-36.pyc deleted file mode 100644 index c98f72e..0000000 Binary files a/twilio/rest/preview/deployed_devices/fleet/__pycache__/device.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/deployed_devices/fleet/__pycache__/key.cpython-36.pyc b/twilio/rest/preview/deployed_devices/fleet/__pycache__/key.cpython-36.pyc deleted file mode 100644 index eacb466..0000000 Binary files a/twilio/rest/preview/deployed_devices/fleet/__pycache__/key.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/deployed_devices/fleet/certificate.py b/twilio/rest/preview/deployed_devices/fleet/certificate.py deleted file mode 100644 index c854014..0000000 --- a/twilio/rest/preview/deployed_devices/fleet/certificate.py +++ /dev/null @@ -1,474 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class CertificateList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid): - """ - Initialize the CertificateList - - :param Version version: Version that contains the resource - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateList - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateList - """ - super(CertificateList, self).__init__(version) - - # Path Solution - self._solution = {'fleet_sid': fleet_sid, } - self._uri = '/Fleets/{fleet_sid}/Certificates'.format(**self._solution) - - def create(self, certificate_data, friendly_name=values.unset, - device_sid=values.unset): - """ - Create a new CertificateInstance - - :param unicode certificate_data: The public certificate data. - :param unicode friendly_name: The human readable description for this Certificate. - :param unicode device_sid: The unique identifier of a Device to be authenticated. - - :returns: Newly created CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - """ - data = values.of({ - 'CertificateData': certificate_data, - 'FriendlyName': friendly_name, - 'DeviceSid': device_sid, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CertificateInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) - - def stream(self, device_sid=values.unset, limit=None, page_size=None): - """ - Streams CertificateInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode device_sid: Find all Certificates authenticating specified Device. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(device_sid=device_sid, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, device_sid=values.unset, limit=None, page_size=None): - """ - Lists CertificateInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode device_sid: Find all Certificates authenticating specified Device. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance] - """ - return list(self.stream(device_sid=device_sid, limit=limit, page_size=page_size, )) - - def page(self, device_sid=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of CertificateInstance records from the API. - Request is executed immediately - - :param unicode device_sid: Find all Certificates authenticating specified Device. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificatePage - """ - params = values.of({ - 'DeviceSid': device_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CertificatePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CertificateInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificatePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CertificatePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a CertificateContext - - :param sid: A string that uniquely identifies the Certificate. - - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateContext - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateContext - """ - return CertificateContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CertificateContext - - :param sid: A string that uniquely identifies the Certificate. - - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateContext - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateContext - """ - return CertificateContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.DeployedDevices.CertificateList>' - - -class CertificatePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the CertificatePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificatePage - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificatePage - """ - super(CertificatePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CertificateInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - """ - return CertificateInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.DeployedDevices.CertificatePage>' - - -class CertificateContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid, sid): - """ - Initialize the CertificateContext - - :param Version version: Version that contains the resource - :param fleet_sid: The fleet_sid - :param sid: A string that uniquely identifies the Certificate. - - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateContext - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateContext - """ - super(CertificateContext, self).__init__(version) - - # Path Solution - self._solution = {'fleet_sid': fleet_sid, 'sid': sid, } - self._uri = '/Fleets/{fleet_sid}/Certificates/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a CertificateInstance - - :returns: Fetched CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CertificateInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the CertificateInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, device_sid=values.unset): - """ - Update the CertificateInstance - - :param unicode friendly_name: The human readable description for this Certificate. - :param unicode device_sid: The unique identifier of a Device to be authenticated. - - :returns: Updated CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - """ - data = values.of({'FriendlyName': friendly_name, 'DeviceSid': device_sid, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return CertificateInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.DeployedDevices.CertificateContext {}>'.format(context) - - -class CertificateInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, fleet_sid, sid=None): - """ - Initialize the CertificateInstance - - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - """ - super(CertificateInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'url': payload['url'], - 'friendly_name': payload['friendly_name'], - 'fleet_sid': payload['fleet_sid'], - 'account_sid': payload['account_sid'], - 'device_sid': payload['device_sid'], - 'thumbprint': payload['thumbprint'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - } - - # Context - self._context = None - self._solution = {'fleet_sid': fleet_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CertificateContext for this CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateContext - """ - if self._context is None: - self._context = CertificateContext( - self._version, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Certificate. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: URL of this Certificate. - :rtype: unicode - """ - return self._properties['url'] - - @property - def friendly_name(self): - """ - :returns: A human readable description for this Certificate. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def fleet_sid(self): - """ - :returns: The unique identifier of the Fleet. - :rtype: unicode - """ - return self._properties['fleet_sid'] - - @property - def account_sid(self): - """ - :returns: The unique SID that identifies this Account. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def device_sid(self): - """ - :returns: The unique identifier of a mapped Device. - :rtype: unicode - """ - return self._properties['device_sid'] - - @property - def thumbprint(self): - """ - :returns: A Certificate unique payload hash. - :rtype: unicode - """ - return self._properties['thumbprint'] - - @property - def date_created(self): - """ - :returns: The date this Certificate was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Certificate was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - def fetch(self): - """ - Fetch a CertificateInstance - - :returns: Fetched CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the CertificateInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, device_sid=values.unset): - """ - Update the CertificateInstance - - :param unicode friendly_name: The human readable description for this Certificate. - :param unicode device_sid: The unique identifier of a Device to be authenticated. - - :returns: Updated CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - """ - return self._proxy.update(friendly_name=friendly_name, device_sid=device_sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.DeployedDevices.CertificateInstance {}>'.format(context) diff --git a/twilio/rest/preview/deployed_devices/fleet/deployment.py b/twilio/rest/preview/deployed_devices/fleet/deployment.py deleted file mode 100644 index a0bb432..0000000 --- a/twilio/rest/preview/deployed_devices/fleet/deployment.py +++ /dev/null @@ -1,451 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class DeploymentList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid): - """ - Initialize the DeploymentList - - :param Version version: Version that contains the resource - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentList - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentList - """ - super(DeploymentList, self).__init__(version) - - # Path Solution - self._solution = {'fleet_sid': fleet_sid, } - self._uri = '/Fleets/{fleet_sid}/Deployments'.format(**self._solution) - - def create(self, friendly_name=values.unset, sync_service_sid=values.unset): - """ - Create a new DeploymentInstance - - :param unicode friendly_name: A human readable description for this Deployment. - :param unicode sync_service_sid: The unique identifier of the Sync service instance. - - :returns: Newly created DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - """ - data = values.of({'FriendlyName': friendly_name, 'SyncServiceSid': sync_service_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return DeploymentInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams DeploymentInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DeploymentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DeploymentInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return DeploymentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DeploymentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DeploymentPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a DeploymentContext - - :param sid: A string that uniquely identifies the Deployment. - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - """ - return DeploymentContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a DeploymentContext - - :param sid: A string that uniquely identifies the Deployment. - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - """ - return DeploymentContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.DeployedDevices.DeploymentList>' - - -class DeploymentPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DeploymentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentPage - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentPage - """ - super(DeploymentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DeploymentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - """ - return DeploymentInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.DeployedDevices.DeploymentPage>' - - -class DeploymentContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid, sid): - """ - Initialize the DeploymentContext - - :param Version version: Version that contains the resource - :param fleet_sid: The fleet_sid - :param sid: A string that uniquely identifies the Deployment. - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - """ - super(DeploymentContext, self).__init__(version) - - # Path Solution - self._solution = {'fleet_sid': fleet_sid, 'sid': sid, } - self._uri = '/Fleets/{fleet_sid}/Deployments/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a DeploymentInstance - - :returns: Fetched DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return DeploymentInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the DeploymentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, sync_service_sid=values.unset): - """ - Update the DeploymentInstance - - :param unicode friendly_name: A human readable description for this Deployment. - :param unicode sync_service_sid: The unique identifier of the Sync service instance. - - :returns: Updated DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - """ - data = values.of({'FriendlyName': friendly_name, 'SyncServiceSid': sync_service_sid, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return DeploymentInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.DeployedDevices.DeploymentContext {}>'.format(context) - - -class DeploymentInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, fleet_sid, sid=None): - """ - Initialize the DeploymentInstance - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - """ - super(DeploymentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'url': payload['url'], - 'friendly_name': payload['friendly_name'], - 'fleet_sid': payload['fleet_sid'], - 'account_sid': payload['account_sid'], - 'sync_service_sid': payload['sync_service_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - } - - # Context - self._context = None - self._solution = {'fleet_sid': fleet_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeploymentContext for this DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - """ - if self._context is None: - self._context = DeploymentContext( - self._version, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Deployment. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: URL of this Deployment. - :rtype: unicode - """ - return self._properties['url'] - - @property - def friendly_name(self): - """ - :returns: A human readable description for this Deployment - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def fleet_sid(self): - """ - :returns: The unique identifier of the Fleet. - :rtype: unicode - """ - return self._properties['fleet_sid'] - - @property - def account_sid(self): - """ - :returns: The unique SID that identifies this Account. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sync_service_sid(self): - """ - :returns: The unique identifier of the Sync service instance. - :rtype: unicode - """ - return self._properties['sync_service_sid'] - - @property - def date_created(self): - """ - :returns: The date this Deployment was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Deployment was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - def fetch(self): - """ - Fetch a DeploymentInstance - - :returns: Fetched DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the DeploymentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, sync_service_sid=values.unset): - """ - Update the DeploymentInstance - - :param unicode friendly_name: A human readable description for this Deployment. - :param unicode sync_service_sid: The unique identifier of the Sync service instance. - - :returns: Updated DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - """ - return self._proxy.update(friendly_name=friendly_name, sync_service_sid=sync_service_sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.DeployedDevices.DeploymentInstance {}>'.format(context) diff --git a/twilio/rest/preview/deployed_devices/fleet/device.py b/twilio/rest/preview/deployed_devices/fleet/device.py deleted file mode 100644 index a326b02..0000000 --- a/twilio/rest/preview/deployed_devices/fleet/device.py +++ /dev/null @@ -1,522 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class DeviceList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid): - """ - Initialize the DeviceList - - :param Version version: Version that contains the resource - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceList - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceList - """ - super(DeviceList, self).__init__(version) - - # Path Solution - self._solution = {'fleet_sid': fleet_sid, } - self._uri = '/Fleets/{fleet_sid}/Devices'.format(**self._solution) - - def create(self, unique_name=values.unset, friendly_name=values.unset, - identity=values.unset, deployment_sid=values.unset, - enabled=values.unset): - """ - Create a new DeviceInstance - - :param unicode unique_name: A unique, addressable name of this Device. - :param unicode friendly_name: A human readable description for this Device. - :param unicode identity: An identifier of the Device user. - :param unicode deployment_sid: The unique SID of the Deployment group. - :param bool enabled: The enabled - - :returns: Newly created DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'FriendlyName': friendly_name, - 'Identity': identity, - 'DeploymentSid': deployment_sid, - 'Enabled': enabled, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return DeviceInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) - - def stream(self, deployment_sid=values.unset, limit=None, page_size=None): - """ - Streams DeviceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode deployment_sid: Find all Devices grouped under the specified Deployment. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(deployment_sid=deployment_sid, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, deployment_sid=values.unset, limit=None, page_size=None): - """ - Lists DeviceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode deployment_sid: Find all Devices grouped under the specified Deployment. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance] - """ - return list(self.stream(deployment_sid=deployment_sid, limit=limit, page_size=page_size, )) - - def page(self, deployment_sid=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of DeviceInstance records from the API. - Request is executed immediately - - :param unicode deployment_sid: Find all Devices grouped under the specified Deployment. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DevicePage - """ - params = values.of({ - 'DeploymentSid': deployment_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return DevicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DeviceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DevicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DevicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a DeviceContext - - :param sid: A string that uniquely identifies the Device. - - :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext - """ - return DeviceContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a DeviceContext - - :param sid: A string that uniquely identifies the Device. - - :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext - """ - return DeviceContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.DeployedDevices.DeviceList>' - - -class DevicePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DevicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.device.DevicePage - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DevicePage - """ - super(DevicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DeviceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - """ - return DeviceInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.DeployedDevices.DevicePage>' - - -class DeviceContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid, sid): - """ - Initialize the DeviceContext - - :param Version version: Version that contains the resource - :param fleet_sid: The fleet_sid - :param sid: A string that uniquely identifies the Device. - - :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext - """ - super(DeviceContext, self).__init__(version) - - # Path Solution - self._solution = {'fleet_sid': fleet_sid, 'sid': sid, } - self._uri = '/Fleets/{fleet_sid}/Devices/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a DeviceInstance - - :returns: Fetched DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return DeviceInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the DeviceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, identity=values.unset, - deployment_sid=values.unset, enabled=values.unset): - """ - Update the DeviceInstance - - :param unicode friendly_name: A human readable description for this Device. - :param unicode identity: An identifier of the Device user. - :param unicode deployment_sid: The unique SID of the Deployment group. - :param bool enabled: The enabled - - :returns: Updated DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Identity': identity, - 'DeploymentSid': deployment_sid, - 'Enabled': enabled, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return DeviceInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.DeployedDevices.DeviceContext {}>'.format(context) - - -class DeviceInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, fleet_sid, sid=None): - """ - Initialize the DeviceInstance - - :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - """ - super(DeviceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'url': payload['url'], - 'unique_name': payload['unique_name'], - 'friendly_name': payload['friendly_name'], - 'fleet_sid': payload['fleet_sid'], - 'enabled': payload['enabled'], - 'account_sid': payload['account_sid'], - 'identity': payload['identity'], - 'deployment_sid': payload['deployment_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'date_authenticated': deserialize.iso8601_datetime(payload['date_authenticated']), - } - - # Context - self._context = None - self._solution = {'fleet_sid': fleet_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeviceContext for this DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext - """ - if self._context is None: - self._context = DeviceContext( - self._version, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Device. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: URL of this Device. - :rtype: unicode - """ - return self._properties['url'] - - @property - def unique_name(self): - """ - :returns: A unique, addressable name of this Device. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def friendly_name(self): - """ - :returns: A human readable description for this Device - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def fleet_sid(self): - """ - :returns: The unique identifier of the Fleet. - :rtype: unicode - """ - return self._properties['fleet_sid'] - - @property - def enabled(self): - """ - :returns: Device enabled flag. - :rtype: bool - """ - return self._properties['enabled'] - - @property - def account_sid(self): - """ - :returns: The unique SID that identifies this Account. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def identity(self): - """ - :returns: An identifier of the Device user. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def deployment_sid(self): - """ - :returns: The unique SID of the Deployment group. - :rtype: unicode - """ - return self._properties['deployment_sid'] - - @property - def date_created(self): - """ - :returns: The date this Device was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Device was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def date_authenticated(self): - """ - :returns: The date this Device was authenticated. - :rtype: datetime - """ - return self._properties['date_authenticated'] - - def fetch(self): - """ - Fetch a DeviceInstance - - :returns: Fetched DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the DeviceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, identity=values.unset, - deployment_sid=values.unset, enabled=values.unset): - """ - Update the DeviceInstance - - :param unicode friendly_name: A human readable description for this Device. - :param unicode identity: An identifier of the Device user. - :param unicode deployment_sid: The unique SID of the Deployment group. - :param bool enabled: The enabled - - :returns: Updated DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - identity=identity, - deployment_sid=deployment_sid, - enabled=enabled, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.DeployedDevices.DeviceInstance {}>'.format(context) diff --git a/twilio/rest/preview/deployed_devices/fleet/key.py b/twilio/rest/preview/deployed_devices/fleet/key.py deleted file mode 100644 index 93881ca..0000000 --- a/twilio/rest/preview/deployed_devices/fleet/key.py +++ /dev/null @@ -1,468 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class KeyList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid): - """ - Initialize the KeyList - - :param Version version: Version that contains the resource - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyList - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyList - """ - super(KeyList, self).__init__(version) - - # Path Solution - self._solution = {'fleet_sid': fleet_sid, } - self._uri = '/Fleets/{fleet_sid}/Keys'.format(**self._solution) - - def create(self, friendly_name=values.unset, device_sid=values.unset): - """ - Create a new KeyInstance - - :param unicode friendly_name: The human readable description for this Key. - :param unicode device_sid: The unique identifier of a Key to be authenticated. - - :returns: Newly created KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - """ - data = values.of({'FriendlyName': friendly_name, 'DeviceSid': device_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return KeyInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) - - def stream(self, device_sid=values.unset, limit=None, page_size=None): - """ - Streams KeyInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode device_sid: Find all Keys authenticating specified Device. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.deployed_devices.fleet.key.KeyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(device_sid=device_sid, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, device_sid=values.unset, limit=None, page_size=None): - """ - Lists KeyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode device_sid: Find all Keys authenticating specified Device. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.deployed_devices.fleet.key.KeyInstance] - """ - return list(self.stream(device_sid=device_sid, limit=limit, page_size=page_size, )) - - def page(self, device_sid=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of KeyInstance records from the API. - Request is executed immediately - - :param unicode device_sid: Find all Keys authenticating specified Device. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyPage - """ - params = values.of({ - 'DeviceSid': device_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return KeyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of KeyInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return KeyPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a KeyContext - - :param sid: A string that uniquely identifies the Key. - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - """ - return KeyContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a KeyContext - - :param sid: A string that uniquely identifies the Key. - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - """ - return KeyContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.DeployedDevices.KeyList>' - - -class KeyPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the KeyPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyPage - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyPage - """ - super(KeyPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of KeyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - """ - return KeyInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.DeployedDevices.KeyPage>' - - -class KeyContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid, sid): - """ - Initialize the KeyContext - - :param Version version: Version that contains the resource - :param fleet_sid: The fleet_sid - :param sid: A string that uniquely identifies the Key. - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - """ - super(KeyContext, self).__init__(version) - - # Path Solution - self._solution = {'fleet_sid': fleet_sid, 'sid': sid, } - self._uri = '/Fleets/{fleet_sid}/Keys/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a KeyInstance - - :returns: Fetched KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return KeyInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the KeyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, device_sid=values.unset): - """ - Update the KeyInstance - - :param unicode friendly_name: The human readable description for this Key. - :param unicode device_sid: The unique identifier of a Key to be authenticated. - - :returns: Updated KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - """ - data = values.of({'FriendlyName': friendly_name, 'DeviceSid': device_sid, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return KeyInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.DeployedDevices.KeyContext {}>'.format(context) - - -class KeyInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, fleet_sid, sid=None): - """ - Initialize the KeyInstance - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - """ - super(KeyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'url': payload['url'], - 'friendly_name': payload['friendly_name'], - 'fleet_sid': payload['fleet_sid'], - 'account_sid': payload['account_sid'], - 'device_sid': payload['device_sid'], - 'secret': payload['secret'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - } - - # Context - self._context = None - self._solution = {'fleet_sid': fleet_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: KeyContext for this KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - """ - if self._context is None: - self._context = KeyContext( - self._version, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Key. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: URL of this Key. - :rtype: unicode - """ - return self._properties['url'] - - @property - def friendly_name(self): - """ - :returns: A human readable description for this Key. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def fleet_sid(self): - """ - :returns: The unique identifier of the Fleet. - :rtype: unicode - """ - return self._properties['fleet_sid'] - - @property - def account_sid(self): - """ - :returns: The unique SID that identifies this Account. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def device_sid(self): - """ - :returns: The unique identifier of a mapped Device. - :rtype: unicode - """ - return self._properties['device_sid'] - - @property - def secret(self): - """ - :returns: The key secret. - :rtype: unicode - """ - return self._properties['secret'] - - @property - def date_created(self): - """ - :returns: The date this Key credential was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Key credential was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - def fetch(self): - """ - Fetch a KeyInstance - - :returns: Fetched KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the KeyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, device_sid=values.unset): - """ - Update the KeyInstance - - :param unicode friendly_name: The human readable description for this Key. - :param unicode device_sid: The unique identifier of a Key to be authenticated. - - :returns: Updated KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - """ - return self._proxy.update(friendly_name=friendly_name, device_sid=device_sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.DeployedDevices.KeyInstance {}>'.format(context) diff --git a/twilio/rest/preview/hosted_numbers/__init__.py b/twilio/rest/preview/hosted_numbers/__init__.py deleted file mode 100644 index 7262d0d..0000000 --- a/twilio/rest/preview/hosted_numbers/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.preview.hosted_numbers.authorization_document import AuthorizationDocumentList -from twilio.rest.preview.hosted_numbers.hosted_number_order import HostedNumberOrderList - - -class HostedNumbers(Version): - - def __init__(self, domain): - """ - Initialize the HostedNumbers version of Preview - - :returns: HostedNumbers version of Preview - :rtype: twilio.rest.preview.hosted_numbers.HostedNumbers.HostedNumbers - """ - super(HostedNumbers, self).__init__(domain) - self.version = 'HostedNumbers' - self._authorization_documents = None - self._hosted_number_orders = None - - @property - def authorization_documents(self): - """ - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentList - """ - if self._authorization_documents is None: - self._authorization_documents = AuthorizationDocumentList(self) - return self._authorization_documents - - @property - def hosted_number_orders(self): - """ - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderList - """ - if self._hosted_number_orders is None: - self._hosted_number_orders = HostedNumberOrderList(self) - return self._hosted_number_orders - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.HostedNumbers>' diff --git a/twilio/rest/preview/hosted_numbers/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/hosted_numbers/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 1398894..0000000 Binary files a/twilio/rest/preview/hosted_numbers/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/hosted_numbers/__pycache__/hosted_number_order.cpython-36.pyc b/twilio/rest/preview/hosted_numbers/__pycache__/hosted_number_order.cpython-36.pyc deleted file mode 100644 index 81c71d2..0000000 Binary files a/twilio/rest/preview/hosted_numbers/__pycache__/hosted_number_order.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py deleted file mode 100644 index d009184..0000000 --- a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py +++ /dev/null @@ -1,506 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order import DependentHostedNumberOrderList - - -class AuthorizationDocumentList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the AuthorizationDocumentList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentList - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentList - """ - super(AuthorizationDocumentList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/AuthorizationDocuments'.format(**self._solution) - - def stream(self, email=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Streams AuthorizationDocumentInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode email: Email. - :param AuthorizationDocumentInstance.Status status: The Status of this AuthorizationDocument. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(email=email, status=status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, email=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Lists AuthorizationDocumentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode email: Email. - :param AuthorizationDocumentInstance.Status status: The Status of this AuthorizationDocument. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance] - """ - return list(self.stream(email=email, status=status, limit=limit, page_size=page_size, )) - - def page(self, email=values.unset, status=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of AuthorizationDocumentInstance records from the API. - Request is executed immediately - - :param unicode email: Email. - :param AuthorizationDocumentInstance.Status status: The Status of this AuthorizationDocument. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentPage - """ - params = values.of({ - 'Email': email, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AuthorizationDocumentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AuthorizationDocumentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AuthorizationDocumentPage(self._version, response, self._solution) - - def create(self, hosted_number_order_sids, address_sid, email, - cc_emails=values.unset): - """ - Create a new AuthorizationDocumentInstance - - :param unicode hosted_number_order_sids: A list of HostedNumberOrder sids. - :param unicode address_sid: Address sid. - :param unicode email: Email. - :param unicode cc_emails: A list of emails. - - :returns: Newly created AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - """ - data = values.of({ - 'HostedNumberOrderSids': serialize.map(hosted_number_order_sids, lambda e: e), - 'AddressSid': address_sid, - 'Email': email, - 'CcEmails': serialize.map(cc_emails, lambda e: e), - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return AuthorizationDocumentInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a AuthorizationDocumentContext - - :param sid: AuthorizationDocument sid. - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - """ - return AuthorizationDocumentContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AuthorizationDocumentContext - - :param sid: AuthorizationDocument sid. - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - """ - return AuthorizationDocumentContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.HostedNumbers.AuthorizationDocumentList>' - - -class AuthorizationDocumentPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the AuthorizationDocumentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentPage - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentPage - """ - super(AuthorizationDocumentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AuthorizationDocumentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - """ - return AuthorizationDocumentInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.HostedNumbers.AuthorizationDocumentPage>' - - -class AuthorizationDocumentContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the AuthorizationDocumentContext - - :param Version version: Version that contains the resource - :param sid: AuthorizationDocument sid. - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - """ - super(AuthorizationDocumentContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/AuthorizationDocuments/{sid}'.format(**self._solution) - - # Dependents - self._dependent_hosted_number_orders = None - - def fetch(self): - """ - Fetch a AuthorizationDocumentInstance - - :returns: Fetched AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return AuthorizationDocumentInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, hosted_number_order_sids=values.unset, - address_sid=values.unset, email=values.unset, cc_emails=values.unset, - status=values.unset): - """ - Update the AuthorizationDocumentInstance - - :param unicode hosted_number_order_sids: A list of HostedNumberOrder sids. - :param unicode address_sid: Address sid. - :param unicode email: Email. - :param unicode cc_emails: A list of emails. - :param AuthorizationDocumentInstance.Status status: The Status of this AuthorizationDocument. - - :returns: Updated AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - """ - data = values.of({ - 'HostedNumberOrderSids': serialize.map(hosted_number_order_sids, lambda e: e), - 'AddressSid': address_sid, - 'Email': email, - 'CcEmails': serialize.map(cc_emails, lambda e: e), - 'Status': status, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return AuthorizationDocumentInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def dependent_hosted_number_orders(self): - """ - Access the dependent_hosted_number_orders - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderList - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderList - """ - if self._dependent_hosted_number_orders is None: - self._dependent_hosted_number_orders = DependentHostedNumberOrderList( - self._version, - signing_document_sid=self._solution['sid'], - ) - return self._dependent_hosted_number_orders - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.HostedNumbers.AuthorizationDocumentContext {}>'.format(context) - - -class AuthorizationDocumentInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - OPENED = "opened" - SIGNING = "signing" - SIGNED = "signed" - CANCELED = "canceled" - FAILED = "failed" - - def __init__(self, version, payload, sid=None): - """ - Initialize the AuthorizationDocumentInstance - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - """ - super(AuthorizationDocumentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'address_sid': payload['address_sid'], - 'status': payload['status'], - 'email': payload['email'], - 'cc_emails': payload['cc_emails'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AuthorizationDocumentContext for this AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - """ - if self._context is None: - self._context = AuthorizationDocumentContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: AuthorizationDocument sid. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def address_sid(self): - """ - :returns: Address sid. - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def status(self): - """ - :returns: The Status of this AuthorizationDocument. - :rtype: AuthorizationDocumentInstance.Status - """ - return self._properties['status'] - - @property - def email(self): - """ - :returns: Email. - :rtype: unicode - """ - return self._properties['email'] - - @property - def cc_emails(self): - """ - :returns: A list of emails. - :rtype: unicode - """ - return self._properties['cc_emails'] - - @property - def date_created(self): - """ - :returns: The date this AuthorizationDocument was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this AuthorizationDocument was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a AuthorizationDocumentInstance - - :returns: Fetched AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - """ - return self._proxy.fetch() - - def update(self, hosted_number_order_sids=values.unset, - address_sid=values.unset, email=values.unset, cc_emails=values.unset, - status=values.unset): - """ - Update the AuthorizationDocumentInstance - - :param unicode hosted_number_order_sids: A list of HostedNumberOrder sids. - :param unicode address_sid: Address sid. - :param unicode email: Email. - :param unicode cc_emails: A list of emails. - :param AuthorizationDocumentInstance.Status status: The Status of this AuthorizationDocument. - - :returns: Updated AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - """ - return self._proxy.update( - hosted_number_order_sids=hosted_number_order_sids, - address_sid=address_sid, - email=email, - cc_emails=cc_emails, - status=status, - ) - - @property - def dependent_hosted_number_orders(self): - """ - Access the dependent_hosted_number_orders - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderList - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderList - """ - return self._proxy.dependent_hosted_number_orders - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.HostedNumbers.AuthorizationDocumentInstance {}>'.format(context) diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/hosted_numbers/authorization_document/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index b820e8a..0000000 Binary files a/twilio/rest/preview/hosted_numbers/authorization_document/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/__pycache__/dependent_hosted_number_order.cpython-36.pyc b/twilio/rest/preview/hosted_numbers/authorization_document/__pycache__/dependent_hosted_number_order.cpython-36.pyc deleted file mode 100644 index 1fa1299..0000000 Binary files a/twilio/rest/preview/hosted_numbers/authorization_document/__pycache__/dependent_hosted_number_order.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py b/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py deleted file mode 100644 index 35555a3..0000000 --- a/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py +++ /dev/null @@ -1,461 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DependentHostedNumberOrderList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, signing_document_sid): - """ - Initialize the DependentHostedNumberOrderList - - :param Version version: Version that contains the resource - :param signing_document_sid: LOA document sid. - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderList - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderList - """ - super(DependentHostedNumberOrderList, self).__init__(version) - - # Path Solution - self._solution = {'signing_document_sid': signing_document_sid, } - self._uri = '/AuthorizationDocuments/{signing_document_sid}/DependentHostedNumberOrders'.format(**self._solution) - - def stream(self, status=values.unset, phone_number=values.unset, - incoming_phone_number_sid=values.unset, friendly_name=values.unset, - unique_name=values.unset, limit=None, page_size=None): - """ - Streams DependentHostedNumberOrderInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param DependentHostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode phone_number: An E164 formatted phone number. - :param unicode incoming_phone_number_sid: IncomingPhoneNumber sid. - :param unicode friendly_name: A human readable description of this resource. - :param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - phone_number=phone_number, - incoming_phone_number_sid=incoming_phone_number_sid, - friendly_name=friendly_name, - unique_name=unique_name, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, status=values.unset, phone_number=values.unset, - incoming_phone_number_sid=values.unset, friendly_name=values.unset, - unique_name=values.unset, limit=None, page_size=None): - """ - Lists DependentHostedNumberOrderInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param DependentHostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode phone_number: An E164 formatted phone number. - :param unicode incoming_phone_number_sid: IncomingPhoneNumber sid. - :param unicode friendly_name: A human readable description of this resource. - :param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderInstance] - """ - return list(self.stream( - status=status, - phone_number=phone_number, - incoming_phone_number_sid=incoming_phone_number_sid, - friendly_name=friendly_name, - unique_name=unique_name, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, phone_number=values.unset, - incoming_phone_number_sid=values.unset, friendly_name=values.unset, - unique_name=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of DependentHostedNumberOrderInstance records from the API. - Request is executed immediately - - :param DependentHostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode phone_number: An E164 formatted phone number. - :param unicode incoming_phone_number_sid: IncomingPhoneNumber sid. - :param unicode friendly_name: A human readable description of this resource. - :param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DependentHostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderPage - """ - params = values.of({ - 'Status': status, - 'PhoneNumber': phone_number, - 'IncomingPhoneNumberSid': incoming_phone_number_sid, - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return DependentHostedNumberOrderPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DependentHostedNumberOrderInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DependentHostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DependentHostedNumberOrderPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.HostedNumbers.DependentHostedNumberOrderList>' - - -class DependentHostedNumberOrderPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DependentHostedNumberOrderPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param signing_document_sid: LOA document sid. - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderPage - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderPage - """ - super(DependentHostedNumberOrderPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DependentHostedNumberOrderInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderInstance - """ - return DependentHostedNumberOrderInstance( - self._version, - payload, - signing_document_sid=self._solution['signing_document_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.HostedNumbers.DependentHostedNumberOrderPage>' - - -class DependentHostedNumberOrderInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - RECEIVED = "received" - PENDING_VERIFICATION = "pending-verification" - VERIFIED = "verified" - PENDING_LOA = "pending-loa" - CARRIER_PROCESSING = "carrier-processing" - TESTING = "testing" - COMPLETED = "completed" - FAILED = "failed" - ACTION_REQUIRED = "action-required" - - class VerificationType(object): - PHONE_CALL = "phone-call" - PHONE_BILL = "phone-bill" - - def __init__(self, version, payload, signing_document_sid): - """ - Initialize the DependentHostedNumberOrderInstance - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderInstance - """ - super(DependentHostedNumberOrderInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'incoming_phone_number_sid': payload['incoming_phone_number_sid'], - 'address_sid': payload['address_sid'], - 'signing_document_sid': payload['signing_document_sid'], - 'phone_number': payload['phone_number'], - 'capabilities': payload['capabilities'], - 'friendly_name': payload['friendly_name'], - 'unique_name': payload['unique_name'], - 'status': payload['status'], - 'failure_reason': payload['failure_reason'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'verification_attempts': deserialize.integer(payload['verification_attempts']), - 'email': payload['email'], - 'cc_emails': payload['cc_emails'], - 'verification_type': payload['verification_type'], - 'verification_document_sid': payload['verification_document_sid'], - 'extension': payload['extension'], - 'call_delay': deserialize.integer(payload['call_delay']), - 'verification_code': payload['verification_code'], - 'verification_call_sids': payload['verification_call_sids'], - } - - # Context - self._context = None - self._solution = {'signing_document_sid': signing_document_sid, } - - @property - def sid(self): - """ - :returns: HostedNumberOrder sid. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def incoming_phone_number_sid(self): - """ - :returns: IncomingPhoneNumber sid. - :rtype: unicode - """ - return self._properties['incoming_phone_number_sid'] - - @property - def address_sid(self): - """ - :returns: Address sid. - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def signing_document_sid(self): - """ - :returns: LOA document sid. - :rtype: unicode - """ - return self._properties['signing_document_sid'] - - @property - def phone_number(self): - """ - :returns: An E164 formatted phone number. - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def capabilities(self): - """ - :returns: A mapping of phone number capabilities. - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: A unique, developer assigned name of this HostedNumberOrder. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def status(self): - """ - :returns: The Status of this HostedNumberOrder. - :rtype: DependentHostedNumberOrderInstance.Status - """ - return self._properties['status'] - - @property - def failure_reason(self): - """ - :returns: Why a hosted_number_order reached status "action-required" - :rtype: unicode - """ - return self._properties['failure_reason'] - - @property - def date_created(self): - """ - :returns: The date this HostedNumberOrder was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this HostedNumberOrder was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def verification_attempts(self): - """ - :returns: The number of attempts made to verify ownership of the phone number. - :rtype: unicode - """ - return self._properties['verification_attempts'] - - @property - def email(self): - """ - :returns: Email. - :rtype: unicode - """ - return self._properties['email'] - - @property - def cc_emails(self): - """ - :returns: A list of emails. - :rtype: unicode - """ - return self._properties['cc_emails'] - - @property - def verification_type(self): - """ - :returns: The method used for verifying ownership of the number to be hosted. - :rtype: DependentHostedNumberOrderInstance.VerificationType - """ - return self._properties['verification_type'] - - @property - def verification_document_sid(self): - """ - :returns: Verification Document Sid. - :rtype: unicode - """ - return self._properties['verification_document_sid'] - - @property - def extension(self): - """ - :returns: Phone extension to use for ownership verification call. - :rtype: unicode - """ - return self._properties['extension'] - - @property - def call_delay(self): - """ - :returns: Seconds (0-30) to delay ownership verification call by. - :rtype: unicode - """ - return self._properties['call_delay'] - - @property - def verification_code(self): - """ - :returns: The digits passed during the ownership verification call. - :rtype: unicode - """ - return self._properties['verification_code'] - - @property - def verification_call_sids(self): - """ - :returns: List of IDs for ownership verification calls. - :rtype: unicode - """ - return self._properties['verification_call_sids'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.HostedNumbers.DependentHostedNumberOrderInstance>' diff --git a/twilio/rest/preview/hosted_numbers/hosted_number_order.py b/twilio/rest/preview/hosted_numbers/hosted_number_order.py deleted file mode 100644 index 3f3248c..0000000 --- a/twilio/rest/preview/hosted_numbers/hosted_number_order.py +++ /dev/null @@ -1,717 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class HostedNumberOrderList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the HostedNumberOrderList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderList - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderList - """ - super(HostedNumberOrderList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/HostedNumberOrders'.format(**self._solution) - - def stream(self, status=values.unset, phone_number=values.unset, - incoming_phone_number_sid=values.unset, friendly_name=values.unset, - unique_name=values.unset, limit=None, page_size=None): - """ - Streams HostedNumberOrderInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param HostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode phone_number: An E164 formatted phone number. - :param unicode incoming_phone_number_sid: IncomingPhoneNumber sid. - :param unicode friendly_name: A human readable description of this resource. - :param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - phone_number=phone_number, - incoming_phone_number_sid=incoming_phone_number_sid, - friendly_name=friendly_name, - unique_name=unique_name, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, status=values.unset, phone_number=values.unset, - incoming_phone_number_sid=values.unset, friendly_name=values.unset, - unique_name=values.unset, limit=None, page_size=None): - """ - Lists HostedNumberOrderInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param HostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode phone_number: An E164 formatted phone number. - :param unicode incoming_phone_number_sid: IncomingPhoneNumber sid. - :param unicode friendly_name: A human readable description of this resource. - :param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance] - """ - return list(self.stream( - status=status, - phone_number=phone_number, - incoming_phone_number_sid=incoming_phone_number_sid, - friendly_name=friendly_name, - unique_name=unique_name, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, phone_number=values.unset, - incoming_phone_number_sid=values.unset, friendly_name=values.unset, - unique_name=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of HostedNumberOrderInstance records from the API. - Request is executed immediately - - :param HostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode phone_number: An E164 formatted phone number. - :param unicode incoming_phone_number_sid: IncomingPhoneNumber sid. - :param unicode friendly_name: A human readable description of this resource. - :param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderPage - """ - params = values.of({ - 'Status': status, - 'PhoneNumber': phone_number, - 'IncomingPhoneNumberSid': incoming_phone_number_sid, - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return HostedNumberOrderPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of HostedNumberOrderInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return HostedNumberOrderPage(self._version, response, self._solution) - - def create(self, phone_number, sms_capability, account_sid=values.unset, - friendly_name=values.unset, unique_name=values.unset, - cc_emails=values.unset, sms_url=values.unset, - sms_method=values.unset, sms_fallback_url=values.unset, - sms_fallback_method=values.unset, status_callback_url=values.unset, - status_callback_method=values.unset, - sms_application_sid=values.unset, address_sid=values.unset, - email=values.unset, verification_type=values.unset, - verification_document_sid=values.unset): - """ - Create a new HostedNumberOrderInstance - - :param unicode phone_number: An E164 formatted phone number. - :param bool sms_capability: Specify SMS capability to host. - :param unicode account_sid: Account Sid. - :param unicode friendly_name: A human readable description of this resource. - :param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder. - :param unicode cc_emails: A list of emails. - :param unicode sms_url: SMS URL. - :param unicode sms_method: SMS Method. - :param unicode sms_fallback_url: SMS Fallback URL. - :param unicode sms_fallback_method: SMS Fallback Method. - :param unicode status_callback_url: Status Callback URL. - :param unicode status_callback_method: Status Callback Method. - :param unicode sms_application_sid: SMS Application Sid. - :param unicode address_sid: Address sid. - :param unicode email: Email. - :param HostedNumberOrderInstance.VerificationType verification_type: Verification Type. - :param unicode verification_document_sid: Verification Document Sid - - :returns: Newly created HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - """ - data = values.of({ - 'PhoneNumber': phone_number, - 'SmsCapability': sms_capability, - 'AccountSid': account_sid, - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'CcEmails': serialize.map(cc_emails, lambda e: e), - 'SmsUrl': sms_url, - 'SmsMethod': sms_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsFallbackMethod': sms_fallback_method, - 'StatusCallbackUrl': status_callback_url, - 'StatusCallbackMethod': status_callback_method, - 'SmsApplicationSid': sms_application_sid, - 'AddressSid': address_sid, - 'Email': email, - 'VerificationType': verification_type, - 'VerificationDocumentSid': verification_document_sid, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return HostedNumberOrderInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a HostedNumberOrderContext - - :param sid: HostedNumberOrder sid. - - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - """ - return HostedNumberOrderContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a HostedNumberOrderContext - - :param sid: HostedNumberOrder sid. - - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - """ - return HostedNumberOrderContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.HostedNumbers.HostedNumberOrderList>' - - -class HostedNumberOrderPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the HostedNumberOrderPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderPage - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderPage - """ - super(HostedNumberOrderPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of HostedNumberOrderInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - """ - return HostedNumberOrderInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.HostedNumbers.HostedNumberOrderPage>' - - -class HostedNumberOrderContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the HostedNumberOrderContext - - :param Version version: Version that contains the resource - :param sid: HostedNumberOrder sid. - - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - """ - super(HostedNumberOrderContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/HostedNumberOrders/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a HostedNumberOrderInstance - - :returns: Fetched HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return HostedNumberOrderInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the HostedNumberOrderInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, unique_name=values.unset, - email=values.unset, cc_emails=values.unset, status=values.unset, - verification_code=values.unset, verification_type=values.unset, - verification_document_sid=values.unset, extension=values.unset, - call_delay=values.unset): - """ - Update the HostedNumberOrderInstance - - :param unicode friendly_name: A human readable description of this resource. - :param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder. - :param unicode email: Email. - :param unicode cc_emails: A list of emails. - :param HostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode verification_code: A verification code. - :param HostedNumberOrderInstance.VerificationType verification_type: Verification Type. - :param unicode verification_document_sid: Verification Document Sid - :param unicode extension: The extension - :param unicode call_delay: The call_delay - - :returns: Updated HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Email': email, - 'CcEmails': serialize.map(cc_emails, lambda e: e), - 'Status': status, - 'VerificationCode': verification_code, - 'VerificationType': verification_type, - 'VerificationDocumentSid': verification_document_sid, - 'Extension': extension, - 'CallDelay': call_delay, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return HostedNumberOrderInstance(self._version, payload, sid=self._solution['sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.HostedNumbers.HostedNumberOrderContext {}>'.format(context) - - -class HostedNumberOrderInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - RECEIVED = "received" - PENDING_VERIFICATION = "pending-verification" - VERIFIED = "verified" - PENDING_LOA = "pending-loa" - CARRIER_PROCESSING = "carrier-processing" - TESTING = "testing" - COMPLETED = "completed" - FAILED = "failed" - ACTION_REQUIRED = "action-required" - - class VerificationType(object): - PHONE_CALL = "phone-call" - PHONE_BILL = "phone-bill" - - def __init__(self, version, payload, sid=None): - """ - Initialize the HostedNumberOrderInstance - - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - """ - super(HostedNumberOrderInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'incoming_phone_number_sid': payload['incoming_phone_number_sid'], - 'address_sid': payload['address_sid'], - 'signing_document_sid': payload['signing_document_sid'], - 'phone_number': payload['phone_number'], - 'capabilities': payload['capabilities'], - 'friendly_name': payload['friendly_name'], - 'unique_name': payload['unique_name'], - 'status': payload['status'], - 'failure_reason': payload['failure_reason'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'verification_attempts': deserialize.integer(payload['verification_attempts']), - 'email': payload['email'], - 'cc_emails': payload['cc_emails'], - 'url': payload['url'], - 'verification_type': payload['verification_type'], - 'verification_document_sid': payload['verification_document_sid'], - 'extension': payload['extension'], - 'call_delay': deserialize.integer(payload['call_delay']), - 'verification_code': payload['verification_code'], - 'verification_call_sids': payload['verification_call_sids'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: HostedNumberOrderContext for this HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - """ - if self._context is None: - self._context = HostedNumberOrderContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: HostedNumberOrder sid. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def incoming_phone_number_sid(self): - """ - :returns: IncomingPhoneNumber sid. - :rtype: unicode - """ - return self._properties['incoming_phone_number_sid'] - - @property - def address_sid(self): - """ - :returns: Address sid. - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def signing_document_sid(self): - """ - :returns: LOA document sid. - :rtype: unicode - """ - return self._properties['signing_document_sid'] - - @property - def phone_number(self): - """ - :returns: An E164 formatted phone number. - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def capabilities(self): - """ - :returns: A mapping of phone number capabilities. - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: A unique, developer assigned name of this HostedNumberOrder. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def status(self): - """ - :returns: The Status of this HostedNumberOrder. - :rtype: HostedNumberOrderInstance.Status - """ - return self._properties['status'] - - @property - def failure_reason(self): - """ - :returns: Why a hosted_number_order reached status "action-required" - :rtype: unicode - """ - return self._properties['failure_reason'] - - @property - def date_created(self): - """ - :returns: The date this HostedNumberOrder was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this HostedNumberOrder was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def verification_attempts(self): - """ - :returns: The number of attempts made to verify ownership of the phone number. - :rtype: unicode - """ - return self._properties['verification_attempts'] - - @property - def email(self): - """ - :returns: Email. - :rtype: unicode - """ - return self._properties['email'] - - @property - def cc_emails(self): - """ - :returns: A list of emails. - :rtype: unicode - """ - return self._properties['cc_emails'] - - @property - def url(self): - """ - :returns: The URL of this HostedNumberOrder. - :rtype: unicode - """ - return self._properties['url'] - - @property - def verification_type(self): - """ - :returns: The method used for verifying ownership of the number to be hosted. - :rtype: HostedNumberOrderInstance.VerificationType - """ - return self._properties['verification_type'] - - @property - def verification_document_sid(self): - """ - :returns: Verification Document Sid. - :rtype: unicode - """ - return self._properties['verification_document_sid'] - - @property - def extension(self): - """ - :returns: Phone extension to use for ownership verification call. - :rtype: unicode - """ - return self._properties['extension'] - - @property - def call_delay(self): - """ - :returns: Seconds (0-30) to delay ownership verification call by. - :rtype: unicode - """ - return self._properties['call_delay'] - - @property - def verification_code(self): - """ - :returns: The digits passed during the ownership verification call. - :rtype: unicode - """ - return self._properties['verification_code'] - - @property - def verification_call_sids(self): - """ - :returns: List of IDs for ownership verification calls. - :rtype: unicode - """ - return self._properties['verification_call_sids'] - - def fetch(self): - """ - Fetch a HostedNumberOrderInstance - - :returns: Fetched HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the HostedNumberOrderInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, unique_name=values.unset, - email=values.unset, cc_emails=values.unset, status=values.unset, - verification_code=values.unset, verification_type=values.unset, - verification_document_sid=values.unset, extension=values.unset, - call_delay=values.unset): - """ - Update the HostedNumberOrderInstance - - :param unicode friendly_name: A human readable description of this resource. - :param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder. - :param unicode email: Email. - :param unicode cc_emails: A list of emails. - :param HostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode verification_code: A verification code. - :param HostedNumberOrderInstance.VerificationType verification_type: Verification Type. - :param unicode verification_document_sid: Verification Document Sid - :param unicode extension: The extension - :param unicode call_delay: The call_delay - - :returns: Updated HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - unique_name=unique_name, - email=email, - cc_emails=cc_emails, - status=status, - verification_code=verification_code, - verification_type=verification_type, - verification_document_sid=verification_document_sid, - extension=extension, - call_delay=call_delay, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.HostedNumbers.HostedNumberOrderInstance {}>'.format(context) diff --git a/twilio/rest/preview/marketplace/__init__.py b/twilio/rest/preview/marketplace/__init__.py deleted file mode 100644 index 4f6010c..0000000 --- a/twilio/rest/preview/marketplace/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.preview.marketplace.available_add_on import AvailableAddOnList -from twilio.rest.preview.marketplace.installed_add_on import InstalledAddOnList - - -class Marketplace(Version): - - def __init__(self, domain): - """ - Initialize the Marketplace version of Preview - - :returns: Marketplace version of Preview - :rtype: twilio.rest.preview.marketplace.Marketplace.Marketplace - """ - super(Marketplace, self).__init__(domain) - self.version = 'marketplace' - self._available_add_ons = None - self._installed_add_ons = None - - @property - def available_add_ons(self): - """ - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnList - """ - if self._available_add_ons is None: - self._available_add_ons = AvailableAddOnList(self) - return self._available_add_ons - - @property - def installed_add_ons(self): - """ - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnList - """ - if self._installed_add_ons is None: - self._installed_add_ons = InstalledAddOnList(self) - return self._installed_add_ons - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Marketplace>' diff --git a/twilio/rest/preview/marketplace/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/marketplace/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 34d3003..0000000 Binary files a/twilio/rest/preview/marketplace/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/marketplace/available_add_on/__init__.py b/twilio/rest/preview/marketplace/available_add_on/__init__.py deleted file mode 100644 index 0f42eb7..0000000 --- a/twilio/rest/preview/marketplace/available_add_on/__init__.py +++ /dev/null @@ -1,383 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page -from twilio.rest.preview.marketplace.available_add_on.available_add_on_extension import AvailableAddOnExtensionList - - -class AvailableAddOnList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the AvailableAddOnList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnList - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnList - """ - super(AvailableAddOnList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/AvailableAddOns'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AvailableAddOnInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AvailableAddOnInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AvailableAddOnInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AvailableAddOnPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AvailableAddOnInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AvailableAddOnPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AvailableAddOnContext - - :param sid: The unique Available Add-on Sid - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - """ - return AvailableAddOnContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AvailableAddOnContext - - :param sid: The unique Available Add-on Sid - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - """ - return AvailableAddOnContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Marketplace.AvailableAddOnList>' - - -class AvailableAddOnPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the AvailableAddOnPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnPage - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnPage - """ - super(AvailableAddOnPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AvailableAddOnInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance - """ - return AvailableAddOnInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Marketplace.AvailableAddOnPage>' - - -class AvailableAddOnContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the AvailableAddOnContext - - :param Version version: Version that contains the resource - :param sid: The unique Available Add-on Sid - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - """ - super(AvailableAddOnContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/AvailableAddOns/{sid}'.format(**self._solution) - - # Dependents - self._extensions = None - - def fetch(self): - """ - Fetch a AvailableAddOnInstance - - :returns: Fetched AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return AvailableAddOnInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def extensions(self): - """ - Access the extensions - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionList - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionList - """ - if self._extensions is None: - self._extensions = AvailableAddOnExtensionList( - self._version, - available_add_on_sid=self._solution['sid'], - ) - return self._extensions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Marketplace.AvailableAddOnContext {}>'.format(context) - - -class AvailableAddOnInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the AvailableAddOnInstance - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance - """ - super(AvailableAddOnInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'friendly_name': payload['friendly_name'], - 'description': payload['description'], - 'pricing_type': payload['pricing_type'], - 'configuration_schema': payload['configuration_schema'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AvailableAddOnContext for this AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - """ - if self._context is None: - self._context = AvailableAddOnContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Add-on - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: A description of this Add-on - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def description(self): - """ - :returns: A short description of the Add-on functionality - :rtype: unicode - """ - return self._properties['description'] - - @property - def pricing_type(self): - """ - :returns: The way customers are charged for using this Add-on - :rtype: unicode - """ - return self._properties['pricing_type'] - - @property - def configuration_schema(self): - """ - :returns: The JSON Schema describing the Add-on's configuration - :rtype: dict - """ - return self._properties['configuration_schema'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a AvailableAddOnInstance - - :returns: Fetched AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance - """ - return self._proxy.fetch() - - @property - def extensions(self): - """ - Access the extensions - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionList - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionList - """ - return self._proxy.extensions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Marketplace.AvailableAddOnInstance {}>'.format(context) diff --git a/twilio/rest/preview/marketplace/available_add_on/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/marketplace/available_add_on/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index f219a7e..0000000 Binary files a/twilio/rest/preview/marketplace/available_add_on/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/marketplace/available_add_on/__pycache__/available_add_on_extension.cpython-36.pyc b/twilio/rest/preview/marketplace/available_add_on/__pycache__/available_add_on_extension.cpython-36.pyc deleted file mode 100644 index 951eba9..0000000 Binary files a/twilio/rest/preview/marketplace/available_add_on/__pycache__/available_add_on_extension.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py b/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py deleted file mode 100644 index d6848a2..0000000 --- a/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py +++ /dev/null @@ -1,372 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class AvailableAddOnExtensionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, available_add_on_sid): - """ - Initialize the AvailableAddOnExtensionList - - :param Version version: Version that contains the resource - :param available_add_on_sid: The available_add_on_sid - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionList - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionList - """ - super(AvailableAddOnExtensionList, self).__init__(version) - - # Path Solution - self._solution = {'available_add_on_sid': available_add_on_sid, } - self._uri = '/AvailableAddOns/{available_add_on_sid}/Extensions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AvailableAddOnExtensionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AvailableAddOnExtensionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AvailableAddOnExtensionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return AvailableAddOnExtensionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AvailableAddOnExtensionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AvailableAddOnExtensionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AvailableAddOnExtensionContext - - :param sid: The unique Extension Sid - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - """ - return AvailableAddOnExtensionContext( - self._version, - available_add_on_sid=self._solution['available_add_on_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a AvailableAddOnExtensionContext - - :param sid: The unique Extension Sid - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - """ - return AvailableAddOnExtensionContext( - self._version, - available_add_on_sid=self._solution['available_add_on_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Marketplace.AvailableAddOnExtensionList>' - - -class AvailableAddOnExtensionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the AvailableAddOnExtensionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param available_add_on_sid: The available_add_on_sid - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionPage - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionPage - """ - super(AvailableAddOnExtensionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AvailableAddOnExtensionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance - """ - return AvailableAddOnExtensionInstance( - self._version, - payload, - available_add_on_sid=self._solution['available_add_on_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Marketplace.AvailableAddOnExtensionPage>' - - -class AvailableAddOnExtensionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, available_add_on_sid, sid): - """ - Initialize the AvailableAddOnExtensionContext - - :param Version version: Version that contains the resource - :param available_add_on_sid: The available_add_on_sid - :param sid: The unique Extension Sid - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - """ - super(AvailableAddOnExtensionContext, self).__init__(version) - - # Path Solution - self._solution = {'available_add_on_sid': available_add_on_sid, 'sid': sid, } - self._uri = '/AvailableAddOns/{available_add_on_sid}/Extensions/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a AvailableAddOnExtensionInstance - - :returns: Fetched AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return AvailableAddOnExtensionInstance( - self._version, - payload, - available_add_on_sid=self._solution['available_add_on_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Marketplace.AvailableAddOnExtensionContext {}>'.format(context) - - -class AvailableAddOnExtensionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, available_add_on_sid, sid=None): - """ - Initialize the AvailableAddOnExtensionInstance - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance - """ - super(AvailableAddOnExtensionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'available_add_on_sid': payload['available_add_on_sid'], - 'friendly_name': payload['friendly_name'], - 'product_name': payload['product_name'], - 'unique_name': payload['unique_name'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'available_add_on_sid': available_add_on_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AvailableAddOnExtensionContext for this AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - """ - if self._context is None: - self._context = AvailableAddOnExtensionContext( - self._version, - available_add_on_sid=self._solution['available_add_on_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Extension - :rtype: unicode - """ - return self._properties['sid'] - - @property - def available_add_on_sid(self): - """ - :returns: The available_add_on_sid - :rtype: unicode - """ - return self._properties['available_add_on_sid'] - - @property - def friendly_name(self): - """ - :returns: A human-readable description of this Extension - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def product_name(self): - """ - :returns: A human-readable description of the Extension's Product - :rtype: unicode - """ - return self._properties['product_name'] - - @property - def unique_name(self): - """ - :returns: The string that uniquely identifies this Extension - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a AvailableAddOnExtensionInstance - - :returns: Fetched AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Marketplace.AvailableAddOnExtensionInstance {}>'.format(context) diff --git a/twilio/rest/preview/marketplace/installed_add_on/__init__.py b/twilio/rest/preview/marketplace/installed_add_on/__init__.py deleted file mode 100644 index 7ff1659..0000000 --- a/twilio/rest/preview/marketplace/installed_add_on/__init__.py +++ /dev/null @@ -1,490 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension import InstalledAddOnExtensionList - - -class InstalledAddOnList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the InstalledAddOnList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnList - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnList - """ - super(InstalledAddOnList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/InstalledAddOns'.format(**self._solution) - - def create(self, available_add_on_sid, accept_terms_of_service, - configuration=values.unset, unique_name=values.unset): - """ - Create a new InstalledAddOnInstance - - :param unicode available_add_on_sid: A string that uniquely identifies the Add-on to install - :param bool accept_terms_of_service: A boolean reflecting your acceptance of the Terms of Service - :param dict configuration: The JSON object representing the configuration - :param unicode unique_name: The string that uniquely identifies this Add-on installation - - :returns: Newly created InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - """ - data = values.of({ - 'AvailableAddOnSid': available_add_on_sid, - 'AcceptTermsOfService': accept_terms_of_service, - 'Configuration': serialize.object(configuration), - 'UniqueName': unique_name, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return InstalledAddOnInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams InstalledAddOnInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists InstalledAddOnInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of InstalledAddOnInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return InstalledAddOnPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of InstalledAddOnInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InstalledAddOnPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InstalledAddOnContext - - :param sid: The unique Installed Add-on Sid - - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - """ - return InstalledAddOnContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a InstalledAddOnContext - - :param sid: The unique Installed Add-on Sid - - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - """ - return InstalledAddOnContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Marketplace.InstalledAddOnList>' - - -class InstalledAddOnPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the InstalledAddOnPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnPage - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnPage - """ - super(InstalledAddOnPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InstalledAddOnInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - """ - return InstalledAddOnInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Marketplace.InstalledAddOnPage>' - - -class InstalledAddOnContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the InstalledAddOnContext - - :param Version version: Version that contains the resource - :param sid: The unique Installed Add-on Sid - - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - """ - super(InstalledAddOnContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/InstalledAddOns/{sid}'.format(**self._solution) - - # Dependents - self._extensions = None - - def delete(self): - """ - Deletes the InstalledAddOnInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a InstalledAddOnInstance - - :returns: Fetched InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return InstalledAddOnInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, configuration=values.unset, unique_name=values.unset): - """ - Update the InstalledAddOnInstance - - :param dict configuration: The JSON object representing the configuration - :param unicode unique_name: The string that uniquely identifies this Add-on installation - - :returns: Updated InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - """ - data = values.of({'Configuration': serialize.object(configuration), 'UniqueName': unique_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return InstalledAddOnInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def extensions(self): - """ - Access the extensions - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionList - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionList - """ - if self._extensions is None: - self._extensions = InstalledAddOnExtensionList( - self._version, - installed_add_on_sid=self._solution['sid'], - ) - return self._extensions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Marketplace.InstalledAddOnContext {}>'.format(context) - - -class InstalledAddOnInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the InstalledAddOnInstance - - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - """ - super(InstalledAddOnInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'description': payload['description'], - 'configuration': payload['configuration'], - 'unique_name': payload['unique_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InstalledAddOnContext for this InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - """ - if self._context is None: - self._context = InstalledAddOnContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Add-on installation - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The Account id that has installed this Add-on - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: A description of this Add-on installation - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def description(self): - """ - :returns: A short description of the Add-on functionality - :rtype: unicode - """ - return self._properties['description'] - - @property - def configuration(self): - """ - :returns: The JSON object representing the current configuration - :rtype: dict - """ - return self._properties['configuration'] - - @property - def unique_name(self): - """ - :returns: The string that uniquely identifies this Add-on installation - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def date_created(self): - """ - :returns: The date this Add-on installation was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Add-on installation was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def delete(self): - """ - Deletes the InstalledAddOnInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a InstalledAddOnInstance - - :returns: Fetched InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - """ - return self._proxy.fetch() - - def update(self, configuration=values.unset, unique_name=values.unset): - """ - Update the InstalledAddOnInstance - - :param dict configuration: The JSON object representing the configuration - :param unicode unique_name: The string that uniquely identifies this Add-on installation - - :returns: Updated InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - """ - return self._proxy.update(configuration=configuration, unique_name=unique_name, ) - - @property - def extensions(self): - """ - Access the extensions - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionList - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionList - """ - return self._proxy.extensions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Marketplace.InstalledAddOnInstance {}>'.format(context) diff --git a/twilio/rest/preview/marketplace/installed_add_on/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/marketplace/installed_add_on/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 7a00581..0000000 Binary files a/twilio/rest/preview/marketplace/installed_add_on/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/marketplace/installed_add_on/__pycache__/installed_add_on_extension.cpython-36.pyc b/twilio/rest/preview/marketplace/installed_add_on/__pycache__/installed_add_on_extension.cpython-36.pyc deleted file mode 100644 index 6bfb209..0000000 Binary files a/twilio/rest/preview/marketplace/installed_add_on/__pycache__/installed_add_on_extension.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py b/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py deleted file mode 100644 index c118f33..0000000 --- a/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py +++ /dev/null @@ -1,416 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class InstalledAddOnExtensionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, installed_add_on_sid): - """ - Initialize the InstalledAddOnExtensionList - - :param Version version: Version that contains the resource - :param installed_add_on_sid: The installed_add_on_sid - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionList - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionList - """ - super(InstalledAddOnExtensionList, self).__init__(version) - - # Path Solution - self._solution = {'installed_add_on_sid': installed_add_on_sid, } - self._uri = '/InstalledAddOns/{installed_add_on_sid}/Extensions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams InstalledAddOnExtensionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists InstalledAddOnExtensionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of InstalledAddOnExtensionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return InstalledAddOnExtensionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of InstalledAddOnExtensionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InstalledAddOnExtensionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InstalledAddOnExtensionContext - - :param sid: The unique Extension Sid - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - """ - return InstalledAddOnExtensionContext( - self._version, - installed_add_on_sid=self._solution['installed_add_on_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a InstalledAddOnExtensionContext - - :param sid: The unique Extension Sid - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - """ - return InstalledAddOnExtensionContext( - self._version, - installed_add_on_sid=self._solution['installed_add_on_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Marketplace.InstalledAddOnExtensionList>' - - -class InstalledAddOnExtensionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the InstalledAddOnExtensionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param installed_add_on_sid: The installed_add_on_sid - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionPage - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionPage - """ - super(InstalledAddOnExtensionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InstalledAddOnExtensionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - """ - return InstalledAddOnExtensionInstance( - self._version, - payload, - installed_add_on_sid=self._solution['installed_add_on_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Marketplace.InstalledAddOnExtensionPage>' - - -class InstalledAddOnExtensionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, installed_add_on_sid, sid): - """ - Initialize the InstalledAddOnExtensionContext - - :param Version version: Version that contains the resource - :param installed_add_on_sid: The installed_add_on_sid - :param sid: The unique Extension Sid - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - """ - super(InstalledAddOnExtensionContext, self).__init__(version) - - # Path Solution - self._solution = {'installed_add_on_sid': installed_add_on_sid, 'sid': sid, } - self._uri = '/InstalledAddOns/{installed_add_on_sid}/Extensions/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a InstalledAddOnExtensionInstance - - :returns: Fetched InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return InstalledAddOnExtensionInstance( - self._version, - payload, - installed_add_on_sid=self._solution['installed_add_on_sid'], - sid=self._solution['sid'], - ) - - def update(self, enabled): - """ - Update the InstalledAddOnExtensionInstance - - :param bool enabled: A Boolean indicating if the Extension will be invoked - - :returns: Updated InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - """ - data = values.of({'Enabled': enabled, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return InstalledAddOnExtensionInstance( - self._version, - payload, - installed_add_on_sid=self._solution['installed_add_on_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Marketplace.InstalledAddOnExtensionContext {}>'.format(context) - - -class InstalledAddOnExtensionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, installed_add_on_sid, sid=None): - """ - Initialize the InstalledAddOnExtensionInstance - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - """ - super(InstalledAddOnExtensionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'installed_add_on_sid': payload['installed_add_on_sid'], - 'friendly_name': payload['friendly_name'], - 'product_name': payload['product_name'], - 'unique_name': payload['unique_name'], - 'enabled': payload['enabled'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'installed_add_on_sid': installed_add_on_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InstalledAddOnExtensionContext for this InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - """ - if self._context is None: - self._context = InstalledAddOnExtensionContext( - self._version, - installed_add_on_sid=self._solution['installed_add_on_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Extension - :rtype: unicode - """ - return self._properties['sid'] - - @property - def installed_add_on_sid(self): - """ - :returns: The installed_add_on_sid - :rtype: unicode - """ - return self._properties['installed_add_on_sid'] - - @property - def friendly_name(self): - """ - :returns: A human-readable description of this Extension - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def product_name(self): - """ - :returns: A human-readable description of the Extension's Product - :rtype: unicode - """ - return self._properties['product_name'] - - @property - def unique_name(self): - """ - :returns: The string that uniquely identifies this Extension - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def enabled(self): - """ - :returns: A Boolean indicating if the Extension will be invoked - :rtype: bool - """ - return self._properties['enabled'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a InstalledAddOnExtensionInstance - - :returns: Fetched InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - """ - return self._proxy.fetch() - - def update(self, enabled): - """ - Update the InstalledAddOnExtensionInstance - - :param bool enabled: A Boolean indicating if the Extension will be invoked - - :returns: Updated InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - """ - return self._proxy.update(enabled, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Marketplace.InstalledAddOnExtensionInstance {}>'.format(context) diff --git a/twilio/rest/preview/proxy/__init__.py b/twilio/rest/preview/proxy/__init__.py deleted file mode 100644 index e9e6ce7..0000000 --- a/twilio/rest/preview/proxy/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.preview.proxy.service import ServiceList - - -class Proxy(Version): - - def __init__(self, domain): - """ - Initialize the Proxy version of Preview - - :returns: Proxy version of Preview - :rtype: twilio.rest.preview.proxy.Proxy.Proxy - """ - super(Proxy, self).__init__(domain) - self.version = 'Proxy' - self._services = None - - @property - def services(self): - """ - :rtype: twilio.rest.preview.proxy.service.ServiceList - """ - if self._services is None: - self._services = ServiceList(self) - return self._services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy>' diff --git a/twilio/rest/preview/proxy/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/proxy/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 527ebc8..0000000 Binary files a/twilio/rest/preview/proxy/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/proxy/service/__init__.py b/twilio/rest/preview/proxy/service/__init__.py deleted file mode 100644 index 8fe2556..0000000 --- a/twilio/rest/preview/proxy/service/__init__.py +++ /dev/null @@ -1,535 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.preview.proxy.service.phone_number import PhoneNumberList -from twilio.rest.preview.proxy.service.session import SessionList -from twilio.rest.preview.proxy.service.short_code import ShortCodeList - - -class ServiceList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.proxy.service.ServiceList - :rtype: twilio.rest.preview.proxy.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.preview.proxy.service.ServicePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.preview.proxy.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def create(self, friendly_name=values.unset, auto_create=values.unset, - callback_url=values.unset): - """ - Create a new ServiceInstance - - :param unicode friendly_name: A human readable description of this resource - :param bool auto_create: Boolean flag specifying whether to auto-create threads. - :param unicode callback_url: URL Twilio will request for callbacks. - - :returns: Newly created ServiceInstance - :rtype: twilio.rest.preview.proxy.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'AutoCreate': auto_create, - 'CallbackUrl': callback_url, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: A string that uniquely identifies this Service. - - :returns: twilio.rest.preview.proxy.service.ServiceContext - :rtype: twilio.rest.preview.proxy.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: A string that uniquely identifies this Service. - - :returns: twilio.rest.preview.proxy.service.ServiceContext - :rtype: twilio.rest.preview.proxy.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.ServiceList>' - - -class ServicePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.proxy.service.ServicePage - :rtype: twilio.rest.preview.proxy.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.proxy.service.ServiceInstance - :rtype: twilio.rest.preview.proxy.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.ServicePage>' - - -class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: A string that uniquely identifies this Service. - - :returns: twilio.rest.preview.proxy.service.ServiceContext - :rtype: twilio.rest.preview.proxy.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._sessions = None - self._phone_numbers = None - self._short_codes = None - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.preview.proxy.service.ServiceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, auto_create=values.unset, - callback_url=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: A human readable description of this resource - :param bool auto_create: Boolean flag specifying whether to auto-create threads. - :param unicode callback_url: URL Twilio will request for callbacks. - - :returns: Updated ServiceInstance - :rtype: twilio.rest.preview.proxy.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'AutoCreate': auto_create, - 'CallbackUrl': callback_url, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def sessions(self): - """ - Access the sessions - - :returns: twilio.rest.preview.proxy.service.session.SessionList - :rtype: twilio.rest.preview.proxy.service.session.SessionList - """ - if self._sessions is None: - self._sessions = SessionList(self._version, service_sid=self._solution['sid'], ) - return self._sessions - - @property - def phone_numbers(self): - """ - Access the phone_numbers - - :returns: twilio.rest.preview.proxy.service.phone_number.PhoneNumberList - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberList - """ - if self._phone_numbers is None: - self._phone_numbers = PhoneNumberList(self._version, service_sid=self._solution['sid'], ) - return self._phone_numbers - - @property - def short_codes(self): - """ - Access the short_codes - - :returns: twilio.rest.preview.proxy.service.short_code.ShortCodeList - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodeList - """ - if self._short_codes is None: - self._short_codes = ShortCodeList(self._version, service_sid=self._solution['sid'], ) - return self._short_codes - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.ServiceContext {}>'.format(context) - - -class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.preview.proxy.service.ServiceInstance - :rtype: twilio.rest.preview.proxy.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'friendly_name': payload['friendly_name'], - 'account_sid': payload['account_sid'], - 'auto_create': payload['auto_create'], - 'callback_url': payload['callback_url'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.preview.proxy.service.ServiceContext - """ - if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Service. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def auto_create(self): - """ - :returns: Boolean flag specifying whether to auto-create threads. - :rtype: bool - """ - return self._properties['auto_create'] - - @property - def callback_url(self): - """ - :returns: URL Twilio will request for callbacks. - :rtype: unicode - """ - return self._properties['callback_url'] - - @property - def date_created(self): - """ - :returns: The date this Service was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Service was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.preview.proxy.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, auto_create=values.unset, - callback_url=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: A human readable description of this resource - :param bool auto_create: Boolean flag specifying whether to auto-create threads. - :param unicode callback_url: URL Twilio will request for callbacks. - - :returns: Updated ServiceInstance - :rtype: twilio.rest.preview.proxy.service.ServiceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - auto_create=auto_create, - callback_url=callback_url, - ) - - @property - def sessions(self): - """ - Access the sessions - - :returns: twilio.rest.preview.proxy.service.session.SessionList - :rtype: twilio.rest.preview.proxy.service.session.SessionList - """ - return self._proxy.sessions - - @property - def phone_numbers(self): - """ - Access the phone_numbers - - :returns: twilio.rest.preview.proxy.service.phone_number.PhoneNumberList - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberList - """ - return self._proxy.phone_numbers - - @property - def short_codes(self): - """ - Access the short_codes - - :returns: twilio.rest.preview.proxy.service.short_code.ShortCodeList - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodeList - """ - return self._proxy.short_codes - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.ServiceInstance {}>'.format(context) diff --git a/twilio/rest/preview/proxy/service/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/proxy/service/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 5d94b5b..0000000 Binary files a/twilio/rest/preview/proxy/service/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/proxy/service/__pycache__/phone_number.cpython-36.pyc b/twilio/rest/preview/proxy/service/__pycache__/phone_number.cpython-36.pyc deleted file mode 100644 index a9fc40f..0000000 Binary files a/twilio/rest/preview/proxy/service/__pycache__/phone_number.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/proxy/service/__pycache__/short_code.cpython-36.pyc b/twilio/rest/preview/proxy/service/__pycache__/short_code.cpython-36.pyc deleted file mode 100644 index 5acc83b..0000000 Binary files a/twilio/rest/preview/proxy/service/__pycache__/short_code.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/proxy/service/phone_number.py b/twilio/rest/preview/proxy/service/phone_number.py deleted file mode 100644 index 0524e49..0000000 --- a/twilio/rest/preview/proxy/service/phone_number.py +++ /dev/null @@ -1,422 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class PhoneNumberList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the PhoneNumberList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - - :returns: twilio.rest.preview.proxy.service.phone_number.PhoneNumberList - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberList - """ - super(PhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/PhoneNumbers'.format(**self._solution) - - def create(self, sid): - """ - Create a new PhoneNumberInstance - - :param unicode sid: Delete by unique phone-number Sid - - :returns: Newly created PhoneNumberInstance - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberInstance - """ - data = values.of({'Sid': sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return PhoneNumberInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams PhoneNumberInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.phone_number.PhoneNumberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PhoneNumberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.phone_number.PhoneNumberInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PhoneNumberInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of PhoneNumberInstance - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return PhoneNumberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PhoneNumberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PhoneNumberInstance - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PhoneNumberPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a PhoneNumberContext - - :param sid: Fetch by unique phone-number Sid - - :returns: twilio.rest.preview.proxy.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a PhoneNumberContext - - :param sid: Fetch by unique phone-number Sid - - :returns: twilio.rest.preview.proxy.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.PhoneNumberList>' - - -class PhoneNumberPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the PhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - - :returns: twilio.rest.preview.proxy.service.phone_number.PhoneNumberPage - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberPage - """ - super(PhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.proxy.service.phone_number.PhoneNumberInstance - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberInstance - """ - return PhoneNumberInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.PhoneNumberPage>' - - -class PhoneNumberContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the PhoneNumberContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: Fetch by unique phone-number Sid - - :returns: twilio.rest.preview.proxy.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberContext - """ - super(PhoneNumberContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/PhoneNumbers/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the PhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a PhoneNumberInstance - - :returns: Fetched PhoneNumberInstance - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return PhoneNumberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.PhoneNumberContext {}>'.format(context) - - -class PhoneNumberInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the PhoneNumberInstance - - :returns: twilio.rest.preview.proxy.service.phone_number.PhoneNumberInstance - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberInstance - """ - super(PhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'phone_number': payload['phone_number'], - 'country_code': payload['country_code'], - 'capabilities': payload['capabilities'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PhoneNumberContext for this PhoneNumberInstance - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberContext - """ - if self._context is None: - self._context = PhoneNumberContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def phone_number(self): - """ - :returns: The phone number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def country_code(self): - """ - :returns: The ISO 3166-1 alpha-2 country code - :rtype: unicode - """ - return self._properties['country_code'] - - @property - def capabilities(self): - """ - :returns: Indicate if a phone can receive calls or messages - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - def delete(self): - """ - Deletes the PhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a PhoneNumberInstance - - :returns: Fetched PhoneNumberInstance - :rtype: twilio.rest.preview.proxy.service.phone_number.PhoneNumberInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.PhoneNumberInstance {}>'.format(context) diff --git a/twilio/rest/preview/proxy/service/session/__init__.py b/twilio/rest/preview/proxy/service/session/__init__.py deleted file mode 100644 index d8c05ff..0000000 --- a/twilio/rest/preview/proxy/service/session/__init__.py +++ /dev/null @@ -1,589 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.preview.proxy.service.session.interaction import InteractionList -from twilio.rest.preview.proxy.service.session.participant import ParticipantList - - -class SessionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the SessionList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - - :returns: twilio.rest.preview.proxy.service.session.SessionList - :rtype: twilio.rest.preview.proxy.service.session.SessionList - """ - super(SessionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Sessions'.format(**self._solution) - - def stream(self, unique_name=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Streams SessionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode unique_name: A unique, developer assigned name of this Session. - :param SessionInstance.Status status: The Status of this Session - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.session.SessionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(unique_name=unique_name, status=status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, unique_name=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Lists SessionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode unique_name: A unique, developer assigned name of this Session. - :param SessionInstance.Status status: The Status of this Session - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.session.SessionInstance] - """ - return list(self.stream(unique_name=unique_name, status=status, limit=limit, page_size=page_size, )) - - def page(self, unique_name=values.unset, status=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SessionInstance records from the API. - Request is executed immediately - - :param unicode unique_name: A unique, developer assigned name of this Session. - :param SessionInstance.Status status: The Status of this Session - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SessionInstance - :rtype: twilio.rest.preview.proxy.service.session.SessionPage - """ - params = values.of({ - 'UniqueName': unique_name, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SessionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SessionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SessionInstance - :rtype: twilio.rest.preview.proxy.service.session.SessionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SessionPage(self._version, response, self._solution) - - def create(self, unique_name=values.unset, ttl=values.unset, - status=values.unset, participants=values.unset): - """ - Create a new SessionInstance - - :param unicode unique_name: A unique, developer assigned name of this Session. - :param unicode ttl: How long will this session stay open, in seconds. - :param SessionInstance.Status status: The Status of this Session - :param unicode participants: The participants - - :returns: Newly created SessionInstance - :rtype: twilio.rest.preview.proxy.service.session.SessionInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'Ttl': ttl, - 'Status': status, - 'Participants': serialize.map(participants, lambda e: e), - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return SessionInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def get(self, sid): - """ - Constructs a SessionContext - - :param sid: A string that uniquely identifies this Session. - - :returns: twilio.rest.preview.proxy.service.session.SessionContext - :rtype: twilio.rest.preview.proxy.service.session.SessionContext - """ - return SessionContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SessionContext - - :param sid: A string that uniquely identifies this Session. - - :returns: twilio.rest.preview.proxy.service.session.SessionContext - :rtype: twilio.rest.preview.proxy.service.session.SessionContext - """ - return SessionContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.SessionList>' - - -class SessionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SessionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - - :returns: twilio.rest.preview.proxy.service.session.SessionPage - :rtype: twilio.rest.preview.proxy.service.session.SessionPage - """ - super(SessionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SessionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.proxy.service.session.SessionInstance - :rtype: twilio.rest.preview.proxy.service.session.SessionInstance - """ - return SessionInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.SessionPage>' - - -class SessionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the SessionContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param sid: A string that uniquely identifies this Session. - - :returns: twilio.rest.preview.proxy.service.session.SessionContext - :rtype: twilio.rest.preview.proxy.service.session.SessionContext - """ - super(SessionContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Sessions/{sid}'.format(**self._solution) - - # Dependents - self._interactions = None - self._participants = None - - def fetch(self): - """ - Fetch a SessionInstance - - :returns: Fetched SessionInstance - :rtype: twilio.rest.preview.proxy.service.session.SessionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SessionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the SessionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, unique_name=values.unset, ttl=values.unset, - status=values.unset, participants=values.unset): - """ - Update the SessionInstance - - :param unicode unique_name: A unique, developer assigned name of this Session. - :param unicode ttl: How long will this session stay open, in seconds. - :param SessionInstance.Status status: The Status of this Session - :param unicode participants: The participants - - :returns: Updated SessionInstance - :rtype: twilio.rest.preview.proxy.service.session.SessionInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'Ttl': ttl, - 'Status': status, - 'Participants': serialize.map(participants, lambda e: e), - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SessionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def interactions(self): - """ - Access the interactions - - :returns: twilio.rest.preview.proxy.service.session.interaction.InteractionList - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionList - """ - if self._interactions is None: - self._interactions = InteractionList( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['sid'], - ) - return self._interactions - - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.preview.proxy.service.session.participant.ParticipantList - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantList - """ - if self._participants is None: - self._participants = ParticipantList( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['sid'], - ) - return self._participants - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.SessionContext {}>'.format(context) - - -class SessionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - IN_PROGESS = "in-progess" - COMPLETED = "completed" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the SessionInstance - - :returns: twilio.rest.preview.proxy.service.session.SessionInstance - :rtype: twilio.rest.preview.proxy.service.session.SessionInstance - """ - super(SessionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'service_sid': payload['service_sid'], - 'account_sid': payload['account_sid'], - 'unique_name': payload['unique_name'], - 'ttl': deserialize.integer(payload['ttl']), - 'status': payload['status'], - 'start_time': deserialize.iso8601_datetime(payload['start_time']), - 'end_time': deserialize.iso8601_datetime(payload['end_time']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SessionContext for this SessionInstance - :rtype: twilio.rest.preview.proxy.service.session.SessionContext - """ - if self._context is None: - self._context = SessionContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Session. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def unique_name(self): - """ - :returns: A unique, developer assigned name of this Session. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def ttl(self): - """ - :returns: How long will this session stay open, in seconds. - :rtype: unicode - """ - return self._properties['ttl'] - - @property - def status(self): - """ - :returns: The Status of this Session - :rtype: SessionInstance.Status - """ - return self._properties['status'] - - @property - def start_time(self): - """ - :returns: The date this Session was started - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The date this Session was ended - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def date_created(self): - """ - :returns: The date this Session was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Session was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this Session. - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a SessionInstance - - :returns: Fetched SessionInstance - :rtype: twilio.rest.preview.proxy.service.session.SessionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SessionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, unique_name=values.unset, ttl=values.unset, - status=values.unset, participants=values.unset): - """ - Update the SessionInstance - - :param unicode unique_name: A unique, developer assigned name of this Session. - :param unicode ttl: How long will this session stay open, in seconds. - :param SessionInstance.Status status: The Status of this Session - :param unicode participants: The participants - - :returns: Updated SessionInstance - :rtype: twilio.rest.preview.proxy.service.session.SessionInstance - """ - return self._proxy.update( - unique_name=unique_name, - ttl=ttl, - status=status, - participants=participants, - ) - - @property - def interactions(self): - """ - Access the interactions - - :returns: twilio.rest.preview.proxy.service.session.interaction.InteractionList - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionList - """ - return self._proxy.interactions - - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.preview.proxy.service.session.participant.ParticipantList - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantList - """ - return self._proxy.participants - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.SessionInstance {}>'.format(context) diff --git a/twilio/rest/preview/proxy/service/session/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/proxy/service/session/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index c202505..0000000 Binary files a/twilio/rest/preview/proxy/service/session/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/proxy/service/session/__pycache__/interaction.cpython-36.pyc b/twilio/rest/preview/proxy/service/session/__pycache__/interaction.cpython-36.pyc deleted file mode 100644 index c581ccf..0000000 Binary files a/twilio/rest/preview/proxy/service/session/__pycache__/interaction.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/proxy/service/session/interaction.py b/twilio/rest/preview/proxy/service/session/interaction.py deleted file mode 100644 index 399082b..0000000 --- a/twilio/rest/preview/proxy/service/session/interaction.py +++ /dev/null @@ -1,537 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class InteractionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, session_sid): - """ - Initialize the InteractionList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param session_sid: Session Sid. - - :returns: twilio.rest.preview.proxy.service.session.interaction.InteractionList - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionList - """ - super(InteractionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'session_sid': session_sid, } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Interactions'.format(**self._solution) - - def stream(self, inbound_participant_status=values.unset, - outbound_participant_status=values.unset, limit=None, - page_size=None): - """ - Streams InteractionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param InteractionInstance.ResourceStatus inbound_participant_status: The Inbound Participant Status of this Interaction - :param InteractionInstance.ResourceStatus outbound_participant_status: The Outbound Participant Status of this Interaction - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.session.interaction.InteractionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - inbound_participant_status=inbound_participant_status, - outbound_participant_status=outbound_participant_status, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, inbound_participant_status=values.unset, - outbound_participant_status=values.unset, limit=None, page_size=None): - """ - Lists InteractionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param InteractionInstance.ResourceStatus inbound_participant_status: The Inbound Participant Status of this Interaction - :param InteractionInstance.ResourceStatus outbound_participant_status: The Outbound Participant Status of this Interaction - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.session.interaction.InteractionInstance] - """ - return list(self.stream( - inbound_participant_status=inbound_participant_status, - outbound_participant_status=outbound_participant_status, - limit=limit, - page_size=page_size, - )) - - def page(self, inbound_participant_status=values.unset, - outbound_participant_status=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of InteractionInstance records from the API. - Request is executed immediately - - :param InteractionInstance.ResourceStatus inbound_participant_status: The Inbound Participant Status of this Interaction - :param InteractionInstance.ResourceStatus outbound_participant_status: The Outbound Participant Status of this Interaction - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of InteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionPage - """ - params = values.of({ - 'InboundParticipantStatus': inbound_participant_status, - 'OutboundParticipantStatus': outbound_participant_status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return InteractionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of InteractionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of InteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InteractionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InteractionContext - - :param sid: A string that uniquely identifies this Interaction. - - :returns: twilio.rest.preview.proxy.service.session.interaction.InteractionContext - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionContext - """ - return InteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a InteractionContext - - :param sid: A string that uniquely identifies this Interaction. - - :returns: twilio.rest.preview.proxy.service.session.interaction.InteractionContext - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionContext - """ - return InteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.InteractionList>' - - -class InteractionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the InteractionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - :param session_sid: Session Sid. - - :returns: twilio.rest.preview.proxy.service.session.interaction.InteractionPage - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionPage - """ - super(InteractionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InteractionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.proxy.service.session.interaction.InteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionInstance - """ - return InteractionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.InteractionPage>' - - -class InteractionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, session_sid, sid): - """ - Initialize the InteractionContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param session_sid: Session Sid. - :param sid: A string that uniquely identifies this Interaction. - - :returns: twilio.rest.preview.proxy.service.session.interaction.InteractionContext - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionContext - """ - super(InteractionContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'session_sid': session_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Interactions/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a InteractionInstance - - :returns: Fetched InteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return InteractionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.InteractionContext {}>'.format(context) - - -class InteractionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - COMPLETED = "completed" - IN_PROGRESS = "in-progress" - FAILED = "failed" - - class ResourceStatus(object): - QUEUED = "queued" - SENDING = "sending" - SENT = "sent" - FAILED = "failed" - DELIVERED = "delivered" - UNDELIVERED = "undelivered" - - def __init__(self, version, payload, service_sid, session_sid, sid=None): - """ - Initialize the InteractionInstance - - :returns: twilio.rest.preview.proxy.service.session.interaction.InteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionInstance - """ - super(InteractionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'session_sid': payload['session_sid'], - 'service_sid': payload['service_sid'], - 'account_sid': payload['account_sid'], - 'data': payload['data'], - 'status': payload['status'], - 'inbound_participant_sid': payload['inbound_participant_sid'], - 'inbound_resource_sid': payload['inbound_resource_sid'], - 'inbound_resource_status': payload['inbound_resource_status'], - 'inbound_resource_type': payload['inbound_resource_type'], - 'inbound_resource_url': payload['inbound_resource_url'], - 'outbound_participant_sid': payload['outbound_participant_sid'], - 'outbound_resource_sid': payload['outbound_resource_sid'], - 'outbound_resource_status': payload['outbound_resource_status'], - 'outbound_resource_type': payload['outbound_resource_type'], - 'outbound_resource_url': payload['outbound_resource_url'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InteractionContext for this InteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionContext - """ - if self._context is None: - self._context = InteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Interaction. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def session_sid(self): - """ - :returns: Session Sid. - :rtype: unicode - """ - return self._properties['session_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def data(self): - """ - :returns: What happened in this Interaction. - :rtype: unicode - """ - return self._properties['data'] - - @property - def status(self): - """ - :returns: The Status of this Interaction - :rtype: InteractionInstance.Status - """ - return self._properties['status'] - - @property - def inbound_participant_sid(self): - """ - :returns: The inbound_participant_sid - :rtype: unicode - """ - return self._properties['inbound_participant_sid'] - - @property - def inbound_resource_sid(self): - """ - :returns: The SID of the inbound resource. - :rtype: unicode - """ - return self._properties['inbound_resource_sid'] - - @property - def inbound_resource_status(self): - """ - :returns: The Inbound Resource Status of this Interaction - :rtype: InteractionInstance.ResourceStatus - """ - return self._properties['inbound_resource_status'] - - @property - def inbound_resource_type(self): - """ - :returns: The Twilio object type of the inbound resource. - :rtype: unicode - """ - return self._properties['inbound_resource_type'] - - @property - def inbound_resource_url(self): - """ - :returns: The URL of the inbound resource. - :rtype: unicode - """ - return self._properties['inbound_resource_url'] - - @property - def outbound_participant_sid(self): - """ - :returns: The outbound_participant_sid - :rtype: unicode - """ - return self._properties['outbound_participant_sid'] - - @property - def outbound_resource_sid(self): - """ - :returns: The SID of the outbound resource. - :rtype: unicode - """ - return self._properties['outbound_resource_sid'] - - @property - def outbound_resource_status(self): - """ - :returns: The Outbound Resource Status of this Interaction - :rtype: InteractionInstance.ResourceStatus - """ - return self._properties['outbound_resource_status'] - - @property - def outbound_resource_type(self): - """ - :returns: The Twilio object type of the outbound resource. - :rtype: unicode - """ - return self._properties['outbound_resource_type'] - - @property - def outbound_resource_url(self): - """ - :returns: The URL of the outbound resource. - :rtype: unicode - """ - return self._properties['outbound_resource_url'] - - @property - def date_created(self): - """ - :returns: The date this Interaction was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Interaction was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this Interaction. - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a InteractionInstance - - :returns: Fetched InteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.interaction.InteractionInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.InteractionInstance {}>'.format(context) diff --git a/twilio/rest/preview/proxy/service/session/participant/__init__.py b/twilio/rest/preview/proxy/service/session/participant/__init__.py deleted file mode 100644 index 2f7df45..0000000 --- a/twilio/rest/preview/proxy/service/session/participant/__init__.py +++ /dev/null @@ -1,595 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.preview.proxy.service.session.participant.message_interaction import MessageInteractionList - - -class ParticipantList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, session_sid): - """ - Initialize the ParticipantList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param session_sid: Session Sid. - - :returns: twilio.rest.preview.proxy.service.session.participant.ParticipantList - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantList - """ - super(ParticipantList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'session_sid': session_sid, } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Participants'.format(**self._solution) - - def stream(self, identifier=values.unset, participant_type=values.unset, - limit=None, page_size=None): - """ - Streams ParticipantInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode identifier: The Participant's contact identifier, normally a phone number. - :param ParticipantInstance.ParticipantType participant_type: The Type of this Participant - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.session.participant.ParticipantInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - identifier=identifier, - participant_type=participant_type, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, identifier=values.unset, participant_type=values.unset, - limit=None, page_size=None): - """ - Lists ParticipantInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode identifier: The Participant's contact identifier, normally a phone number. - :param ParticipantInstance.ParticipantType participant_type: The Type of this Participant - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.session.participant.ParticipantInstance] - """ - return list(self.stream( - identifier=identifier, - participant_type=participant_type, - limit=limit, - page_size=page_size, - )) - - def page(self, identifier=values.unset, participant_type=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ParticipantInstance records from the API. - Request is executed immediately - - :param unicode identifier: The Participant's contact identifier, normally a phone number. - :param ParticipantInstance.ParticipantType participant_type: The Type of this Participant - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantPage - """ - params = values.of({ - 'Identifier': identifier, - 'ParticipantType': participant_type, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ParticipantPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ParticipantInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ParticipantPage(self._version, response, self._solution) - - def create(self, identifier, friendly_name=values.unset, - participant_type=values.unset): - """ - Create a new ParticipantInstance - - :param unicode identifier: The Participant's contact identifier, normally a phone number. - :param unicode friendly_name: A human readable description of this resource - :param ParticipantInstance.ParticipantType participant_type: The Type of this Participant - - :returns: Newly created ParticipantInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantInstance - """ - data = values.of({ - 'Identifier': identifier, - 'FriendlyName': friendly_name, - 'ParticipantType': participant_type, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ParticipantInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - ) - - def get(self, sid): - """ - Constructs a ParticipantContext - - :param sid: A string that uniquely identifies this Participant. - - :returns: twilio.rest.preview.proxy.service.session.participant.ParticipantContext - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a ParticipantContext - - :param sid: A string that uniquely identifies this Participant. - - :returns: twilio.rest.preview.proxy.service.session.participant.ParticipantContext - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.ParticipantList>' - - -class ParticipantPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ParticipantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - :param session_sid: Session Sid. - - :returns: twilio.rest.preview.proxy.service.session.participant.ParticipantPage - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantPage - """ - super(ParticipantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ParticipantInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.proxy.service.session.participant.ParticipantInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantInstance - """ - return ParticipantInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.ParticipantPage>' - - -class ParticipantContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, session_sid, sid): - """ - Initialize the ParticipantContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param session_sid: Session Sid. - :param sid: A string that uniquely identifies this Participant. - - :returns: twilio.rest.preview.proxy.service.session.participant.ParticipantContext - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantContext - """ - super(ParticipantContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'session_sid': session_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Participants/{sid}'.format(**self._solution) - - # Dependents - self._message_interactions = None - - def fetch(self): - """ - Fetch a ParticipantInstance - - :returns: Fetched ParticipantInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ParticipantInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the ParticipantInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, participant_type=values.unset, identifier=values.unset, - friendly_name=values.unset): - """ - Update the ParticipantInstance - - :param ParticipantInstance.ParticipantType participant_type: The Type of this Participant - :param unicode identifier: The Participant's contact identifier, normally a phone number. - :param unicode friendly_name: A human readable description of this resource - - :returns: Updated ParticipantInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantInstance - """ - data = values.of({ - 'ParticipantType': participant_type, - 'Identifier': identifier, - 'FriendlyName': friendly_name, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ParticipantInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], - ) - - @property - def message_interactions(self): - """ - Access the message_interactions - - :returns: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionList - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionList - """ - if self._message_interactions is None: - self._message_interactions = MessageInteractionList( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['sid'], - ) - return self._message_interactions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.ParticipantContext {}>'.format(context) - - -class ParticipantInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class ParticipantType(object): - SMS = "sms" - VOICE = "voice" - PHONE = "phone" - - def __init__(self, version, payload, service_sid, session_sid, sid=None): - """ - Initialize the ParticipantInstance - - :returns: twilio.rest.preview.proxy.service.session.participant.ParticipantInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantInstance - """ - super(ParticipantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'session_sid': payload['session_sid'], - 'service_sid': payload['service_sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'participant_type': payload['participant_type'], - 'identifier': payload['identifier'], - 'proxy_identifier': payload['proxy_identifier'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ParticipantContext for this ParticipantInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantContext - """ - if self._context is None: - self._context = ParticipantContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Participant. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def session_sid(self): - """ - :returns: Session Sid. - :rtype: unicode - """ - return self._properties['session_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def participant_type(self): - """ - :returns: The Type of this Participant - :rtype: ParticipantInstance.ParticipantType - """ - return self._properties['participant_type'] - - @property - def identifier(self): - """ - :returns: The Participant's contact identifier, normally a phone number. - :rtype: unicode - """ - return self._properties['identifier'] - - @property - def proxy_identifier(self): - """ - :returns: What this Participant communicates with, normally a phone number. - :rtype: unicode - """ - return self._properties['proxy_identifier'] - - @property - def date_created(self): - """ - :returns: The date this Participant was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Participant was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ParticipantInstance - - :returns: Fetched ParticipantInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ParticipantInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, participant_type=values.unset, identifier=values.unset, - friendly_name=values.unset): - """ - Update the ParticipantInstance - - :param ParticipantInstance.ParticipantType participant_type: The Type of this Participant - :param unicode identifier: The Participant's contact identifier, normally a phone number. - :param unicode friendly_name: A human readable description of this resource - - :returns: Updated ParticipantInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.ParticipantInstance - """ - return self._proxy.update( - participant_type=participant_type, - identifier=identifier, - friendly_name=friendly_name, - ) - - @property - def message_interactions(self): - """ - Access the message_interactions - - :returns: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionList - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionList - """ - return self._proxy.message_interactions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.ParticipantInstance {}>'.format(context) diff --git a/twilio/rest/preview/proxy/service/session/participant/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/proxy/service/session/participant/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index c436a31..0000000 Binary files a/twilio/rest/preview/proxy/service/session/participant/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/proxy/service/session/participant/__pycache__/message_interaction.cpython-36.pyc b/twilio/rest/preview/proxy/service/session/participant/__pycache__/message_interaction.cpython-36.pyc deleted file mode 100644 index 783d9dc..0000000 Binary files a/twilio/rest/preview/proxy/service/session/participant/__pycache__/message_interaction.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/proxy/service/session/participant/message_interaction.py b/twilio/rest/preview/proxy/service/session/participant/message_interaction.py deleted file mode 100644 index 8e063e4..0000000 --- a/twilio/rest/preview/proxy/service/session/participant/message_interaction.py +++ /dev/null @@ -1,567 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class MessageInteractionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, session_sid, participant_sid): - """ - Initialize the MessageInteractionList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param session_sid: Session Sid. - :param participant_sid: The participant_sid - - :returns: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionList - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionList - """ - super(MessageInteractionList, self).__init__(version) - - # Path Solution - self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'participant_sid': participant_sid, - } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Participants/{participant_sid}/MessageInteractions'.format(**self._solution) - - def create(self, body=values.unset, media_url=values.unset): - """ - Create a new MessageInteractionInstance - - :param unicode body: The body of the message. Up to 1600 characters long. - :param unicode media_url: The url of an image or video. - - :returns: Newly created MessageInteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionInstance - """ - data = values.of({'Body': body, 'MediaUrl': serialize.map(media_url, lambda e: e), }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return MessageInteractionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams MessageInteractionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists MessageInteractionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of MessageInteractionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MessageInteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MessageInteractionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessageInteractionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MessageInteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessageInteractionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MessageInteractionContext - - :param sid: A string that uniquely identifies this Interaction. - - :returns: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionContext - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionContext - """ - return MessageInteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MessageInteractionContext - - :param sid: A string that uniquely identifies this Interaction. - - :returns: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionContext - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionContext - """ - return MessageInteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.MessageInteractionList>' - - -class MessageInteractionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the MessageInteractionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - :param session_sid: Session Sid. - :param participant_sid: The participant_sid - - :returns: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionPage - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionPage - """ - super(MessageInteractionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessageInteractionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionInstance - """ - return MessageInteractionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.MessageInteractionPage>' - - -class MessageInteractionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, session_sid, participant_sid, sid): - """ - Initialize the MessageInteractionContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param session_sid: Session Sid. - :param participant_sid: Participant Sid. - :param sid: A string that uniquely identifies this Interaction. - - :returns: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionContext - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionContext - """ - super(MessageInteractionContext, self).__init__(version) - - # Path Solution - self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'participant_sid': participant_sid, - 'sid': sid, - } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Participants/{participant_sid}/MessageInteractions/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a MessageInteractionInstance - - :returns: Fetched MessageInteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return MessageInteractionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.MessageInteractionContext {}>'.format(context) - - -class MessageInteractionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - COMPLETED = "completed" - IN_PROGRESS = "in-progress" - FAILED = "failed" - - class ResourceStatus(object): - QUEUED = "queued" - SENDING = "sending" - SENT = "sent" - FAILED = "failed" - DELIVERED = "delivered" - UNDELIVERED = "undelivered" - - def __init__(self, version, payload, service_sid, session_sid, participant_sid, - sid=None): - """ - Initialize the MessageInteractionInstance - - :returns: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionInstance - """ - super(MessageInteractionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'session_sid': payload['session_sid'], - 'service_sid': payload['service_sid'], - 'account_sid': payload['account_sid'], - 'data': payload['data'], - 'status': payload['status'], - 'participant_sid': payload['participant_sid'], - 'inbound_participant_sid': payload['inbound_participant_sid'], - 'inbound_resource_sid': payload['inbound_resource_sid'], - 'inbound_resource_status': payload['inbound_resource_status'], - 'inbound_resource_type': payload['inbound_resource_type'], - 'inbound_resource_url': payload['inbound_resource_url'], - 'outbound_participant_sid': payload['outbound_participant_sid'], - 'outbound_resource_sid': payload['outbound_resource_sid'], - 'outbound_resource_status': payload['outbound_resource_status'], - 'outbound_resource_type': payload['outbound_resource_type'], - 'outbound_resource_url': payload['outbound_resource_url'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'participant_sid': participant_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessageInteractionContext for this MessageInteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionContext - """ - if self._context is None: - self._context = MessageInteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Interaction. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def session_sid(self): - """ - :returns: Session Sid. - :rtype: unicode - """ - return self._properties['session_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def data(self): - """ - :returns: What happened in this Interaction. - :rtype: unicode - """ - return self._properties['data'] - - @property - def status(self): - """ - :returns: The Status of this Interaction - :rtype: MessageInteractionInstance.Status - """ - return self._properties['status'] - - @property - def participant_sid(self): - """ - :returns: The participant_sid - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def inbound_participant_sid(self): - """ - :returns: The inbound_participant_sid - :rtype: unicode - """ - return self._properties['inbound_participant_sid'] - - @property - def inbound_resource_sid(self): - """ - :returns: The SID of the inbound resource. - :rtype: unicode - """ - return self._properties['inbound_resource_sid'] - - @property - def inbound_resource_status(self): - """ - :returns: The Inbound Resource Status of this Interaction - :rtype: MessageInteractionInstance.ResourceStatus - """ - return self._properties['inbound_resource_status'] - - @property - def inbound_resource_type(self): - """ - :returns: The Twilio object type of the inbound resource. - :rtype: unicode - """ - return self._properties['inbound_resource_type'] - - @property - def inbound_resource_url(self): - """ - :returns: The URL of the inbound resource. - :rtype: unicode - """ - return self._properties['inbound_resource_url'] - - @property - def outbound_participant_sid(self): - """ - :returns: The outbound_participant_sid - :rtype: unicode - """ - return self._properties['outbound_participant_sid'] - - @property - def outbound_resource_sid(self): - """ - :returns: The SID of the outbound resource. - :rtype: unicode - """ - return self._properties['outbound_resource_sid'] - - @property - def outbound_resource_status(self): - """ - :returns: The Outbound Resource Status of this Interaction - :rtype: MessageInteractionInstance.ResourceStatus - """ - return self._properties['outbound_resource_status'] - - @property - def outbound_resource_type(self): - """ - :returns: The Twilio object type of the outbound resource. - :rtype: unicode - """ - return self._properties['outbound_resource_type'] - - @property - def outbound_resource_url(self): - """ - :returns: The URL of the outbound resource. - :rtype: unicode - """ - return self._properties['outbound_resource_url'] - - @property - def date_created(self): - """ - :returns: The date this Interaction was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Interaction was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this Interaction. - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a MessageInteractionInstance - - :returns: Fetched MessageInteractionInstance - :rtype: twilio.rest.preview.proxy.service.session.participant.message_interaction.MessageInteractionInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.MessageInteractionInstance {}>'.format(context) diff --git a/twilio/rest/preview/proxy/service/short_code.py b/twilio/rest/preview/proxy/service/short_code.py deleted file mode 100644 index a0488a0..0000000 --- a/twilio/rest/preview/proxy/service/short_code.py +++ /dev/null @@ -1,422 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class ShortCodeList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the ShortCodeList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - - :returns: twilio.rest.preview.proxy.service.short_code.ShortCodeList - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodeList - """ - super(ShortCodeList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/ShortCodes'.format(**self._solution) - - def create(self, sid): - """ - Create a new ShortCodeInstance - - :param unicode sid: Delete by unique shortcode Sid - - :returns: Newly created ShortCodeInstance - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodeInstance - """ - data = values.of({'Sid': sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams ShortCodeInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.short_code.ShortCodeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ShortCodeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.proxy.service.short_code.ShortCodeInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ShortCodeInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ShortCodeInstance - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ShortCodePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ShortCodeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ShortCodeInstance - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ShortCodePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ShortCodeContext - - :param sid: Fetch by unique shortcode Sid - - :returns: twilio.rest.preview.proxy.service.short_code.ShortCodeContext - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ShortCodeContext - - :param sid: Fetch by unique shortcode Sid - - :returns: twilio.rest.preview.proxy.service.short_code.ShortCodeContext - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.ShortCodeList>' - - -class ShortCodePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ShortCodePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - - :returns: twilio.rest.preview.proxy.service.short_code.ShortCodePage - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodePage - """ - super(ShortCodePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ShortCodeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.proxy.service.short_code.ShortCodeInstance - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodeInstance - """ - return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Proxy.ShortCodePage>' - - -class ShortCodeContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the ShortCodeContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: Fetch by unique shortcode Sid - - :returns: twilio.rest.preview.proxy.service.short_code.ShortCodeContext - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodeContext - """ - super(ShortCodeContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/ShortCodes/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the ShortCodeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a ShortCodeInstance - - :returns: Fetched ShortCodeInstance - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodeInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ShortCodeInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.ShortCodeContext {}>'.format(context) - - -class ShortCodeInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ShortCodeInstance - - :returns: twilio.rest.preview.proxy.service.short_code.ShortCodeInstance - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodeInstance - """ - super(ShortCodeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'short_code': payload['short_code'], - 'country_code': payload['country_code'], - 'capabilities': payload['capabilities'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ShortCodeContext for this ShortCodeInstance - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodeContext - """ - if self._context is None: - self._context = ShortCodeContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def short_code(self): - """ - :returns: The short code. e.g., 894546. - :rtype: unicode - """ - return self._properties['short_code'] - - @property - def country_code(self): - """ - :returns: The ISO 3166-1 alpha-2 country code - :rtype: unicode - """ - return self._properties['country_code'] - - @property - def capabilities(self): - """ - :returns: Indicate if a shortcode can receive messages - :rtype: dict - """ - return self._properties['capabilities'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - def delete(self): - """ - Deletes the ShortCodeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a ShortCodeInstance - - :returns: Fetched ShortCodeInstance - :rtype: twilio.rest.preview.proxy.service.short_code.ShortCodeInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Proxy.ShortCodeInstance {}>'.format(context) diff --git a/twilio/rest/preview/studio/__init__.py b/twilio/rest/preview/studio/__init__.py deleted file mode 100644 index 1c4898c..0000000 --- a/twilio/rest/preview/studio/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.preview.studio.flow import FlowList - - -class Studio(Version): - - def __init__(self, domain): - """ - Initialize the Studio version of Preview - - :returns: Studio version of Preview - :rtype: twilio.rest.preview.studio.Studio.Studio - """ - super(Studio, self).__init__(domain) - self.version = 'Studio' - self._flows = None - - @property - def flows(self): - """ - :rtype: twilio.rest.preview.studio.flow.FlowList - """ - if self._flows is None: - self._flows = FlowList(self) - return self._flows - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Studio>' diff --git a/twilio/rest/preview/studio/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/studio/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index a3259fe..0000000 Binary files a/twilio/rest/preview/studio/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/studio/flow/__init__.py b/twilio/rest/preview/studio/flow/__init__.py deleted file mode 100644 index b564032..0000000 --- a/twilio/rest/preview/studio/flow/__init__.py +++ /dev/null @@ -1,430 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.preview.studio.flow.engagement import EngagementList - - -class FlowList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the FlowList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.studio.flow.FlowList - :rtype: twilio.rest.preview.studio.flow.FlowList - """ - super(FlowList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Flows'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FlowInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.studio.flow.FlowInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FlowInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.studio.flow.FlowInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FlowInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FlowInstance - :rtype: twilio.rest.preview.studio.flow.FlowPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return FlowPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FlowInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FlowInstance - :rtype: twilio.rest.preview.studio.flow.FlowPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FlowPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a FlowContext - - :param sid: The sid - - :returns: twilio.rest.preview.studio.flow.FlowContext - :rtype: twilio.rest.preview.studio.flow.FlowContext - """ - return FlowContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FlowContext - - :param sid: The sid - - :returns: twilio.rest.preview.studio.flow.FlowContext - :rtype: twilio.rest.preview.studio.flow.FlowContext - """ - return FlowContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Studio.FlowList>' - - -class FlowPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the FlowPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.studio.flow.FlowPage - :rtype: twilio.rest.preview.studio.flow.FlowPage - """ - super(FlowPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FlowInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.studio.flow.FlowInstance - :rtype: twilio.rest.preview.studio.flow.FlowInstance - """ - return FlowInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Studio.FlowPage>' - - -class FlowContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the FlowContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.preview.studio.flow.FlowContext - :rtype: twilio.rest.preview.studio.flow.FlowContext - """ - super(FlowContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Flows/{sid}'.format(**self._solution) - - # Dependents - self._engagements = None - - def fetch(self): - """ - Fetch a FlowInstance - - :returns: Fetched FlowInstance - :rtype: twilio.rest.preview.studio.flow.FlowInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return FlowInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the FlowInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def engagements(self): - """ - Access the engagements - - :returns: twilio.rest.preview.studio.flow.engagement.EngagementList - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementList - """ - if self._engagements is None: - self._engagements = EngagementList(self._version, flow_sid=self._solution['sid'], ) - return self._engagements - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Studio.FlowContext {}>'.format(context) - - -class FlowInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - DRAFT = "draft" - PUBLISHED = "published" - - def __init__(self, version, payload, sid=None): - """ - Initialize the FlowInstance - - :returns: twilio.rest.preview.studio.flow.FlowInstance - :rtype: twilio.rest.preview.studio.flow.FlowInstance - """ - super(FlowInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'status': payload['status'], - 'debug': payload['debug'], - 'version': deserialize.integer(payload['version']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FlowContext for this FlowInstance - :rtype: twilio.rest.preview.studio.flow.FlowContext - """ - if self._context is None: - self._context = FlowContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Flow. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def status(self): - """ - :returns: The Status of this Flow - :rtype: FlowInstance.Status - """ - return self._properties['status'] - - @property - def debug(self): - """ - :returns: Toggle extra logging. - :rtype: bool - """ - return self._properties['debug'] - - @property - def version(self): - """ - :returns: The latest version number of this Flow's definition. - :rtype: unicode - """ - return self._properties['version'] - - @property - def date_created(self): - """ - :returns: The date this Flow was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Flow was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a FlowInstance - - :returns: Fetched FlowInstance - :rtype: twilio.rest.preview.studio.flow.FlowInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the FlowInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def engagements(self): - """ - Access the engagements - - :returns: twilio.rest.preview.studio.flow.engagement.EngagementList - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementList - """ - return self._proxy.engagements - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Studio.FlowInstance {}>'.format(context) diff --git a/twilio/rest/preview/studio/flow/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/studio/flow/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 99c4218..0000000 Binary files a/twilio/rest/preview/studio/flow/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/studio/flow/engagement/__init__.py b/twilio/rest/preview/studio/flow/engagement/__init__.py deleted file mode 100644 index be08319..0000000 --- a/twilio/rest/preview/studio/flow/engagement/__init__.py +++ /dev/null @@ -1,458 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.preview.studio.flow.engagement.step import StepList - - -class EngagementList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, flow_sid): - """ - Initialize the EngagementList - - :param Version version: Version that contains the resource - :param flow_sid: Flow Sid. - - :returns: twilio.rest.preview.studio.flow.engagement.EngagementList - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementList - """ - super(EngagementList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, } - self._uri = '/Flows/{flow_sid}/Engagements'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams EngagementInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.studio.flow.engagement.EngagementInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists EngagementInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.studio.flow.engagement.EngagementInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EngagementInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of EngagementInstance - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return EngagementPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EngagementInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EngagementInstance - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EngagementPage(self._version, response, self._solution) - - def create(self, to, from_, parameters=values.unset): - """ - Create a new EngagementInstance - - :param unicode to: The to - :param unicode from_: The from - :param unicode parameters: The parameters - - :returns: Newly created EngagementInstance - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementInstance - """ - data = values.of({'To': to, 'From': from_, 'Parameters': parameters, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return EngagementInstance(self._version, payload, flow_sid=self._solution['flow_sid'], ) - - def get(self, sid): - """ - Constructs a EngagementContext - - :param sid: The sid - - :returns: twilio.rest.preview.studio.flow.engagement.EngagementContext - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementContext - """ - return EngagementContext(self._version, flow_sid=self._solution['flow_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EngagementContext - - :param sid: The sid - - :returns: twilio.rest.preview.studio.flow.engagement.EngagementContext - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementContext - """ - return EngagementContext(self._version, flow_sid=self._solution['flow_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Studio.EngagementList>' - - -class EngagementPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the EngagementPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: Flow Sid. - - :returns: twilio.rest.preview.studio.flow.engagement.EngagementPage - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementPage - """ - super(EngagementPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EngagementInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.studio.flow.engagement.EngagementInstance - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementInstance - """ - return EngagementInstance(self._version, payload, flow_sid=self._solution['flow_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Studio.EngagementPage>' - - -class EngagementContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, flow_sid, sid): - """ - Initialize the EngagementContext - - :param Version version: Version that contains the resource - :param flow_sid: The flow_sid - :param sid: The sid - - :returns: twilio.rest.preview.studio.flow.engagement.EngagementContext - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementContext - """ - super(EngagementContext, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'sid': sid, } - self._uri = '/Flows/{flow_sid}/Engagements/{sid}'.format(**self._solution) - - # Dependents - self._steps = None - - def fetch(self): - """ - Fetch a EngagementInstance - - :returns: Fetched EngagementInstance - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return EngagementInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - sid=self._solution['sid'], - ) - - @property - def steps(self): - """ - Access the steps - - :returns: twilio.rest.preview.studio.flow.engagement.step.StepList - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepList - """ - if self._steps is None: - self._steps = StepList( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['sid'], - ) - return self._steps - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Studio.EngagementContext {}>'.format(context) - - -class EngagementInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - ACTIVE = "active" - ENDED = "ended" - - def __init__(self, version, payload, flow_sid, sid=None): - """ - Initialize the EngagementInstance - - :returns: twilio.rest.preview.studio.flow.engagement.EngagementInstance - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementInstance - """ - super(EngagementInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'flow_sid': payload['flow_sid'], - 'contact_sid': payload['contact_sid'], - 'contact_channel_address': payload['contact_channel_address'], - 'status': payload['status'], - 'context': payload['context'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'flow_sid': flow_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EngagementContext for this EngagementInstance - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementContext - """ - if self._context is None: - self._context = EngagementContext( - self._version, - flow_sid=self._solution['flow_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Engagement. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def flow_sid(self): - """ - :returns: Flow Sid. - :rtype: unicode - """ - return self._properties['flow_sid'] - - @property - def contact_sid(self): - """ - :returns: Contact Sid. - :rtype: unicode - """ - return self._properties['contact_sid'] - - @property - def contact_channel_address(self): - """ - :returns: The phone number, SIP address or Client identifier that triggered this Engagement. - :rtype: unicode - """ - return self._properties['contact_channel_address'] - - @property - def status(self): - """ - :returns: The Status of this Engagement - :rtype: EngagementInstance.Status - """ - return self._properties['status'] - - @property - def context(self): - """ - :returns: Nested resource URLs. - :rtype: dict - """ - return self._properties['context'] - - @property - def date_created(self): - """ - :returns: The date this Engagement was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Engagement was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a EngagementInstance - - :returns: Fetched EngagementInstance - :rtype: twilio.rest.preview.studio.flow.engagement.EngagementInstance - """ - return self._proxy.fetch() - - @property - def steps(self): - """ - Access the steps - - :returns: twilio.rest.preview.studio.flow.engagement.step.StepList - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepList - """ - return self._proxy.steps - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Studio.EngagementInstance {}>'.format(context) diff --git a/twilio/rest/preview/studio/flow/engagement/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/studio/flow/engagement/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index ad713cc..0000000 Binary files a/twilio/rest/preview/studio/flow/engagement/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/studio/flow/engagement/__pycache__/step.cpython-36.pyc b/twilio/rest/preview/studio/flow/engagement/__pycache__/step.cpython-36.pyc deleted file mode 100644 index 59ce617..0000000 Binary files a/twilio/rest/preview/studio/flow/engagement/__pycache__/step.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/studio/flow/engagement/step.py b/twilio/rest/preview/studio/flow/engagement/step.py deleted file mode 100644 index b0a6775..0000000 --- a/twilio/rest/preview/studio/flow/engagement/step.py +++ /dev/null @@ -1,427 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class StepList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, flow_sid, engagement_sid): - """ - Initialize the StepList - - :param Version version: Version that contains the resource - :param flow_sid: Flow Sid. - :param engagement_sid: Engagement Sid. - - :returns: twilio.rest.preview.studio.flow.engagement.step.StepList - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepList - """ - super(StepList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'engagement_sid': engagement_sid, } - self._uri = '/Flows/{flow_sid}/Engagements/{engagement_sid}/Steps'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams StepInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.studio.flow.engagement.step.StepInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists StepInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.studio.flow.engagement.step.StepInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of StepInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of StepInstance - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return StepPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of StepInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of StepInstance - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return StepPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a StepContext - - :param sid: The sid - - :returns: twilio.rest.preview.studio.flow.engagement.step.StepContext - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepContext - """ - return StepContext( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a StepContext - - :param sid: The sid - - :returns: twilio.rest.preview.studio.flow.engagement.step.StepContext - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepContext - """ - return StepContext( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Studio.StepList>' - - -class StepPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the StepPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: Flow Sid. - :param engagement_sid: Engagement Sid. - - :returns: twilio.rest.preview.studio.flow.engagement.step.StepPage - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepPage - """ - super(StepPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of StepInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.studio.flow.engagement.step.StepInstance - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepInstance - """ - return StepInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Studio.StepPage>' - - -class StepContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, flow_sid, engagement_sid, sid): - """ - Initialize the StepContext - - :param Version version: Version that contains the resource - :param flow_sid: The flow_sid - :param engagement_sid: The engagement_sid - :param sid: The sid - - :returns: twilio.rest.preview.studio.flow.engagement.step.StepContext - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepContext - """ - super(StepContext, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'engagement_sid': engagement_sid, 'sid': sid, } - self._uri = '/Flows/{flow_sid}/Engagements/{engagement_sid}/Steps/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a StepInstance - - :returns: Fetched StepInstance - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return StepInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Studio.StepContext {}>'.format(context) - - -class StepInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, flow_sid, engagement_sid, sid=None): - """ - Initialize the StepInstance - - :returns: twilio.rest.preview.studio.flow.engagement.step.StepInstance - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepInstance - """ - super(StepInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'flow_sid': payload['flow_sid'], - 'engagement_sid': payload['engagement_sid'], - 'name': payload['name'], - 'context': payload['context'], - 'transitioned_from': payload['transitioned_from'], - 'transitioned_to': payload['transitioned_to'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'flow_sid': flow_sid, - 'engagement_sid': engagement_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: StepContext for this StepInstance - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepContext - """ - if self._context is None: - self._context = StepContext( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Step. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def flow_sid(self): - """ - :returns: Flow Sid. - :rtype: unicode - """ - return self._properties['flow_sid'] - - @property - def engagement_sid(self): - """ - :returns: Engagement Sid. - :rtype: unicode - """ - return self._properties['engagement_sid'] - - @property - def name(self): - """ - :returns: The Widget that implemented this Step. - :rtype: unicode - """ - return self._properties['name'] - - @property - def context(self): - """ - :returns: Nested resource URLs. - :rtype: dict - """ - return self._properties['context'] - - @property - def transitioned_from(self): - """ - :returns: The Widget that preceded the Widget for this Step. - :rtype: unicode - """ - return self._properties['transitioned_from'] - - @property - def transitioned_to(self): - """ - :returns: The Widget that will follow the Widget for this Step. - :rtype: unicode - """ - return self._properties['transitioned_to'] - - @property - def date_created(self): - """ - :returns: The date this Step was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Step was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a StepInstance - - :returns: Fetched StepInstance - :rtype: twilio.rest.preview.studio.flow.engagement.step.StepInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Studio.StepInstance {}>'.format(context) diff --git a/twilio/rest/preview/sync/__init__.py b/twilio/rest/preview/sync/__init__.py deleted file mode 100644 index 38f1faf..0000000 --- a/twilio/rest/preview/sync/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.preview.sync.service import ServiceList - - -class Sync(Version): - - def __init__(self, domain): - """ - Initialize the Sync version of Preview - - :returns: Sync version of Preview - :rtype: twilio.rest.preview.sync.Sync.Sync - """ - super(Sync, self).__init__(domain) - self.version = 'Sync' - self._services = None - - @property - def services(self): - """ - :rtype: twilio.rest.preview.sync.service.ServiceList - """ - if self._services is None: - self._services = ServiceList(self) - return self._services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync>' diff --git a/twilio/rest/preview/sync/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/sync/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 697ddfc..0000000 Binary files a/twilio/rest/preview/sync/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/sync/service/__init__.py b/twilio/rest/preview/sync/service/__init__.py deleted file mode 100644 index 9eb166e..0000000 --- a/twilio/rest/preview/sync/service/__init__.py +++ /dev/null @@ -1,553 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.preview.sync.service.document import DocumentList -from twilio.rest.preview.sync.service.sync_list import SyncListList -from twilio.rest.preview.sync.service.sync_map import SyncMapList - - -class ServiceList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.sync.service.ServiceList - :rtype: twilio.rest.preview.sync.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name=values.unset, webhook_url=values.unset, - reachability_webhooks_enabled=values.unset, - acl_enabled=values.unset): - """ - Create a new ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode webhook_url: The webhook_url - :param bool reachability_webhooks_enabled: The reachability_webhooks_enabled - :param bool acl_enabled: The acl_enabled - - :returns: Newly created ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'WebhookUrl': webhook_url, - 'ReachabilityWebhooksEnabled': reachability_webhooks_enabled, - 'AclEnabled': acl_enabled, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServicePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.ServiceContext - :rtype: twilio.rest.preview.sync.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.ServiceContext - :rtype: twilio.rest.preview.sync.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.ServiceList>' - - -class ServicePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.sync.service.ServicePage - :rtype: twilio.rest.preview.sync.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.ServicePage>' - - -class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.ServiceContext - :rtype: twilio.rest.preview.sync.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._documents = None - self._sync_lists = None - self._sync_maps = None - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, webhook_url=values.unset, friendly_name=values.unset, - reachability_webhooks_enabled=values.unset, - acl_enabled=values.unset): - """ - Update the ServiceInstance - - :param unicode webhook_url: The webhook_url - :param unicode friendly_name: The friendly_name - :param bool reachability_webhooks_enabled: The reachability_webhooks_enabled - :param bool acl_enabled: The acl_enabled - - :returns: Updated ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ - data = values.of({ - 'WebhookUrl': webhook_url, - 'FriendlyName': friendly_name, - 'ReachabilityWebhooksEnabled': reachability_webhooks_enabled, - 'AclEnabled': acl_enabled, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def documents(self): - """ - Access the documents - - :returns: twilio.rest.preview.sync.service.document.DocumentList - :rtype: twilio.rest.preview.sync.service.document.DocumentList - """ - if self._documents is None: - self._documents = DocumentList(self._version, service_sid=self._solution['sid'], ) - return self._documents - - @property - def sync_lists(self): - """ - Access the sync_lists - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListList - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListList - """ - if self._sync_lists is None: - self._sync_lists = SyncListList(self._version, service_sid=self._solution['sid'], ) - return self._sync_lists - - @property - def sync_maps(self): - """ - Access the sync_maps - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapList - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapList - """ - if self._sync_maps is None: - self._sync_maps = SyncMapList(self._version, service_sid=self._solution['sid'], ) - return self._sync_maps - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.ServiceContext {}>'.format(context) - - -class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.preview.sync.service.ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'webhook_url': payload['webhook_url'], - 'reachability_webhooks_enabled': payload['reachability_webhooks_enabled'], - 'acl_enabled': payload['acl_enabled'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceContext - """ - if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def webhook_url(self): - """ - :returns: The webhook_url - :rtype: unicode - """ - return self._properties['webhook_url'] - - @property - def reachability_webhooks_enabled(self): - """ - :returns: The reachability_webhooks_enabled - :rtype: bool - """ - return self._properties['reachability_webhooks_enabled'] - - @property - def acl_enabled(self): - """ - :returns: The acl_enabled - :rtype: bool - """ - return self._properties['acl_enabled'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, webhook_url=values.unset, friendly_name=values.unset, - reachability_webhooks_enabled=values.unset, - acl_enabled=values.unset): - """ - Update the ServiceInstance - - :param unicode webhook_url: The webhook_url - :param unicode friendly_name: The friendly_name - :param bool reachability_webhooks_enabled: The reachability_webhooks_enabled - :param bool acl_enabled: The acl_enabled - - :returns: Updated ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ - return self._proxy.update( - webhook_url=webhook_url, - friendly_name=friendly_name, - reachability_webhooks_enabled=reachability_webhooks_enabled, - acl_enabled=acl_enabled, - ) - - @property - def documents(self): - """ - Access the documents - - :returns: twilio.rest.preview.sync.service.document.DocumentList - :rtype: twilio.rest.preview.sync.service.document.DocumentList - """ - return self._proxy.documents - - @property - def sync_lists(self): - """ - Access the sync_lists - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListList - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListList - """ - return self._proxy.sync_lists - - @property - def sync_maps(self): - """ - Access the sync_maps - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapList - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapList - """ - return self._proxy.sync_maps - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.ServiceInstance {}>'.format(context) diff --git a/twilio/rest/preview/sync/service/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/sync/service/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 152c34e..0000000 Binary files a/twilio/rest/preview/sync/service/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/sync/service/document/__init__.py b/twilio/rest/preview/sync/service/document/__init__.py deleted file mode 100644 index 527331e..0000000 --- a/twilio/rest/preview/sync/service/document/__init__.py +++ /dev/null @@ -1,507 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.preview.sync.service.document.document_permission import DocumentPermissionList - - -class DocumentList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the DocumentList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.preview.sync.service.document.DocumentList - :rtype: twilio.rest.preview.sync.service.document.DocumentList - """ - super(DocumentList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Documents'.format(**self._solution) - - def create(self, unique_name=values.unset, data=values.unset): - """ - Create a new DocumentInstance - - :param unicode unique_name: The unique_name - :param dict data: The data - - :returns: Newly created DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance - """ - data = values.of({'UniqueName': unique_name, 'Data': serialize.object(data), }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams DocumentInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.document.DocumentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DocumentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.document.DocumentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DocumentInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return DocumentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DocumentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DocumentPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a DocumentContext - - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.document.DocumentContext - :rtype: twilio.rest.preview.sync.service.document.DocumentContext - """ - return DocumentContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a DocumentContext - - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.document.DocumentContext - :rtype: twilio.rest.preview.sync.service.document.DocumentContext - """ - return DocumentContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.DocumentList>' - - -class DocumentPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DocumentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.preview.sync.service.document.DocumentPage - :rtype: twilio.rest.preview.sync.service.document.DocumentPage - """ - super(DocumentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DocumentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.document.DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance - """ - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.DocumentPage>' - - -class DocumentContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the DocumentContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.document.DocumentContext - :rtype: twilio.rest.preview.sync.service.document.DocumentContext - """ - super(DocumentContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Documents/{sid}'.format(**self._solution) - - # Dependents - self._document_permissions = None - - def fetch(self): - """ - Fetch a DocumentInstance - - :returns: Fetched DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return DocumentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the DocumentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, data): - """ - Update the DocumentInstance - - :param dict data: The data - - :returns: Updated DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance - """ - data = values.of({'Data': serialize.object(data), }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return DocumentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def document_permissions(self): - """ - Access the document_permissions - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList - """ - if self._document_permissions is None: - self._document_permissions = DocumentPermissionList( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['sid'], - ) - return self._document_permissions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.DocumentContext {}>'.format(context) - - -class DocumentInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the DocumentInstance - - :returns: twilio.rest.preview.sync.service.document.DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance - """ - super(DocumentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'url': payload['url'], - 'links': payload['links'], - 'revision': payload['revision'], - 'data': payload['data'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DocumentContext for this DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentContext - """ - if self._context is None: - self._context = DocumentContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def data(self): - """ - :returns: The data - :rtype: dict - """ - return self._properties['data'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch a DocumentInstance - - :returns: Fetched DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the DocumentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, data): - """ - Update the DocumentInstance - - :param dict data: The data - - :returns: Updated DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance - """ - return self._proxy.update(data, ) - - @property - def document_permissions(self): - """ - Access the document_permissions - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList - """ - return self._proxy.document_permissions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.DocumentInstance {}>'.format(context) diff --git a/twilio/rest/preview/sync/service/document/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/sync/service/document/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index cbd7df2..0000000 Binary files a/twilio/rest/preview/sync/service/document/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/sync/service/document/__pycache__/document_permission.cpython-36.pyc b/twilio/rest/preview/sync/service/document/__pycache__/document_permission.cpython-36.pyc deleted file mode 100644 index 6268e0a..0000000 Binary files a/twilio/rest/preview/sync/service/document/__pycache__/document_permission.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/sync/service/document/document_permission.py b/twilio/rest/preview/sync/service/document/document_permission.py deleted file mode 100644 index 4947708..0000000 --- a/twilio/rest/preview/sync/service/document/document_permission.py +++ /dev/null @@ -1,457 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class DocumentPermissionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, document_sid): - """ - Initialize the DocumentPermissionList - - :param Version version: Version that contains the resource - :param service_sid: Sync Service Instance SID. - :param document_sid: Sync Document SID. - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList - """ - super(DocumentPermissionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'document_sid': document_sid, } - self._uri = '/Services/{service_sid}/Documents/{document_sid}/Permissions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DocumentPermissionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DocumentPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DocumentPermissionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return DocumentPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DocumentPermissionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DocumentPermissionPage(self._version, response, self._solution) - - def get(self, identity): - """ - Constructs a DocumentPermissionContext - - :param identity: Identity of the user to whom the Sync Document Permission applies. - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - """ - return DocumentPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=identity, - ) - - def __call__(self, identity): - """ - Constructs a DocumentPermissionContext - - :param identity: Identity of the user to whom the Sync Document Permission applies. - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - """ - return DocumentPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=identity, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.DocumentPermissionList>' - - -class DocumentPermissionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DocumentPermissionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Sync Service Instance SID. - :param document_sid: Sync Document SID. - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionPage - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionPage - """ - super(DocumentPermissionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DocumentPermissionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - """ - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.DocumentPermissionPage>' - - -class DocumentPermissionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, document_sid, identity): - """ - Initialize the DocumentPermissionContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param document_sid: Sync Document SID or unique name. - :param identity: Identity of the user to whom the Sync Document Permission applies. - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - """ - super(DocumentPermissionContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'document_sid': document_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Documents/{document_sid}/Permissions/{identity}'.format(**self._solution) - - def fetch(self): - """ - Fetch a DocumentPermissionInstance - - :returns: Fetched DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=self._solution['identity'], - ) - - def delete(self): - """ - Deletes the DocumentPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, read, write, manage): - """ - Update the DocumentPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: Updated DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - """ - data = values.of({'Read': read, 'Write': write, 'Manage': manage, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=self._solution['identity'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.DocumentPermissionContext {}>'.format(context) - - -class DocumentPermissionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, document_sid, identity=None): - """ - Initialize the DocumentPermissionInstance - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - """ - super(DocumentPermissionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'document_sid': payload['document_sid'], - 'identity': payload['identity'], - 'read': payload['read'], - 'write': payload['write'], - 'manage': payload['manage'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'document_sid': document_sid, - 'identity': identity or self._properties['identity'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DocumentPermissionContext for this DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - """ - if self._context is None: - self._context = DocumentPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=self._solution['identity'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: Twilio Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Sync Service Instance SID. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def document_sid(self): - """ - :returns: Sync Document SID. - :rtype: unicode - """ - return self._properties['document_sid'] - - @property - def identity(self): - """ - :returns: Identity of the user to whom the Sync Document Permission applies. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def read(self): - """ - :returns: Read access. - :rtype: bool - """ - return self._properties['read'] - - @property - def write(self): - """ - :returns: Write access. - :rtype: bool - """ - return self._properties['write'] - - @property - def manage(self): - """ - :returns: Manage access. - :rtype: bool - """ - return self._properties['manage'] - - @property - def url(self): - """ - :returns: URL of this Sync Document Permission. - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a DocumentPermissionInstance - - :returns: Fetched DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the DocumentPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, read, write, manage): - """ - Update the DocumentPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: Updated DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - """ - return self._proxy.update(read, write, manage, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.DocumentPermissionInstance {}>'.format(context) diff --git a/twilio/rest/preview/sync/service/sync_list/__init__.py b/twilio/rest/preview/sync/service/sync_list/__init__.py deleted file mode 100644 index 6d2f193..0000000 --- a/twilio/rest/preview/sync/service/sync_list/__init__.py +++ /dev/null @@ -1,489 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.preview.sync.service.sync_list.sync_list_item import SyncListItemList -from twilio.rest.preview.sync.service.sync_list.sync_list_permission import SyncListPermissionList - - -class SyncListList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the SyncListList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListList - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListList - """ - super(SyncListList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Lists'.format(**self._solution) - - def create(self, unique_name=values.unset): - """ - Create a new SyncListInstance - - :param unicode unique_name: The unique_name - - :returns: Newly created SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListInstance - """ - data = values.of({'UniqueName': unique_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncListInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_list.SyncListInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_list.SyncListInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncListInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SyncListPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncListInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncListPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SyncListContext - - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListContext - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListContext - """ - return SyncListContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SyncListContext - - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListContext - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListContext - """ - return SyncListContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.SyncListList>' - - -class SyncListPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncListPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListPage - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListPage - """ - super(SyncListPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncListInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListInstance - """ - return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.SyncListPage>' - - -class SyncListContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the SyncListContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListContext - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListContext - """ - super(SyncListContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Lists/{sid}'.format(**self._solution) - - # Dependents - self._sync_list_items = None - self._sync_list_permissions = None - - def fetch(self): - """ - Fetch a SyncListInstance - - :returns: Fetched SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SyncListInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the SyncListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def sync_list_items(self): - """ - Access the sync_list_items - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemList - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemList - """ - if self._sync_list_items is None: - self._sync_list_items = SyncListItemList( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['sid'], - ) - return self._sync_list_items - - @property - def sync_list_permissions(self): - """ - Access the sync_list_permissions - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionList - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionList - """ - if self._sync_list_permissions is None: - self._sync_list_permissions = SyncListPermissionList( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['sid'], - ) - return self._sync_list_permissions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.SyncListContext {}>'.format(context) - - -class SyncListInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the SyncListInstance - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListInstance - """ - super(SyncListInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'url': payload['url'], - 'links': payload['links'], - 'revision': payload['revision'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListContext for this SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListContext - """ - if self._context is None: - self._context = SyncListContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch a SyncListInstance - - :returns: Fetched SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def sync_list_items(self): - """ - Access the sync_list_items - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemList - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemList - """ - return self._proxy.sync_list_items - - @property - def sync_list_permissions(self): - """ - Access the sync_list_permissions - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionList - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionList - """ - return self._proxy.sync_list_permissions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.SyncListInstance {}>'.format(context) diff --git a/twilio/rest/preview/sync/service/sync_list/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/sync/service/sync_list/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 310b37f..0000000 Binary files a/twilio/rest/preview/sync/service/sync_list/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/sync/service/sync_list/__pycache__/sync_list_item.cpython-36.pyc b/twilio/rest/preview/sync/service/sync_list/__pycache__/sync_list_item.cpython-36.pyc deleted file mode 100644 index 5e68917..0000000 Binary files a/twilio/rest/preview/sync/service/sync_list/__pycache__/sync_list_item.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/sync/service/sync_list/__pycache__/sync_list_permission.cpython-36.pyc b/twilio/rest/preview/sync/service/sync_list/__pycache__/sync_list_permission.cpython-36.pyc deleted file mode 100644 index f6ab3ea..0000000 Binary files a/twilio/rest/preview/sync/service/sync_list/__pycache__/sync_list_permission.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/sync/service/sync_list/sync_list_item.py b/twilio/rest/preview/sync/service/sync_list/sync_list_item.py deleted file mode 100644 index a3e7190..0000000 --- a/twilio/rest/preview/sync/service/sync_list/sync_list_item.py +++ /dev/null @@ -1,524 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class SyncListItemList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, list_sid): - """ - Initialize the SyncListItemList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param list_sid: The list_sid - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemList - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemList - """ - super(SyncListItemList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Items'.format(**self._solution) - - def create(self, data): - """ - Create a new SyncListItemInstance - - :param dict data: The data - - :returns: Newly created SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - """ - data = values.of({'Data': serialize.object(data), }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - ) - - def stream(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Streams SyncListItemInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param SyncListItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncListItemInstance.QueryFromBoundType bounds: The bounds - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, from_=from_, bounds=bounds, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Lists SyncListItemInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param SyncListItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncListItemInstance.QueryFromBoundType bounds: The bounds - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance] - """ - return list(self.stream(order=order, from_=from_, bounds=bounds, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, from_=values.unset, bounds=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncListItemInstance records from the API. - Request is executed immediately - - :param SyncListItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncListItemInstance.QueryFromBoundType bounds: The bounds - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemPage - """ - params = values.of({ - 'Order': order, - 'From': from_, - 'Bounds': bounds, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SyncListItemPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncListItemInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncListItemPage(self._version, response, self._solution) - - def get(self, index): - """ - Constructs a SyncListItemContext - - :param index: The index - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - """ - return SyncListItemContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=index, - ) - - def __call__(self, index): - """ - Constructs a SyncListItemContext - - :param index: The index - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - """ - return SyncListItemContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=index, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.SyncListItemList>' - - -class SyncListItemPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncListItemPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param list_sid: The list_sid - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemPage - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemPage - """ - super(SyncListItemPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncListItemInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - """ - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.SyncListItemPage>' - - -class SyncListItemContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, list_sid, index): - """ - Initialize the SyncListItemContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param list_sid: The list_sid - :param index: The index - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - """ - super(SyncListItemContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, 'index': index, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Items/{index}'.format(**self._solution) - - def fetch(self): - """ - Fetch a SyncListItemInstance - - :returns: Fetched SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=self._solution['index'], - ) - - def delete(self): - """ - Deletes the SyncListItemInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, data): - """ - Update the SyncListItemInstance - - :param dict data: The data - - :returns: Updated SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - """ - data = values.of({'Data': serialize.object(data), }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=self._solution['index'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.SyncListItemContext {}>'.format(context) - - -class SyncListItemInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class QueryResultOrder(object): - ASC = "asc" - DESC = "desc" - - class QueryFromBoundType(object): - INCLUSIVE = "inclusive" - EXCLUSIVE = "exclusive" - - def __init__(self, version, payload, service_sid, list_sid, index=None): - """ - Initialize the SyncListItemInstance - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - """ - super(SyncListItemInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'index': deserialize.integer(payload['index']), - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'list_sid': payload['list_sid'], - 'url': payload['url'], - 'revision': payload['revision'], - 'data': payload['data'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'list_sid': list_sid, - 'index': index or self._properties['index'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListItemContext for this SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - """ - if self._context is None: - self._context = SyncListItemContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=self._solution['index'], - ) - return self._context - - @property - def index(self): - """ - :returns: The index - :rtype: unicode - """ - return self._properties['index'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def list_sid(self): - """ - :returns: The list_sid - :rtype: unicode - """ - return self._properties['list_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def data(self): - """ - :returns: The data - :rtype: dict - """ - return self._properties['data'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch a SyncListItemInstance - - :returns: Fetched SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncListItemInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, data): - """ - Update the SyncListItemInstance - - :param dict data: The data - - :returns: Updated SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - """ - return self._proxy.update(data, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.SyncListItemInstance {}>'.format(context) diff --git a/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py b/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py deleted file mode 100644 index 0e612e2..0000000 --- a/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py +++ /dev/null @@ -1,457 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class SyncListPermissionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, list_sid): - """ - Initialize the SyncListPermissionList - - :param Version version: Version that contains the resource - :param service_sid: Sync Service Instance SID. - :param list_sid: Sync List SID. - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionList - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionList - """ - super(SyncListPermissionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Permissions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncListPermissionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncListPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncListPermissionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SyncListPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncListPermissionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncListPermissionPage(self._version, response, self._solution) - - def get(self, identity): - """ - Constructs a SyncListPermissionContext - - :param identity: Identity of the user to whom the Sync List Permission applies. - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionContext - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionContext - """ - return SyncListPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=identity, - ) - - def __call__(self, identity): - """ - Constructs a SyncListPermissionContext - - :param identity: Identity of the user to whom the Sync List Permission applies. - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionContext - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionContext - """ - return SyncListPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=identity, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.SyncListPermissionList>' - - -class SyncListPermissionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncListPermissionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Sync Service Instance SID. - :param list_sid: Sync List SID. - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionPage - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionPage - """ - super(SyncListPermissionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncListPermissionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.SyncListPermissionPage>' - - -class SyncListPermissionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, list_sid, identity): - """ - Initialize the SyncListPermissionContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param list_sid: Sync List SID or unique name. - :param identity: Identity of the user to whom the Sync List Permission applies. - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionContext - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionContext - """ - super(SyncListPermissionContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Permissions/{identity}'.format(**self._solution) - - def fetch(self): - """ - Fetch a SyncListPermissionInstance - - :returns: Fetched SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=self._solution['identity'], - ) - - def delete(self): - """ - Deletes the SyncListPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, read, write, manage): - """ - Update the SyncListPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: Updated SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - data = values.of({'Read': read, 'Write': write, 'Manage': manage, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=self._solution['identity'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.SyncListPermissionContext {}>'.format(context) - - -class SyncListPermissionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, list_sid, identity=None): - """ - Initialize the SyncListPermissionInstance - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - super(SyncListPermissionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'list_sid': payload['list_sid'], - 'identity': payload['identity'], - 'read': payload['read'], - 'write': payload['write'], - 'manage': payload['manage'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'list_sid': list_sid, - 'identity': identity or self._properties['identity'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListPermissionContext for this SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionContext - """ - if self._context is None: - self._context = SyncListPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=self._solution['identity'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: Twilio Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Sync Service Instance SID. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def list_sid(self): - """ - :returns: Sync List SID. - :rtype: unicode - """ - return self._properties['list_sid'] - - @property - def identity(self): - """ - :returns: Identity of the user to whom the Sync List Permission applies. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def read(self): - """ - :returns: Read access. - :rtype: bool - """ - return self._properties['read'] - - @property - def write(self): - """ - :returns: Write access. - :rtype: bool - """ - return self._properties['write'] - - @property - def manage(self): - """ - :returns: Manage access. - :rtype: bool - """ - return self._properties['manage'] - - @property - def url(self): - """ - :returns: URL of this Sync List Permission. - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a SyncListPermissionInstance - - :returns: Fetched SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncListPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, read, write, manage): - """ - Update the SyncListPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: Updated SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - return self._proxy.update(read, write, manage, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.SyncListPermissionInstance {}>'.format(context) diff --git a/twilio/rest/preview/sync/service/sync_map/__init__.py b/twilio/rest/preview/sync/service/sync_map/__init__.py deleted file mode 100644 index 4cfc5d5..0000000 --- a/twilio/rest/preview/sync/service/sync_map/__init__.py +++ /dev/null @@ -1,489 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.preview.sync.service.sync_map.sync_map_item import SyncMapItemList -from twilio.rest.preview.sync.service.sync_map.sync_map_permission import SyncMapPermissionList - - -class SyncMapList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the SyncMapList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapList - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapList - """ - super(SyncMapList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Maps'.format(**self._solution) - - def create(self, unique_name=values.unset): - """ - Create a new SyncMapInstance - - :param unicode unique_name: The unique_name - - :returns: Newly created SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - """ - data = values.of({'UniqueName': unique_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncMapInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_map.SyncMapInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncMapInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_map.SyncMapInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncMapInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SyncMapPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncMapInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncMapPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SyncMapContext - - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapContext - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapContext - """ - return SyncMapContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SyncMapContext - - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapContext - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapContext - """ - return SyncMapContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.SyncMapList>' - - -class SyncMapPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncMapPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapPage - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapPage - """ - super(SyncMapPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncMapInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - """ - return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.SyncMapPage>' - - -class SyncMapContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the SyncMapContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapContext - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapContext - """ - super(SyncMapContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Maps/{sid}'.format(**self._solution) - - # Dependents - self._sync_map_items = None - self._sync_map_permissions = None - - def fetch(self): - """ - Fetch a SyncMapInstance - - :returns: Fetched SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SyncMapInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the SyncMapInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def sync_map_items(self): - """ - Access the sync_map_items - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemList - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemList - """ - if self._sync_map_items is None: - self._sync_map_items = SyncMapItemList( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['sid'], - ) - return self._sync_map_items - - @property - def sync_map_permissions(self): - """ - Access the sync_map_permissions - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionList - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionList - """ - if self._sync_map_permissions is None: - self._sync_map_permissions = SyncMapPermissionList( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['sid'], - ) - return self._sync_map_permissions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.SyncMapContext {}>'.format(context) - - -class SyncMapInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the SyncMapInstance - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - """ - super(SyncMapInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'url': payload['url'], - 'links': payload['links'], - 'revision': payload['revision'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapContext for this SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapContext - """ - if self._context is None: - self._context = SyncMapContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch a SyncMapInstance - - :returns: Fetched SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncMapInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def sync_map_items(self): - """ - Access the sync_map_items - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemList - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemList - """ - return self._proxy.sync_map_items - - @property - def sync_map_permissions(self): - """ - Access the sync_map_permissions - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionList - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionList - """ - return self._proxy.sync_map_permissions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.SyncMapInstance {}>'.format(context) diff --git a/twilio/rest/preview/sync/service/sync_map/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/sync/service/sync_map/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index d8eec9d..0000000 Binary files a/twilio/rest/preview/sync/service/sync_map/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/sync/service/sync_map/__pycache__/sync_map_item.cpython-36.pyc b/twilio/rest/preview/sync/service/sync_map/__pycache__/sync_map_item.cpython-36.pyc deleted file mode 100644 index f81bffd..0000000 Binary files a/twilio/rest/preview/sync/service/sync_map/__pycache__/sync_map_item.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/sync/service/sync_map/__pycache__/sync_map_permission.cpython-36.pyc b/twilio/rest/preview/sync/service/sync_map/__pycache__/sync_map_permission.cpython-36.pyc deleted file mode 100644 index 4d96d69..0000000 Binary files a/twilio/rest/preview/sync/service/sync_map/__pycache__/sync_map_permission.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/sync/service/sync_map/sync_map_item.py b/twilio/rest/preview/sync/service/sync_map/sync_map_item.py deleted file mode 100644 index 079dd9d..0000000 --- a/twilio/rest/preview/sync/service/sync_map/sync_map_item.py +++ /dev/null @@ -1,525 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class SyncMapItemList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, map_sid): - """ - Initialize the SyncMapItemList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param map_sid: The map_sid - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemList - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemList - """ - super(SyncMapItemList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Items'.format(**self._solution) - - def create(self, key, data): - """ - Create a new SyncMapItemInstance - - :param unicode key: The key - :param dict data: The data - - :returns: Newly created SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - """ - data = values.of({'Key': key, 'Data': serialize.object(data), }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - ) - - def stream(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Streams SyncMapItemInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param SyncMapItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncMapItemInstance.QueryFromBoundType bounds: The bounds - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, from_=from_, bounds=bounds, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Lists SyncMapItemInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param SyncMapItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncMapItemInstance.QueryFromBoundType bounds: The bounds - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance] - """ - return list(self.stream(order=order, from_=from_, bounds=bounds, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, from_=values.unset, bounds=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncMapItemInstance records from the API. - Request is executed immediately - - :param SyncMapItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncMapItemInstance.QueryFromBoundType bounds: The bounds - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemPage - """ - params = values.of({ - 'Order': order, - 'From': from_, - 'Bounds': bounds, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SyncMapItemPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncMapItemInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncMapItemPage(self._version, response, self._solution) - - def get(self, key): - """ - Constructs a SyncMapItemContext - - :param key: The key - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemContext - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemContext - """ - return SyncMapItemContext( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=key, - ) - - def __call__(self, key): - """ - Constructs a SyncMapItemContext - - :param key: The key - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemContext - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemContext - """ - return SyncMapItemContext( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=key, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.SyncMapItemList>' - - -class SyncMapItemPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncMapItemPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param map_sid: The map_sid - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemPage - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemPage - """ - super(SyncMapItemPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncMapItemInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - """ - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.SyncMapItemPage>' - - -class SyncMapItemContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, map_sid, key): - """ - Initialize the SyncMapItemContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param map_sid: The map_sid - :param key: The key - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemContext - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemContext - """ - super(SyncMapItemContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, 'key': key, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Items/{key}'.format(**self._solution) - - def fetch(self): - """ - Fetch a SyncMapItemInstance - - :returns: Fetched SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=self._solution['key'], - ) - - def delete(self): - """ - Deletes the SyncMapItemInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, data): - """ - Update the SyncMapItemInstance - - :param dict data: The data - - :returns: Updated SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - """ - data = values.of({'Data': serialize.object(data), }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=self._solution['key'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.SyncMapItemContext {}>'.format(context) - - -class SyncMapItemInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class QueryResultOrder(object): - ASC = "asc" - DESC = "desc" - - class QueryFromBoundType(object): - INCLUSIVE = "inclusive" - EXCLUSIVE = "exclusive" - - def __init__(self, version, payload, service_sid, map_sid, key=None): - """ - Initialize the SyncMapItemInstance - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - """ - super(SyncMapItemInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'key': payload['key'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'map_sid': payload['map_sid'], - 'url': payload['url'], - 'revision': payload['revision'], - 'data': payload['data'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'map_sid': map_sid, - 'key': key or self._properties['key'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapItemContext for this SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemContext - """ - if self._context is None: - self._context = SyncMapItemContext( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=self._solution['key'], - ) - return self._context - - @property - def key(self): - """ - :returns: The key - :rtype: unicode - """ - return self._properties['key'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def map_sid(self): - """ - :returns: The map_sid - :rtype: unicode - """ - return self._properties['map_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def data(self): - """ - :returns: The data - :rtype: dict - """ - return self._properties['data'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch a SyncMapItemInstance - - :returns: Fetched SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncMapItemInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, data): - """ - Update the SyncMapItemInstance - - :param dict data: The data - - :returns: Updated SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - """ - return self._proxy.update(data, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.SyncMapItemInstance {}>'.format(context) diff --git a/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py b/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py deleted file mode 100644 index 794ea9d..0000000 --- a/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py +++ /dev/null @@ -1,457 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class SyncMapPermissionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, map_sid): - """ - Initialize the SyncMapPermissionList - - :param Version version: Version that contains the resource - :param service_sid: Sync Service Instance SID. - :param map_sid: Sync Map SID. - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionList - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionList - """ - super(SyncMapPermissionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Permissions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncMapPermissionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncMapPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncMapPermissionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SyncMapPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncMapPermissionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncMapPermissionPage(self._version, response, self._solution) - - def get(self, identity): - """ - Constructs a SyncMapPermissionContext - - :param identity: Identity of the user to whom the Sync Map Permission applies. - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionContext - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionContext - """ - return SyncMapPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=identity, - ) - - def __call__(self, identity): - """ - Constructs a SyncMapPermissionContext - - :param identity: Identity of the user to whom the Sync Map Permission applies. - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionContext - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionContext - """ - return SyncMapPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=identity, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.SyncMapPermissionList>' - - -class SyncMapPermissionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncMapPermissionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Sync Service Instance SID. - :param map_sid: Sync Map SID. - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionPage - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionPage - """ - super(SyncMapPermissionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncMapPermissionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Sync.SyncMapPermissionPage>' - - -class SyncMapPermissionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, map_sid, identity): - """ - Initialize the SyncMapPermissionContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param map_sid: Sync Map SID or unique name. - :param identity: Identity of the user to whom the Sync Map Permission applies. - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionContext - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionContext - """ - super(SyncMapPermissionContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Permissions/{identity}'.format(**self._solution) - - def fetch(self): - """ - Fetch a SyncMapPermissionInstance - - :returns: Fetched SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=self._solution['identity'], - ) - - def delete(self): - """ - Deletes the SyncMapPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, read, write, manage): - """ - Update the SyncMapPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: Updated SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - data = values.of({'Read': read, 'Write': write, 'Manage': manage, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=self._solution['identity'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.SyncMapPermissionContext {}>'.format(context) - - -class SyncMapPermissionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, map_sid, identity=None): - """ - Initialize the SyncMapPermissionInstance - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - super(SyncMapPermissionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'map_sid': payload['map_sid'], - 'identity': payload['identity'], - 'read': payload['read'], - 'write': payload['write'], - 'manage': payload['manage'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'map_sid': map_sid, - 'identity': identity or self._properties['identity'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapPermissionContext for this SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionContext - """ - if self._context is None: - self._context = SyncMapPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=self._solution['identity'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: Twilio Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Sync Service Instance SID. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def map_sid(self): - """ - :returns: Sync Map SID. - :rtype: unicode - """ - return self._properties['map_sid'] - - @property - def identity(self): - """ - :returns: Identity of the user to whom the Sync Map Permission applies. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def read(self): - """ - :returns: Read access. - :rtype: bool - """ - return self._properties['read'] - - @property - def write(self): - """ - :returns: Write access. - :rtype: bool - """ - return self._properties['write'] - - @property - def manage(self): - """ - :returns: Manage access. - :rtype: bool - """ - return self._properties['manage'] - - @property - def url(self): - """ - :returns: URL of this Sync Map Permission. - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a SyncMapPermissionInstance - - :returns: Fetched SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncMapPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, read, write, manage): - """ - Update the SyncMapPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: Updated SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - return self._proxy.update(read, write, manage, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Sync.SyncMapPermissionInstance {}>'.format(context) diff --git a/twilio/rest/preview/understand/__init__.py b/twilio/rest/preview/understand/__init__.py deleted file mode 100644 index 64335b9..0000000 --- a/twilio/rest/preview/understand/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.preview.understand.service import ServiceList - - -class Understand(Version): - - def __init__(self, domain): - """ - Initialize the Understand version of Preview - - :returns: Understand version of Preview - :rtype: twilio.rest.preview.understand.Understand.Understand - """ - super(Understand, self).__init__(domain) - self.version = 'understand' - self._services = None - - @property - def services(self): - """ - :rtype: twilio.rest.preview.understand.service.ServiceList - """ - if self._services is None: - self._services = ServiceList(self) - return self._services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand>' diff --git a/twilio/rest/preview/understand/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/understand/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 2fbce02..0000000 Binary files a/twilio/rest/preview/understand/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/understand/service/__init__.py b/twilio/rest/preview/understand/service/__init__.py deleted file mode 100644 index b787fd8..0000000 --- a/twilio/rest/preview/understand/service/__init__.py +++ /dev/null @@ -1,583 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.preview.understand.service.field_type import FieldTypeList -from twilio.rest.preview.understand.service.intent import IntentList -from twilio.rest.preview.understand.service.model_build import ModelBuildList -from twilio.rest.preview.understand.service.query import QueryList - - -class ServiceList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.understand.service.ServiceList - :rtype: twilio.rest.preview.understand.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.preview.understand.service.ServicePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.preview.understand.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def create(self, friendly_name=values.unset, log_queries=values.unset, - ttl=values.unset, unique_name=values.unset): - """ - Create a new ServiceInstance - - :param unicode friendly_name: The friendly_name - :param bool log_queries: The log_queries - :param unicode ttl: The ttl - :param unicode unique_name: The unique_name - - :returns: Newly created ServiceInstance - :rtype: twilio.rest.preview.understand.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'LogQueries': log_queries, - 'Ttl': ttl, - 'UniqueName': unique_name, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.ServiceContext - :rtype: twilio.rest.preview.understand.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.ServiceContext - :rtype: twilio.rest.preview.understand.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.ServiceList>' - - -class ServicePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.understand.service.ServicePage - :rtype: twilio.rest.preview.understand.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.service.ServiceInstance - :rtype: twilio.rest.preview.understand.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.ServicePage>' - - -class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.ServiceContext - :rtype: twilio.rest.preview.understand.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._field_types = None - self._intents = None - self._model_builds = None - self._queries = None - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.preview.understand.service.ServiceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, log_queries=values.unset, - ttl=values.unset, unique_name=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param bool log_queries: The log_queries - :param unicode ttl: The ttl - :param unicode unique_name: The unique_name - - :returns: Updated ServiceInstance - :rtype: twilio.rest.preview.understand.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'LogQueries': log_queries, - 'Ttl': ttl, - 'UniqueName': unique_name, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def field_types(self): - """ - Access the field_types - - :returns: twilio.rest.preview.understand.service.field_type.FieldTypeList - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeList - """ - if self._field_types is None: - self._field_types = FieldTypeList(self._version, service_sid=self._solution['sid'], ) - return self._field_types - - @property - def intents(self): - """ - Access the intents - - :returns: twilio.rest.preview.understand.service.intent.IntentList - :rtype: twilio.rest.preview.understand.service.intent.IntentList - """ - if self._intents is None: - self._intents = IntentList(self._version, service_sid=self._solution['sid'], ) - return self._intents - - @property - def model_builds(self): - """ - Access the model_builds - - :returns: twilio.rest.preview.understand.service.model_build.ModelBuildList - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildList - """ - if self._model_builds is None: - self._model_builds = ModelBuildList(self._version, service_sid=self._solution['sid'], ) - return self._model_builds - - @property - def queries(self): - """ - Access the queries - - :returns: twilio.rest.preview.understand.service.query.QueryList - :rtype: twilio.rest.preview.understand.service.query.QueryList - """ - if self._queries is None: - self._queries = QueryList(self._version, service_sid=self._solution['sid'], ) - return self._queries - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.ServiceContext {}>'.format(context) - - -class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.preview.understand.service.ServiceInstance - :rtype: twilio.rest.preview.understand.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'latest_model_build_sid': payload['latest_model_build_sid'], - 'links': payload['links'], - 'log_queries': payload['log_queries'], - 'sid': payload['sid'], - 'ttl': deserialize.integer(payload['ttl']), - 'unique_name': payload['unique_name'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.preview.understand.service.ServiceContext - """ - if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def latest_model_build_sid(self): - """ - :returns: The latest_model_build_sid - :rtype: unicode - """ - return self._properties['latest_model_build_sid'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def log_queries(self): - """ - :returns: The log_queries - :rtype: bool - """ - return self._properties['log_queries'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def ttl(self): - """ - :returns: The ttl - :rtype: unicode - """ - return self._properties['ttl'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.preview.understand.service.ServiceInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, log_queries=values.unset, - ttl=values.unset, unique_name=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param bool log_queries: The log_queries - :param unicode ttl: The ttl - :param unicode unique_name: The unique_name - - :returns: Updated ServiceInstance - :rtype: twilio.rest.preview.understand.service.ServiceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - log_queries=log_queries, - ttl=ttl, - unique_name=unique_name, - ) - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def field_types(self): - """ - Access the field_types - - :returns: twilio.rest.preview.understand.service.field_type.FieldTypeList - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeList - """ - return self._proxy.field_types - - @property - def intents(self): - """ - Access the intents - - :returns: twilio.rest.preview.understand.service.intent.IntentList - :rtype: twilio.rest.preview.understand.service.intent.IntentList - """ - return self._proxy.intents - - @property - def model_builds(self): - """ - Access the model_builds - - :returns: twilio.rest.preview.understand.service.model_build.ModelBuildList - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildList - """ - return self._proxy.model_builds - - @property - def queries(self): - """ - Access the queries - - :returns: twilio.rest.preview.understand.service.query.QueryList - :rtype: twilio.rest.preview.understand.service.query.QueryList - """ - return self._proxy.queries - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.ServiceInstance {}>'.format(context) diff --git a/twilio/rest/preview/understand/service/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/understand/service/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 8a30505..0000000 Binary files a/twilio/rest/preview/understand/service/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/understand/service/__pycache__/model_build.cpython-36.pyc b/twilio/rest/preview/understand/service/__pycache__/model_build.cpython-36.pyc deleted file mode 100644 index d386a00..0000000 Binary files a/twilio/rest/preview/understand/service/__pycache__/model_build.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/understand/service/__pycache__/query.cpython-36.pyc b/twilio/rest/preview/understand/service/__pycache__/query.cpython-36.pyc deleted file mode 100644 index 4d222ca..0000000 Binary files a/twilio/rest/preview/understand/service/__pycache__/query.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/understand/service/field_type/__init__.py b/twilio/rest/preview/understand/service/field_type/__init__.py deleted file mode 100644 index ef5b69b..0000000 --- a/twilio/rest/preview/understand/service/field_type/__init__.py +++ /dev/null @@ -1,490 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.preview.understand.service.field_type.field_value import FieldValueList - - -class FieldTypeList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the FieldTypeList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.preview.understand.service.field_type.FieldTypeList - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeList - """ - super(FieldTypeList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/FieldTypes'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FieldTypeInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.field_type.FieldTypeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FieldTypeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.field_type.FieldTypeInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FieldTypeInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FieldTypeInstance - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return FieldTypePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FieldTypeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FieldTypeInstance - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FieldTypePage(self._version, response, self._solution) - - def create(self, unique_name, friendly_name=values.unset): - """ - Create a new FieldTypeInstance - - :param unicode unique_name: The unique_name - :param unicode friendly_name: The friendly_name - - :returns: Newly created FieldTypeInstance - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeInstance - """ - data = values.of({'UniqueName': unique_name, 'FriendlyName': friendly_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return FieldTypeInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def get(self, sid): - """ - Constructs a FieldTypeContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.field_type.FieldTypeContext - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeContext - """ - return FieldTypeContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FieldTypeContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.field_type.FieldTypeContext - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeContext - """ - return FieldTypeContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.FieldTypeList>' - - -class FieldTypePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the FieldTypePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.preview.understand.service.field_type.FieldTypePage - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypePage - """ - super(FieldTypePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FieldTypeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.service.field_type.FieldTypeInstance - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeInstance - """ - return FieldTypeInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.FieldTypePage>' - - -class FieldTypeContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the FieldTypeContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.field_type.FieldTypeContext - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeContext - """ - super(FieldTypeContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/FieldTypes/{sid}'.format(**self._solution) - - # Dependents - self._field_values = None - - def fetch(self): - """ - Fetch a FieldTypeInstance - - :returns: Fetched FieldTypeInstance - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return FieldTypeInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, unique_name=values.unset): - """ - Update the FieldTypeInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - - :returns: Updated FieldTypeInstance - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeInstance - """ - data = values.of({'FriendlyName': friendly_name, 'UniqueName': unique_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return FieldTypeInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the FieldTypeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def field_values(self): - """ - Access the field_values - - :returns: twilio.rest.preview.understand.service.field_type.field_value.FieldValueList - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValueList - """ - if self._field_values is None: - self._field_values = FieldValueList( - self._version, - service_sid=self._solution['service_sid'], - field_type_sid=self._solution['sid'], - ) - return self._field_values - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.FieldTypeContext {}>'.format(context) - - -class FieldTypeInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the FieldTypeInstance - - :returns: twilio.rest.preview.understand.service.field_type.FieldTypeInstance - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeInstance - """ - super(FieldTypeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'links': payload['links'], - 'service_sid': payload['service_sid'], - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FieldTypeContext for this FieldTypeInstance - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeContext - """ - if self._context is None: - self._context = FieldTypeContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a FieldTypeInstance - - :returns: Fetched FieldTypeInstance - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, unique_name=values.unset): - """ - Update the FieldTypeInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - - :returns: Updated FieldTypeInstance - :rtype: twilio.rest.preview.understand.service.field_type.FieldTypeInstance - """ - return self._proxy.update(friendly_name=friendly_name, unique_name=unique_name, ) - - def delete(self): - """ - Deletes the FieldTypeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def field_values(self): - """ - Access the field_values - - :returns: twilio.rest.preview.understand.service.field_type.field_value.FieldValueList - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValueList - """ - return self._proxy.field_values - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.FieldTypeInstance {}>'.format(context) diff --git a/twilio/rest/preview/understand/service/field_type/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/understand/service/field_type/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index c559897..0000000 Binary files a/twilio/rest/preview/understand/service/field_type/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/understand/service/field_type/__pycache__/field_value.cpython-36.pyc b/twilio/rest/preview/understand/service/field_type/__pycache__/field_value.cpython-36.pyc deleted file mode 100644 index 4a32710..0000000 Binary files a/twilio/rest/preview/understand/service/field_type/__pycache__/field_value.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/understand/service/field_type/field_value.py b/twilio/rest/preview/understand/service/field_type/field_value.py deleted file mode 100644 index 2e4cd78..0000000 --- a/twilio/rest/preview/understand/service/field_type/field_value.py +++ /dev/null @@ -1,460 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class FieldValueList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, field_type_sid): - """ - Initialize the FieldValueList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param field_type_sid: The field_type_sid - - :returns: twilio.rest.preview.understand.service.field_type.field_value.FieldValueList - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValueList - """ - super(FieldValueList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'field_type_sid': field_type_sid, } - self._uri = '/Services/{service_sid}/FieldTypes/{field_type_sid}/FieldValues'.format(**self._solution) - - def stream(self, language=values.unset, limit=None, page_size=None): - """ - Streams FieldValueInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode language: The language - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.field_type.field_value.FieldValueInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(language=language, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, language=values.unset, limit=None, page_size=None): - """ - Lists FieldValueInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode language: The language - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.field_type.field_value.FieldValueInstance] - """ - return list(self.stream(language=language, limit=limit, page_size=page_size, )) - - def page(self, language=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of FieldValueInstance records from the API. - Request is executed immediately - - :param unicode language: The language - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FieldValueInstance - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValuePage - """ - params = values.of({ - 'Language': language, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return FieldValuePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FieldValueInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FieldValueInstance - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValuePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FieldValuePage(self._version, response, self._solution) - - def create(self, language, value): - """ - Create a new FieldValueInstance - - :param unicode language: The language - :param unicode value: The value - - :returns: Newly created FieldValueInstance - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValueInstance - """ - data = values.of({'Language': language, 'Value': value, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return FieldValueInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - field_type_sid=self._solution['field_type_sid'], - ) - - def get(self, sid): - """ - Constructs a FieldValueContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.field_type.field_value.FieldValueContext - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValueContext - """ - return FieldValueContext( - self._version, - service_sid=self._solution['service_sid'], - field_type_sid=self._solution['field_type_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a FieldValueContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.field_type.field_value.FieldValueContext - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValueContext - """ - return FieldValueContext( - self._version, - service_sid=self._solution['service_sid'], - field_type_sid=self._solution['field_type_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.FieldValueList>' - - -class FieldValuePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the FieldValuePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param field_type_sid: The field_type_sid - - :returns: twilio.rest.preview.understand.service.field_type.field_value.FieldValuePage - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValuePage - """ - super(FieldValuePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FieldValueInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.service.field_type.field_value.FieldValueInstance - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValueInstance - """ - return FieldValueInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - field_type_sid=self._solution['field_type_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.FieldValuePage>' - - -class FieldValueContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, field_type_sid, sid): - """ - Initialize the FieldValueContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param field_type_sid: The field_type_sid - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.field_type.field_value.FieldValueContext - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValueContext - """ - super(FieldValueContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'field_type_sid': field_type_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/FieldTypes/{field_type_sid}/FieldValues/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a FieldValueInstance - - :returns: Fetched FieldValueInstance - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValueInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return FieldValueInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - field_type_sid=self._solution['field_type_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the FieldValueInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.FieldValueContext {}>'.format(context) - - -class FieldValueInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, field_type_sid, sid=None): - """ - Initialize the FieldValueInstance - - :returns: twilio.rest.preview.understand.service.field_type.field_value.FieldValueInstance - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValueInstance - """ - super(FieldValueInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'field_type_sid': payload['field_type_sid'], - 'language': payload['language'], - 'service_sid': payload['service_sid'], - 'sid': payload['sid'], - 'value': payload['value'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'field_type_sid': field_type_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FieldValueContext for this FieldValueInstance - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValueContext - """ - if self._context is None: - self._context = FieldValueContext( - self._version, - service_sid=self._solution['service_sid'], - field_type_sid=self._solution['field_type_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def field_type_sid(self): - """ - :returns: The field_type_sid - :rtype: unicode - """ - return self._properties['field_type_sid'] - - @property - def language(self): - """ - :returns: The language - :rtype: unicode - """ - return self._properties['language'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def value(self): - """ - :returns: The value - :rtype: unicode - """ - return self._properties['value'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a FieldValueInstance - - :returns: Fetched FieldValueInstance - :rtype: twilio.rest.preview.understand.service.field_type.field_value.FieldValueInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the FieldValueInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.FieldValueInstance {}>'.format(context) diff --git a/twilio/rest/preview/understand/service/intent/__init__.py b/twilio/rest/preview/understand/service/intent/__init__.py deleted file mode 100644 index 4783a7e..0000000 --- a/twilio/rest/preview/understand/service/intent/__init__.py +++ /dev/null @@ -1,518 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.preview.understand.service.intent.field import FieldList -from twilio.rest.preview.understand.service.intent.sample import SampleList - - -class IntentList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the IntentList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.preview.understand.service.intent.IntentList - :rtype: twilio.rest.preview.understand.service.intent.IntentList - """ - super(IntentList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Intents'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams IntentInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.intent.IntentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists IntentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.intent.IntentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of IntentInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of IntentInstance - :rtype: twilio.rest.preview.understand.service.intent.IntentPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return IntentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of IntentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of IntentInstance - :rtype: twilio.rest.preview.understand.service.intent.IntentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return IntentPage(self._version, response, self._solution) - - def create(self, unique_name, friendly_name=values.unset): - """ - Create a new IntentInstance - - :param unicode unique_name: The unique_name - :param unicode friendly_name: The friendly_name - - :returns: Newly created IntentInstance - :rtype: twilio.rest.preview.understand.service.intent.IntentInstance - """ - data = values.of({'UniqueName': unique_name, 'FriendlyName': friendly_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return IntentInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def get(self, sid): - """ - Constructs a IntentContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.intent.IntentContext - :rtype: twilio.rest.preview.understand.service.intent.IntentContext - """ - return IntentContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a IntentContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.intent.IntentContext - :rtype: twilio.rest.preview.understand.service.intent.IntentContext - """ - return IntentContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.IntentList>' - - -class IntentPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the IntentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.preview.understand.service.intent.IntentPage - :rtype: twilio.rest.preview.understand.service.intent.IntentPage - """ - super(IntentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of IntentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.service.intent.IntentInstance - :rtype: twilio.rest.preview.understand.service.intent.IntentInstance - """ - return IntentInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.IntentPage>' - - -class IntentContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the IntentContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.intent.IntentContext - :rtype: twilio.rest.preview.understand.service.intent.IntentContext - """ - super(IntentContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Intents/{sid}'.format(**self._solution) - - # Dependents - self._fields = None - self._samples = None - - def fetch(self): - """ - Fetch a IntentInstance - - :returns: Fetched IntentInstance - :rtype: twilio.rest.preview.understand.service.intent.IntentInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return IntentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, unique_name=values.unset): - """ - Update the IntentInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - - :returns: Updated IntentInstance - :rtype: twilio.rest.preview.understand.service.intent.IntentInstance - """ - data = values.of({'FriendlyName': friendly_name, 'UniqueName': unique_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return IntentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the IntentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def fields(self): - """ - Access the fields - - :returns: twilio.rest.preview.understand.service.intent.field.FieldList - :rtype: twilio.rest.preview.understand.service.intent.field.FieldList - """ - if self._fields is None: - self._fields = FieldList( - self._version, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['sid'], - ) - return self._fields - - @property - def samples(self): - """ - Access the samples - - :returns: twilio.rest.preview.understand.service.intent.sample.SampleList - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleList - """ - if self._samples is None: - self._samples = SampleList( - self._version, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['sid'], - ) - return self._samples - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.IntentContext {}>'.format(context) - - -class IntentInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the IntentInstance - - :returns: twilio.rest.preview.understand.service.intent.IntentInstance - :rtype: twilio.rest.preview.understand.service.intent.IntentInstance - """ - super(IntentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'links': payload['links'], - 'service_sid': payload['service_sid'], - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: IntentContext for this IntentInstance - :rtype: twilio.rest.preview.understand.service.intent.IntentContext - """ - if self._context is None: - self._context = IntentContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a IntentInstance - - :returns: Fetched IntentInstance - :rtype: twilio.rest.preview.understand.service.intent.IntentInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, unique_name=values.unset): - """ - Update the IntentInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - - :returns: Updated IntentInstance - :rtype: twilio.rest.preview.understand.service.intent.IntentInstance - """ - return self._proxy.update(friendly_name=friendly_name, unique_name=unique_name, ) - - def delete(self): - """ - Deletes the IntentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def fields(self): - """ - Access the fields - - :returns: twilio.rest.preview.understand.service.intent.field.FieldList - :rtype: twilio.rest.preview.understand.service.intent.field.FieldList - """ - return self._proxy.fields - - @property - def samples(self): - """ - Access the samples - - :returns: twilio.rest.preview.understand.service.intent.sample.SampleList - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleList - """ - return self._proxy.samples - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.IntentInstance {}>'.format(context) diff --git a/twilio/rest/preview/understand/service/intent/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/understand/service/intent/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index a791fe7..0000000 Binary files a/twilio/rest/preview/understand/service/intent/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/understand/service/intent/__pycache__/field.cpython-36.pyc b/twilio/rest/preview/understand/service/intent/__pycache__/field.cpython-36.pyc deleted file mode 100644 index 1549971..0000000 Binary files a/twilio/rest/preview/understand/service/intent/__pycache__/field.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/understand/service/intent/__pycache__/sample.cpython-36.pyc b/twilio/rest/preview/understand/service/intent/__pycache__/sample.cpython-36.pyc deleted file mode 100644 index 061e0f3..0000000 Binary files a/twilio/rest/preview/understand/service/intent/__pycache__/sample.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/understand/service/intent/field.py b/twilio/rest/preview/understand/service/intent/field.py deleted file mode 100644 index 4645bb9..0000000 --- a/twilio/rest/preview/understand/service/intent/field.py +++ /dev/null @@ -1,452 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class FieldList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, intent_sid): - """ - Initialize the FieldList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param intent_sid: The intent_sid - - :returns: twilio.rest.preview.understand.service.intent.field.FieldList - :rtype: twilio.rest.preview.understand.service.intent.field.FieldList - """ - super(FieldList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'intent_sid': intent_sid, } - self._uri = '/Services/{service_sid}/Intents/{intent_sid}/Fields'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FieldInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.intent.field.FieldInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FieldInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.intent.field.FieldInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FieldInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FieldInstance - :rtype: twilio.rest.preview.understand.service.intent.field.FieldPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return FieldPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FieldInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FieldInstance - :rtype: twilio.rest.preview.understand.service.intent.field.FieldPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FieldPage(self._version, response, self._solution) - - def create(self, field_type, unique_name): - """ - Create a new FieldInstance - - :param unicode field_type: The field_type - :param unicode unique_name: The unique_name - - :returns: Newly created FieldInstance - :rtype: twilio.rest.preview.understand.service.intent.field.FieldInstance - """ - data = values.of({'FieldType': field_type, 'UniqueName': unique_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return FieldInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['intent_sid'], - ) - - def get(self, sid): - """ - Constructs a FieldContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.intent.field.FieldContext - :rtype: twilio.rest.preview.understand.service.intent.field.FieldContext - """ - return FieldContext( - self._version, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['intent_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a FieldContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.intent.field.FieldContext - :rtype: twilio.rest.preview.understand.service.intent.field.FieldContext - """ - return FieldContext( - self._version, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['intent_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.FieldList>' - - -class FieldPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the FieldPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param intent_sid: The intent_sid - - :returns: twilio.rest.preview.understand.service.intent.field.FieldPage - :rtype: twilio.rest.preview.understand.service.intent.field.FieldPage - """ - super(FieldPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FieldInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.service.intent.field.FieldInstance - :rtype: twilio.rest.preview.understand.service.intent.field.FieldInstance - """ - return FieldInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['intent_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.FieldPage>' - - -class FieldContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, intent_sid, sid): - """ - Initialize the FieldContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param intent_sid: The intent_sid - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.intent.field.FieldContext - :rtype: twilio.rest.preview.understand.service.intent.field.FieldContext - """ - super(FieldContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'intent_sid': intent_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Intents/{intent_sid}/Fields/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a FieldInstance - - :returns: Fetched FieldInstance - :rtype: twilio.rest.preview.understand.service.intent.field.FieldInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return FieldInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['intent_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the FieldInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.FieldContext {}>'.format(context) - - -class FieldInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, intent_sid, sid=None): - """ - Initialize the FieldInstance - - :returns: twilio.rest.preview.understand.service.intent.field.FieldInstance - :rtype: twilio.rest.preview.understand.service.intent.field.FieldInstance - """ - super(FieldInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'field_type': payload['field_type'], - 'intent_sid': payload['intent_sid'], - 'service_sid': payload['service_sid'], - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'intent_sid': intent_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FieldContext for this FieldInstance - :rtype: twilio.rest.preview.understand.service.intent.field.FieldContext - """ - if self._context is None: - self._context = FieldContext( - self._version, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['intent_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def field_type(self): - """ - :returns: The field_type - :rtype: unicode - """ - return self._properties['field_type'] - - @property - def intent_sid(self): - """ - :returns: The intent_sid - :rtype: unicode - """ - return self._properties['intent_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a FieldInstance - - :returns: Fetched FieldInstance - :rtype: twilio.rest.preview.understand.service.intent.field.FieldInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the FieldInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.FieldInstance {}>'.format(context) diff --git a/twilio/rest/preview/understand/service/intent/sample.py b/twilio/rest/preview/understand/service/intent/sample.py deleted file mode 100644 index ed7077e..0000000 --- a/twilio/rest/preview/understand/service/intent/sample.py +++ /dev/null @@ -1,498 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class SampleList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, intent_sid): - """ - Initialize the SampleList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param intent_sid: The intent_sid - - :returns: twilio.rest.preview.understand.service.intent.sample.SampleList - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleList - """ - super(SampleList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'intent_sid': intent_sid, } - self._uri = '/Services/{service_sid}/Intents/{intent_sid}/Samples'.format(**self._solution) - - def stream(self, language=values.unset, limit=None, page_size=None): - """ - Streams SampleInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode language: The language - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.intent.sample.SampleInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(language=language, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, language=values.unset, limit=None, page_size=None): - """ - Lists SampleInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode language: The language - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.intent.sample.SampleInstance] - """ - return list(self.stream(language=language, limit=limit, page_size=page_size, )) - - def page(self, language=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of SampleInstance records from the API. - Request is executed immediately - - :param unicode language: The language - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SampleInstance - :rtype: twilio.rest.preview.understand.service.intent.sample.SamplePage - """ - params = values.of({ - 'Language': language, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SamplePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SampleInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SampleInstance - :rtype: twilio.rest.preview.understand.service.intent.sample.SamplePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SamplePage(self._version, response, self._solution) - - def create(self, language, tagged_text): - """ - Create a new SampleInstance - - :param unicode language: The language - :param unicode tagged_text: The tagged_text - - :returns: Newly created SampleInstance - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleInstance - """ - data = values.of({'Language': language, 'TaggedText': tagged_text, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return SampleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['intent_sid'], - ) - - def get(self, sid): - """ - Constructs a SampleContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.intent.sample.SampleContext - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleContext - """ - return SampleContext( - self._version, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['intent_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a SampleContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.intent.sample.SampleContext - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleContext - """ - return SampleContext( - self._version, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['intent_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.SampleList>' - - -class SamplePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SamplePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param intent_sid: The intent_sid - - :returns: twilio.rest.preview.understand.service.intent.sample.SamplePage - :rtype: twilio.rest.preview.understand.service.intent.sample.SamplePage - """ - super(SamplePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SampleInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.service.intent.sample.SampleInstance - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleInstance - """ - return SampleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['intent_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.SamplePage>' - - -class SampleContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, intent_sid, sid): - """ - Initialize the SampleContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param intent_sid: The intent_sid - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.intent.sample.SampleContext - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleContext - """ - super(SampleContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'intent_sid': intent_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Intents/{intent_sid}/Samples/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a SampleInstance - - :returns: Fetched SampleInstance - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SampleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['intent_sid'], - sid=self._solution['sid'], - ) - - def update(self, language=values.unset, tagged_text=values.unset): - """ - Update the SampleInstance - - :param unicode language: The language - :param unicode tagged_text: The tagged_text - - :returns: Updated SampleInstance - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleInstance - """ - data = values.of({'Language': language, 'TaggedText': tagged_text, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SampleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['intent_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the SampleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.SampleContext {}>'.format(context) - - -class SampleInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, intent_sid, sid=None): - """ - Initialize the SampleInstance - - :returns: twilio.rest.preview.understand.service.intent.sample.SampleInstance - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleInstance - """ - super(SampleInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'intent_sid': payload['intent_sid'], - 'language': payload['language'], - 'service_sid': payload['service_sid'], - 'sid': payload['sid'], - 'tagged_text': payload['tagged_text'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'intent_sid': intent_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SampleContext for this SampleInstance - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleContext - """ - if self._context is None: - self._context = SampleContext( - self._version, - service_sid=self._solution['service_sid'], - intent_sid=self._solution['intent_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def intent_sid(self): - """ - :returns: The intent_sid - :rtype: unicode - """ - return self._properties['intent_sid'] - - @property - def language(self): - """ - :returns: The language - :rtype: unicode - """ - return self._properties['language'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def tagged_text(self): - """ - :returns: The tagged_text - :rtype: unicode - """ - return self._properties['tagged_text'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a SampleInstance - - :returns: Fetched SampleInstance - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleInstance - """ - return self._proxy.fetch() - - def update(self, language=values.unset, tagged_text=values.unset): - """ - Update the SampleInstance - - :param unicode language: The language - :param unicode tagged_text: The tagged_text - - :returns: Updated SampleInstance - :rtype: twilio.rest.preview.understand.service.intent.sample.SampleInstance - """ - return self._proxy.update(language=language, tagged_text=tagged_text, ) - - def delete(self): - """ - Deletes the SampleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.SampleInstance {}>'.format(context) diff --git a/twilio/rest/preview/understand/service/model_build.py b/twilio/rest/preview/understand/service/model_build.py deleted file mode 100644 index 04cbbfb..0000000 --- a/twilio/rest/preview/understand/service/model_build.py +++ /dev/null @@ -1,456 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class ModelBuildList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the ModelBuildList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.preview.understand.service.model_build.ModelBuildList - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildList - """ - super(ModelBuildList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/ModelBuilds'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ModelBuildInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.model_build.ModelBuildInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ModelBuildInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.model_build.ModelBuildInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ModelBuildInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ModelBuildInstance - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ModelBuildPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ModelBuildInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ModelBuildInstance - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ModelBuildPage(self._version, response, self._solution) - - def create(self, status_callback=values.unset, unique_name=values.unset): - """ - Create a new ModelBuildInstance - - :param unicode status_callback: The status_callback - :param unicode unique_name: The unique_name - - :returns: Newly created ModelBuildInstance - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildInstance - """ - data = values.of({'StatusCallback': status_callback, 'UniqueName': unique_name, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ModelBuildInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def get(self, sid): - """ - Constructs a ModelBuildContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.model_build.ModelBuildContext - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildContext - """ - return ModelBuildContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ModelBuildContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.model_build.ModelBuildContext - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildContext - """ - return ModelBuildContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.ModelBuildList>' - - -class ModelBuildPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ModelBuildPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.preview.understand.service.model_build.ModelBuildPage - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildPage - """ - super(ModelBuildPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ModelBuildInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.service.model_build.ModelBuildInstance - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildInstance - """ - return ModelBuildInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.ModelBuildPage>' - - -class ModelBuildContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the ModelBuildContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.model_build.ModelBuildContext - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildContext - """ - super(ModelBuildContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/ModelBuilds/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a ModelBuildInstance - - :returns: Fetched ModelBuildInstance - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ModelBuildInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def update(self, unique_name=values.unset): - """ - Update the ModelBuildInstance - - :param unicode unique_name: The unique_name - - :returns: Updated ModelBuildInstance - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildInstance - """ - data = values.of({'UniqueName': unique_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ModelBuildInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the ModelBuildInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.ModelBuildContext {}>'.format(context) - - -class ModelBuildInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - ENQUEUED = "enqueued" - BUILDING = "building" - COMPLETED = "completed" - FAILED = "failed" - CANCELED = "canceled" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ModelBuildInstance - - :returns: twilio.rest.preview.understand.service.model_build.ModelBuildInstance - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildInstance - """ - super(ModelBuildInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'service_sid': payload['service_sid'], - 'sid': payload['sid'], - 'status': payload['status'], - 'unique_name': payload['unique_name'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ModelBuildContext for this ModelBuildInstance - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildContext - """ - if self._context is None: - self._context = ModelBuildContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: ModelBuildInstance.Status - """ - return self._properties['status'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a ModelBuildInstance - - :returns: Fetched ModelBuildInstance - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildInstance - """ - return self._proxy.fetch() - - def update(self, unique_name=values.unset): - """ - Update the ModelBuildInstance - - :param unicode unique_name: The unique_name - - :returns: Updated ModelBuildInstance - :rtype: twilio.rest.preview.understand.service.model_build.ModelBuildInstance - """ - return self._proxy.update(unique_name=unique_name, ) - - def delete(self): - """ - Deletes the ModelBuildInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.ModelBuildInstance {}>'.format(context) diff --git a/twilio/rest/preview/understand/service/query.py b/twilio/rest/preview/understand/service/query.py deleted file mode 100644 index a0852a9..0000000 --- a/twilio/rest/preview/understand/service/query.py +++ /dev/null @@ -1,529 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class QueryList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the QueryList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.preview.understand.service.query.QueryList - :rtype: twilio.rest.preview.understand.service.query.QueryList - """ - super(QueryList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Queries'.format(**self._solution) - - def stream(self, language=values.unset, model_build=values.unset, - status=values.unset, limit=None, page_size=None): - """ - Streams QueryInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode language: The language - :param unicode model_build: The model_build - :param unicode status: The status - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.query.QueryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - language=language, - model_build=model_build, - status=status, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, language=values.unset, model_build=values.unset, - status=values.unset, limit=None, page_size=None): - """ - Lists QueryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode language: The language - :param unicode model_build: The model_build - :param unicode status: The status - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.service.query.QueryInstance] - """ - return list(self.stream( - language=language, - model_build=model_build, - status=status, - limit=limit, - page_size=page_size, - )) - - def page(self, language=values.unset, model_build=values.unset, - status=values.unset, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of QueryInstance records from the API. - Request is executed immediately - - :param unicode language: The language - :param unicode model_build: The model_build - :param unicode status: The status - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of QueryInstance - :rtype: twilio.rest.preview.understand.service.query.QueryPage - """ - params = values.of({ - 'Language': language, - 'ModelBuild': model_build, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return QueryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of QueryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of QueryInstance - :rtype: twilio.rest.preview.understand.service.query.QueryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return QueryPage(self._version, response, self._solution) - - def create(self, language, query, intent=values.unset, model_build=values.unset, - field=values.unset, named_entity=values.unset): - """ - Create a new QueryInstance - - :param unicode language: The language - :param unicode query: The query - :param unicode intent: The intent - :param unicode model_build: The model_build - :param unicode field: The field - :param unicode named_entity: The named_entity - - :returns: Newly created QueryInstance - :rtype: twilio.rest.preview.understand.service.query.QueryInstance - """ - data = values.of({ - 'Language': language, - 'Query': query, - 'Intent': intent, - 'ModelBuild': model_build, - 'Field': field, - 'NamedEntity': named_entity, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return QueryInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def get(self, sid): - """ - Constructs a QueryContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.query.QueryContext - :rtype: twilio.rest.preview.understand.service.query.QueryContext - """ - return QueryContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a QueryContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.query.QueryContext - :rtype: twilio.rest.preview.understand.service.query.QueryContext - """ - return QueryContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.QueryList>' - - -class QueryPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the QueryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.preview.understand.service.query.QueryPage - :rtype: twilio.rest.preview.understand.service.query.QueryPage - """ - super(QueryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of QueryInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.service.query.QueryInstance - :rtype: twilio.rest.preview.understand.service.query.QueryInstance - """ - return QueryInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Understand.QueryPage>' - - -class QueryContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the QueryContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.preview.understand.service.query.QueryContext - :rtype: twilio.rest.preview.understand.service.query.QueryContext - """ - super(QueryContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Queries/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a QueryInstance - - :returns: Fetched QueryInstance - :rtype: twilio.rest.preview.understand.service.query.QueryInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return QueryInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def update(self, sample_sid=values.unset, status=values.unset): - """ - Update the QueryInstance - - :param unicode sample_sid: The sample_sid - :param unicode status: The status - - :returns: Updated QueryInstance - :rtype: twilio.rest.preview.understand.service.query.QueryInstance - """ - data = values.of({'SampleSid': sample_sid, 'Status': status, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return QueryInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the QueryInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.QueryContext {}>'.format(context) - - -class QueryInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the QueryInstance - - :returns: twilio.rest.preview.understand.service.query.QueryInstance - :rtype: twilio.rest.preview.understand.service.query.QueryInstance - """ - super(QueryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'results': payload['results'], - 'language': payload['language'], - 'model_build_sid': payload['model_build_sid'], - 'query': payload['query'], - 'sample_sid': payload['sample_sid'], - 'service_sid': payload['service_sid'], - 'sid': payload['sid'], - 'status': payload['status'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: QueryContext for this QueryInstance - :rtype: twilio.rest.preview.understand.service.query.QueryContext - """ - if self._context is None: - self._context = QueryContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def results(self): - """ - :returns: The results - :rtype: dict - """ - return self._properties['results'] - - @property - def language(self): - """ - :returns: The language - :rtype: unicode - """ - return self._properties['language'] - - @property - def model_build_sid(self): - """ - :returns: The model_build_sid - :rtype: unicode - """ - return self._properties['model_build_sid'] - - @property - def query(self): - """ - :returns: The query - :rtype: unicode - """ - return self._properties['query'] - - @property - def sample_sid(self): - """ - :returns: The sample_sid - :rtype: unicode - """ - return self._properties['sample_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: unicode - """ - return self._properties['status'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a QueryInstance - - :returns: Fetched QueryInstance - :rtype: twilio.rest.preview.understand.service.query.QueryInstance - """ - return self._proxy.fetch() - - def update(self, sample_sid=values.unset, status=values.unset): - """ - Update the QueryInstance - - :param unicode sample_sid: The sample_sid - :param unicode status: The status - - :returns: Updated QueryInstance - :rtype: twilio.rest.preview.understand.service.query.QueryInstance - """ - return self._proxy.update(sample_sid=sample_sid, status=status, ) - - def delete(self): - """ - Deletes the QueryInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Understand.QueryInstance {}>'.format(context) diff --git a/twilio/rest/preview/wireless/__init__.py b/twilio/rest/preview/wireless/__init__.py deleted file mode 100644 index 72294ba..0000000 --- a/twilio/rest/preview/wireless/__init__.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.preview.wireless.command import CommandList -from twilio.rest.preview.wireless.rate_plan import RatePlanList -from twilio.rest.preview.wireless.sim import SimList - - -class Wireless(Version): - - def __init__(self, domain): - """ - Initialize the Wireless version of Preview - - :returns: Wireless version of Preview - :rtype: twilio.rest.preview.wireless.Wireless.Wireless - """ - super(Wireless, self).__init__(domain) - self.version = 'wireless' - self._commands = None - self._rate_plans = None - self._sims = None - - @property - def commands(self): - """ - :rtype: twilio.rest.preview.wireless.command.CommandList - """ - if self._commands is None: - self._commands = CommandList(self) - return self._commands - - @property - def rate_plans(self): - """ - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanList - """ - if self._rate_plans is None: - self._rate_plans = RatePlanList(self) - return self._rate_plans - - @property - def sims(self): - """ - :rtype: twilio.rest.preview.wireless.sim.SimList - """ - if self._sims is None: - self._sims = SimList(self) - return self._sims - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Wireless>' diff --git a/twilio/rest/preview/wireless/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/wireless/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index da2ca5b..0000000 Binary files a/twilio/rest/preview/wireless/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/wireless/__pycache__/command.cpython-36.pyc b/twilio/rest/preview/wireless/__pycache__/command.cpython-36.pyc deleted file mode 100644 index 44a9117..0000000 Binary files a/twilio/rest/preview/wireless/__pycache__/command.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/wireless/__pycache__/rate_plan.cpython-36.pyc b/twilio/rest/preview/wireless/__pycache__/rate_plan.cpython-36.pyc deleted file mode 100644 index 5e06d9d..0000000 Binary files a/twilio/rest/preview/wireless/__pycache__/rate_plan.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/wireless/command.py b/twilio/rest/preview/wireless/command.py deleted file mode 100644 index e3d536f..0000000 --- a/twilio/rest/preview/wireless/command.py +++ /dev/null @@ -1,462 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class CommandList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the CommandList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.wireless.command.CommandList - :rtype: twilio.rest.preview.wireless.command.CommandList - """ - super(CommandList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Commands'.format(**self._solution) - - def stream(self, device=values.unset, sim=values.unset, status=values.unset, - direction=values.unset, limit=None, page_size=None): - """ - Streams CommandInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode device: The device - :param unicode sim: The sim - :param unicode status: The status - :param unicode direction: The direction - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.wireless.command.CommandInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - device=device, - sim=sim, - status=status, - direction=direction, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, device=values.unset, sim=values.unset, status=values.unset, - direction=values.unset, limit=None, page_size=None): - """ - Lists CommandInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode device: The device - :param unicode sim: The sim - :param unicode status: The status - :param unicode direction: The direction - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.wireless.command.CommandInstance] - """ - return list(self.stream( - device=device, - sim=sim, - status=status, - direction=direction, - limit=limit, - page_size=page_size, - )) - - def page(self, device=values.unset, sim=values.unset, status=values.unset, - direction=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of CommandInstance records from the API. - Request is executed immediately - - :param unicode device: The device - :param unicode sim: The sim - :param unicode status: The status - :param unicode direction: The direction - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandPage - """ - params = values.of({ - 'Device': device, - 'Sim': sim, - 'Status': status, - 'Direction': direction, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CommandPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CommandInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CommandPage(self._version, response, self._solution) - - def create(self, command, device=values.unset, sim=values.unset, - callback_method=values.unset, callback_url=values.unset, - command_mode=values.unset, include_sid=values.unset): - """ - Create a new CommandInstance - - :param unicode command: The command - :param unicode device: The device - :param unicode sim: The sim - :param unicode callback_method: The callback_method - :param unicode callback_url: The callback_url - :param unicode command_mode: The command_mode - :param unicode include_sid: The include_sid - - :returns: Newly created CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandInstance - """ - data = values.of({ - 'Command': command, - 'Device': device, - 'Sim': sim, - 'CallbackMethod': callback_method, - 'CallbackUrl': callback_url, - 'CommandMode': command_mode, - 'IncludeSid': include_sid, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CommandInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a CommandContext - - :param sid: The sid - - :returns: twilio.rest.preview.wireless.command.CommandContext - :rtype: twilio.rest.preview.wireless.command.CommandContext - """ - return CommandContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CommandContext - - :param sid: The sid - - :returns: twilio.rest.preview.wireless.command.CommandContext - :rtype: twilio.rest.preview.wireless.command.CommandContext - """ - return CommandContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Wireless.CommandList>' - - -class CommandPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the CommandPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.wireless.command.CommandPage - :rtype: twilio.rest.preview.wireless.command.CommandPage - """ - super(CommandPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CommandInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.wireless.command.CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandInstance - """ - return CommandInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Wireless.CommandPage>' - - -class CommandContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the CommandContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.preview.wireless.command.CommandContext - :rtype: twilio.rest.preview.wireless.command.CommandContext - """ - super(CommandContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Commands/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a CommandInstance - - :returns: Fetched CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CommandInstance(self._version, payload, sid=self._solution['sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Wireless.CommandContext {}>'.format(context) - - -class CommandInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the CommandInstance - - :returns: twilio.rest.preview.wireless.command.CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandInstance - """ - super(CommandInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'device_sid': payload['device_sid'], - 'sim_sid': payload['sim_sid'], - 'command': payload['command'], - 'command_mode': payload['command_mode'], - 'status': payload['status'], - 'direction': payload['direction'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CommandContext for this CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandContext - """ - if self._context is None: - self._context = CommandContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def device_sid(self): - """ - :returns: The device_sid - :rtype: unicode - """ - return self._properties['device_sid'] - - @property - def sim_sid(self): - """ - :returns: The sim_sid - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def command(self): - """ - :returns: The command - :rtype: unicode - """ - return self._properties['command'] - - @property - def command_mode(self): - """ - :returns: The command_mode - :rtype: unicode - """ - return self._properties['command_mode'] - - @property - def status(self): - """ - :returns: The status - :rtype: unicode - """ - return self._properties['status'] - - @property - def direction(self): - """ - :returns: The direction - :rtype: unicode - """ - return self._properties['direction'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a CommandInstance - - :returns: Fetched CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Wireless.CommandInstance {}>'.format(context) diff --git a/twilio/rest/preview/wireless/rate_plan.py b/twilio/rest/preview/wireless/rate_plan.py deleted file mode 100644 index 5354641..0000000 --- a/twilio/rest/preview/wireless/rate_plan.py +++ /dev/null @@ -1,513 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class RatePlanList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the RatePlanList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanList - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanList - """ - super(RatePlanList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/RatePlans'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams RatePlanInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.wireless.rate_plan.RatePlanInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists RatePlanInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.wireless.rate_plan.RatePlanInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RatePlanInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return RatePlanPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RatePlanInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RatePlanPage(self._version, response, self._solution) - - def create(self, unique_name=values.unset, friendly_name=values.unset, - data_enabled=values.unset, data_limit=values.unset, - data_metering=values.unset, messaging_enabled=values.unset, - voice_enabled=values.unset, commands_enabled=values.unset, - national_roaming_enabled=values.unset, - international_roaming=values.unset): - """ - Create a new RatePlanInstance - - :param unicode unique_name: The unique_name - :param unicode friendly_name: The friendly_name - :param bool data_enabled: The data_enabled - :param unicode data_limit: The data_limit - :param unicode data_metering: The data_metering - :param bool messaging_enabled: The messaging_enabled - :param bool voice_enabled: The voice_enabled - :param bool commands_enabled: The commands_enabled - :param bool national_roaming_enabled: The national_roaming_enabled - :param unicode international_roaming: The international_roaming - - :returns: Newly created RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'FriendlyName': friendly_name, - 'DataEnabled': data_enabled, - 'DataLimit': data_limit, - 'DataMetering': data_metering, - 'MessagingEnabled': messaging_enabled, - 'VoiceEnabled': voice_enabled, - 'CommandsEnabled': commands_enabled, - 'NationalRoamingEnabled': national_roaming_enabled, - 'InternationalRoaming': serialize.map(international_roaming, lambda e: e), - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return RatePlanInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a RatePlanContext - - :param sid: The sid - - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanContext - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanContext - """ - return RatePlanContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RatePlanContext - - :param sid: The sid - - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanContext - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanContext - """ - return RatePlanContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Wireless.RatePlanList>' - - -class RatePlanPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the RatePlanPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanPage - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanPage - """ - super(RatePlanPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RatePlanInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - """ - return RatePlanInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Wireless.RatePlanPage>' - - -class RatePlanContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the RatePlanContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanContext - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanContext - """ - super(RatePlanContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/RatePlans/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a RatePlanInstance - - :returns: Fetched RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return RatePlanInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, unique_name=values.unset, friendly_name=values.unset): - """ - Update the RatePlanInstance - - :param unicode unique_name: The unique_name - :param unicode friendly_name: The friendly_name - - :returns: Updated RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - """ - data = values.of({'UniqueName': unique_name, 'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return RatePlanInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the RatePlanInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Wireless.RatePlanContext {}>'.format(context) - - -class RatePlanInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the RatePlanInstance - - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - """ - super(RatePlanInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'data_enabled': payload['data_enabled'], - 'data_metering': payload['data_metering'], - 'data_limit': deserialize.integer(payload['data_limit']), - 'messaging_enabled': payload['messaging_enabled'], - 'voice_enabled': payload['voice_enabled'], - 'national_roaming_enabled': payload['national_roaming_enabled'], - 'international_roaming': payload['international_roaming'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RatePlanContext for this RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanContext - """ - if self._context is None: - self._context = RatePlanContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def data_enabled(self): - """ - :returns: The data_enabled - :rtype: bool - """ - return self._properties['data_enabled'] - - @property - def data_metering(self): - """ - :returns: The data_metering - :rtype: unicode - """ - return self._properties['data_metering'] - - @property - def data_limit(self): - """ - :returns: The data_limit - :rtype: unicode - """ - return self._properties['data_limit'] - - @property - def messaging_enabled(self): - """ - :returns: The messaging_enabled - :rtype: bool - """ - return self._properties['messaging_enabled'] - - @property - def voice_enabled(self): - """ - :returns: The voice_enabled - :rtype: bool - """ - return self._properties['voice_enabled'] - - @property - def national_roaming_enabled(self): - """ - :returns: The national_roaming_enabled - :rtype: bool - """ - return self._properties['national_roaming_enabled'] - - @property - def international_roaming(self): - """ - :returns: The international_roaming - :rtype: unicode - """ - return self._properties['international_roaming'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a RatePlanInstance - - :returns: Fetched RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - """ - return self._proxy.fetch() - - def update(self, unique_name=values.unset, friendly_name=values.unset): - """ - Update the RatePlanInstance - - :param unicode unique_name: The unique_name - :param unicode friendly_name: The friendly_name - - :returns: Updated RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - """ - return self._proxy.update(unique_name=unique_name, friendly_name=friendly_name, ) - - def delete(self): - """ - Deletes the RatePlanInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Wireless.RatePlanInstance {}>'.format(context) diff --git a/twilio/rest/preview/wireless/sim/__init__.py b/twilio/rest/preview/wireless/sim/__init__.py deleted file mode 100644 index b331ae7..0000000 --- a/twilio/rest/preview/wireless/sim/__init__.py +++ /dev/null @@ -1,671 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.preview.wireless.sim.usage import UsageList - - -class SimList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the SimList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.wireless.sim.SimList - :rtype: twilio.rest.preview.wireless.sim.SimList - """ - super(SimList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Sims'.format(**self._solution) - - def stream(self, status=values.unset, iccid=values.unset, - rate_plan=values.unset, e_id=values.unset, - sim_registration_code=values.unset, limit=None, page_size=None): - """ - Streams SimInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode status: The status - :param unicode iccid: The iccid - :param unicode rate_plan: The rate_plan - :param unicode e_id: The e_id - :param unicode sim_registration_code: The sim_registration_code - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.wireless.sim.SimInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - iccid=iccid, - rate_plan=rate_plan, - e_id=e_id, - sim_registration_code=sim_registration_code, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, status=values.unset, iccid=values.unset, rate_plan=values.unset, - e_id=values.unset, sim_registration_code=values.unset, limit=None, - page_size=None): - """ - Lists SimInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode status: The status - :param unicode iccid: The iccid - :param unicode rate_plan: The rate_plan - :param unicode e_id: The e_id - :param unicode sim_registration_code: The sim_registration_code - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.wireless.sim.SimInstance] - """ - return list(self.stream( - status=status, - iccid=iccid, - rate_plan=rate_plan, - e_id=e_id, - sim_registration_code=sim_registration_code, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, iccid=values.unset, rate_plan=values.unset, - e_id=values.unset, sim_registration_code=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SimInstance records from the API. - Request is executed immediately - - :param unicode status: The status - :param unicode iccid: The iccid - :param unicode rate_plan: The rate_plan - :param unicode e_id: The e_id - :param unicode sim_registration_code: The sim_registration_code - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimPage - """ - params = values.of({ - 'Status': status, - 'Iccid': iccid, - 'RatePlan': rate_plan, - 'EId': e_id, - 'SimRegistrationCode': sim_registration_code, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SimPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SimInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SimPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SimContext - - :param sid: The sid - - :returns: twilio.rest.preview.wireless.sim.SimContext - :rtype: twilio.rest.preview.wireless.sim.SimContext - """ - return SimContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SimContext - - :param sid: The sid - - :returns: twilio.rest.preview.wireless.sim.SimContext - :rtype: twilio.rest.preview.wireless.sim.SimContext - """ - return SimContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Wireless.SimList>' - - -class SimPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SimPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.wireless.sim.SimPage - :rtype: twilio.rest.preview.wireless.sim.SimPage - """ - super(SimPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SimInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.wireless.sim.SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimInstance - """ - return SimInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Wireless.SimPage>' - - -class SimContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the SimContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.preview.wireless.sim.SimContext - :rtype: twilio.rest.preview.wireless.sim.SimContext - """ - super(SimContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Sims/{sid}'.format(**self._solution) - - # Dependents - self._usage = None - - def fetch(self): - """ - Fetch a SimInstance - - :returns: Fetched SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SimInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, unique_name=values.unset, callback_method=values.unset, - callback_url=values.unset, friendly_name=values.unset, - rate_plan=values.unset, status=values.unset, - commands_callback_method=values.unset, - commands_callback_url=values.unset, sms_fallback_method=values.unset, - sms_fallback_url=values.unset, sms_method=values.unset, - sms_url=values.unset, voice_fallback_method=values.unset, - voice_fallback_url=values.unset, voice_method=values.unset, - voice_url=values.unset): - """ - Update the SimInstance - - :param unicode unique_name: The unique_name - :param unicode callback_method: The callback_method - :param unicode callback_url: The callback_url - :param unicode friendly_name: The friendly_name - :param unicode rate_plan: The rate_plan - :param unicode status: The status - :param unicode commands_callback_method: The commands_callback_method - :param unicode commands_callback_url: The commands_callback_url - :param unicode sms_fallback_method: The sms_fallback_method - :param unicode sms_fallback_url: The sms_fallback_url - :param unicode sms_method: The sms_method - :param unicode sms_url: The sms_url - :param unicode voice_fallback_method: The voice_fallback_method - :param unicode voice_fallback_url: The voice_fallback_url - :param unicode voice_method: The voice_method - :param unicode voice_url: The voice_url - - :returns: Updated SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'CallbackMethod': callback_method, - 'CallbackUrl': callback_url, - 'FriendlyName': friendly_name, - 'RatePlan': rate_plan, - 'Status': status, - 'CommandsCallbackMethod': commands_callback_method, - 'CommandsCallbackUrl': commands_callback_url, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SimInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def usage(self): - """ - Access the usage - - :returns: twilio.rest.preview.wireless.sim.usage.UsageList - :rtype: twilio.rest.preview.wireless.sim.usage.UsageList - """ - if self._usage is None: - self._usage = UsageList(self._version, sim_sid=self._solution['sid'], ) - return self._usage - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Wireless.SimContext {}>'.format(context) - - -class SimInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the SimInstance - - :returns: twilio.rest.preview.wireless.sim.SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimInstance - """ - super(SimInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'account_sid': payload['account_sid'], - 'rate_plan_sid': payload['rate_plan_sid'], - 'friendly_name': payload['friendly_name'], - 'iccid': payload['iccid'], - 'e_id': payload['e_id'], - 'status': payload['status'], - 'commands_callback_url': payload['commands_callback_url'], - 'commands_callback_method': payload['commands_callback_method'], - 'sms_fallback_method': payload['sms_fallback_method'], - 'sms_fallback_url': payload['sms_fallback_url'], - 'sms_method': payload['sms_method'], - 'sms_url': payload['sms_url'], - 'voice_fallback_method': payload['voice_fallback_method'], - 'voice_fallback_url': payload['voice_fallback_url'], - 'voice_method': payload['voice_method'], - 'voice_url': payload['voice_url'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SimContext for this SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimContext - """ - if self._context is None: - self._context = SimContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def rate_plan_sid(self): - """ - :returns: The rate_plan_sid - :rtype: unicode - """ - return self._properties['rate_plan_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def iccid(self): - """ - :returns: The iccid - :rtype: unicode - """ - return self._properties['iccid'] - - @property - def e_id(self): - """ - :returns: The e_id - :rtype: unicode - """ - return self._properties['e_id'] - - @property - def status(self): - """ - :returns: The status - :rtype: unicode - """ - return self._properties['status'] - - @property - def commands_callback_url(self): - """ - :returns: The commands_callback_url - :rtype: unicode - """ - return self._properties['commands_callback_url'] - - @property - def commands_callback_method(self): - """ - :returns: The commands_callback_method - :rtype: unicode - """ - return self._properties['commands_callback_method'] - - @property - def sms_fallback_method(self): - """ - :returns: The sms_fallback_method - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The sms_method - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The sms_url - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def voice_fallback_method(self): - """ - :returns: The voice_fallback_method - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The voice_method - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: The voice_url - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a SimInstance - - :returns: Fetched SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimInstance - """ - return self._proxy.fetch() - - def update(self, unique_name=values.unset, callback_method=values.unset, - callback_url=values.unset, friendly_name=values.unset, - rate_plan=values.unset, status=values.unset, - commands_callback_method=values.unset, - commands_callback_url=values.unset, sms_fallback_method=values.unset, - sms_fallback_url=values.unset, sms_method=values.unset, - sms_url=values.unset, voice_fallback_method=values.unset, - voice_fallback_url=values.unset, voice_method=values.unset, - voice_url=values.unset): - """ - Update the SimInstance - - :param unicode unique_name: The unique_name - :param unicode callback_method: The callback_method - :param unicode callback_url: The callback_url - :param unicode friendly_name: The friendly_name - :param unicode rate_plan: The rate_plan - :param unicode status: The status - :param unicode commands_callback_method: The commands_callback_method - :param unicode commands_callback_url: The commands_callback_url - :param unicode sms_fallback_method: The sms_fallback_method - :param unicode sms_fallback_url: The sms_fallback_url - :param unicode sms_method: The sms_method - :param unicode sms_url: The sms_url - :param unicode voice_fallback_method: The voice_fallback_method - :param unicode voice_fallback_url: The voice_fallback_url - :param unicode voice_method: The voice_method - :param unicode voice_url: The voice_url - - :returns: Updated SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimInstance - """ - return self._proxy.update( - unique_name=unique_name, - callback_method=callback_method, - callback_url=callback_url, - friendly_name=friendly_name, - rate_plan=rate_plan, - status=status, - commands_callback_method=commands_callback_method, - commands_callback_url=commands_callback_url, - sms_fallback_method=sms_fallback_method, - sms_fallback_url=sms_fallback_url, - sms_method=sms_method, - sms_url=sms_url, - voice_fallback_method=voice_fallback_method, - voice_fallback_url=voice_fallback_url, - voice_method=voice_method, - voice_url=voice_url, - ) - - @property - def usage(self): - """ - Access the usage - - :returns: twilio.rest.preview.wireless.sim.usage.UsageList - :rtype: twilio.rest.preview.wireless.sim.usage.UsageList - """ - return self._proxy.usage - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Wireless.SimInstance {}>'.format(context) diff --git a/twilio/rest/preview/wireless/sim/__pycache__/__init__.cpython-36.pyc b/twilio/rest/preview/wireless/sim/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index b31cd8d..0000000 Binary files a/twilio/rest/preview/wireless/sim/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/wireless/sim/__pycache__/usage.cpython-36.pyc b/twilio/rest/preview/wireless/sim/__pycache__/usage.cpython-36.pyc deleted file mode 100644 index 998ed94..0000000 Binary files a/twilio/rest/preview/wireless/sim/__pycache__/usage.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/preview/wireless/sim/usage.py b/twilio/rest/preview/wireless/sim/usage.py deleted file mode 100644 index 13642a6..0000000 --- a/twilio/rest/preview/wireless/sim/usage.py +++ /dev/null @@ -1,294 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class UsageList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sim_sid): - """ - Initialize the UsageList - - :param Version version: Version that contains the resource - :param sim_sid: The sim_sid - - :returns: twilio.rest.preview.wireless.sim.usage.UsageList - :rtype: twilio.rest.preview.wireless.sim.usage.UsageList - """ - super(UsageList, self).__init__(version) - - # Path Solution - self._solution = {'sim_sid': sim_sid, } - - def get(self): - """ - Constructs a UsageContext - - :returns: twilio.rest.preview.wireless.sim.usage.UsageContext - :rtype: twilio.rest.preview.wireless.sim.usage.UsageContext - """ - return UsageContext(self._version, sim_sid=self._solution['sim_sid'], ) - - def __call__(self): - """ - Constructs a UsageContext - - :returns: twilio.rest.preview.wireless.sim.usage.UsageContext - :rtype: twilio.rest.preview.wireless.sim.usage.UsageContext - """ - return UsageContext(self._version, sim_sid=self._solution['sim_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Wireless.UsageList>' - - -class UsagePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the UsagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sim_sid: The sim_sid - - :returns: twilio.rest.preview.wireless.sim.usage.UsagePage - :rtype: twilio.rest.preview.wireless.sim.usage.UsagePage - """ - super(UsagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UsageInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.wireless.sim.usage.UsageInstance - :rtype: twilio.rest.preview.wireless.sim.usage.UsageInstance - """ - return UsageInstance(self._version, payload, sim_sid=self._solution['sim_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Preview.Wireless.UsagePage>' - - -class UsageContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sim_sid): - """ - Initialize the UsageContext - - :param Version version: Version that contains the resource - :param sim_sid: The sim_sid - - :returns: twilio.rest.preview.wireless.sim.usage.UsageContext - :rtype: twilio.rest.preview.wireless.sim.usage.UsageContext - """ - super(UsageContext, self).__init__(version) - - # Path Solution - self._solution = {'sim_sid': sim_sid, } - self._uri = '/Sims/{sim_sid}/Usage'.format(**self._solution) - - def fetch(self, end=values.unset, start=values.unset): - """ - Fetch a UsageInstance - - :param unicode end: The end - :param unicode start: The start - - :returns: Fetched UsageInstance - :rtype: twilio.rest.preview.wireless.sim.usage.UsageInstance - """ - params = values.of({'End': end, 'Start': start, }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return UsageInstance(self._version, payload, sim_sid=self._solution['sim_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Wireless.UsageContext {}>'.format(context) - - -class UsageInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sim_sid): - """ - Initialize the UsageInstance - - :returns: twilio.rest.preview.wireless.sim.usage.UsageInstance - :rtype: twilio.rest.preview.wireless.sim.usage.UsageInstance - """ - super(UsageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sim_sid': payload['sim_sid'], - 'sim_unique_name': payload['sim_unique_name'], - 'account_sid': payload['account_sid'], - 'period': payload['period'], - 'commands_usage': payload['commands_usage'], - 'commands_costs': payload['commands_costs'], - 'data_usage': payload['data_usage'], - 'data_costs': payload['data_costs'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sim_sid': sim_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UsageContext for this UsageInstance - :rtype: twilio.rest.preview.wireless.sim.usage.UsageContext - """ - if self._context is None: - self._context = UsageContext(self._version, sim_sid=self._solution['sim_sid'], ) - return self._context - - @property - def sim_sid(self): - """ - :returns: The sim_sid - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def sim_unique_name(self): - """ - :returns: The sim_unique_name - :rtype: unicode - """ - return self._properties['sim_unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def period(self): - """ - :returns: The period - :rtype: dict - """ - return self._properties['period'] - - @property - def commands_usage(self): - """ - :returns: The commands_usage - :rtype: dict - """ - return self._properties['commands_usage'] - - @property - def commands_costs(self): - """ - :returns: The commands_costs - :rtype: dict - """ - return self._properties['commands_costs'] - - @property - def data_usage(self): - """ - :returns: The data_usage - :rtype: dict - """ - return self._properties['data_usage'] - - @property - def data_costs(self): - """ - :returns: The data_costs - :rtype: dict - """ - return self._properties['data_costs'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, end=values.unset, start=values.unset): - """ - Fetch a UsageInstance - - :param unicode end: The end - :param unicode start: The start - - :returns: Fetched UsageInstance - :rtype: twilio.rest.preview.wireless.sim.usage.UsageInstance - """ - return self._proxy.fetch(end=end, start=start, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Preview.Wireless.UsageInstance {}>'.format(context) diff --git a/twilio/rest/pricing/__init__.py b/twilio/rest/pricing/__init__.py deleted file mode 100644 index 66d6b92..0000000 --- a/twilio/rest/pricing/__init__.py +++ /dev/null @@ -1,67 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.pricing.v1 import V1 - - -class Pricing(Domain): - - def __init__(self, twilio): - """ - Initialize the Pricing Domain - - :returns: Domain for Pricing - :rtype: twilio.rest.pricing.Pricing - """ - super(Pricing, self).__init__(twilio) - - self.base_url = 'https://pricing.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of pricing - :rtype: twilio.rest.pricing.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def messaging(self): - """ - :rtype: twilio.rest.pricing.v1.messaging.MessagingList - """ - return self.v1.messaging - - @property - def phone_numbers(self): - """ - :rtype: twilio.rest.pricing.v1.phone_number.PhoneNumberList - """ - return self.v1.phone_numbers - - @property - def voice(self): - """ - :rtype: twilio.rest.pricing.v1.voice.VoiceList - """ - return self.v1.voice - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing>' diff --git a/twilio/rest/pricing/__pycache__/__init__.cpython-36.pyc b/twilio/rest/pricing/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 4354e86..0000000 Binary files a/twilio/rest/pricing/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/pricing/v1/__init__.py b/twilio/rest/pricing/v1/__init__.py deleted file mode 100644 index bdc8d5b..0000000 --- a/twilio/rest/pricing/v1/__init__.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.pricing.v1.messaging import MessagingList -from twilio.rest.pricing.v1.phone_number import PhoneNumberList -from twilio.rest.pricing.v1.voice import VoiceList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Pricing - - :returns: V1 version of Pricing - :rtype: twilio.rest.pricing.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._messaging = None - self._phone_numbers = None - self._voice = None - - @property - def messaging(self): - """ - :rtype: twilio.rest.pricing.v1.messaging.MessagingList - """ - if self._messaging is None: - self._messaging = MessagingList(self) - return self._messaging - - @property - def phone_numbers(self): - """ - :rtype: twilio.rest.pricing.v1.phone_number.PhoneNumberList - """ - if self._phone_numbers is None: - self._phone_numbers = PhoneNumberList(self) - return self._phone_numbers - - @property - def voice(self): - """ - :rtype: twilio.rest.pricing.v1.voice.VoiceList - """ - if self._voice is None: - self._voice = VoiceList(self) - return self._voice - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1>' diff --git a/twilio/rest/pricing/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/pricing/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 02c7f19..0000000 Binary files a/twilio/rest/pricing/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/pricing/v1/messaging/__init__.py b/twilio/rest/pricing/v1/messaging/__init__.py deleted file mode 100644 index 7391aaa..0000000 --- a/twilio/rest/pricing/v1/messaging/__init__.py +++ /dev/null @@ -1,146 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.pricing.v1.messaging.country import CountryList - - -class MessagingList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the MessagingList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v1.messaging.MessagingList - :rtype: twilio.rest.pricing.v1.messaging.MessagingList - """ - super(MessagingList, self).__init__(version) - - # Path Solution - self._solution = {} - - # Components - self._countries = None - - @property - def countries(self): - """ - Access the countries - - :returns: twilio.rest.pricing.v1.messaging.country.CountryList - :rtype: twilio.rest.pricing.v1.messaging.country.CountryList - """ - if self._countries is None: - self._countries = CountryList(self._version, ) - return self._countries - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.MessagingList>' - - -class MessagingPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the MessagingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.pricing.v1.messaging.MessagingPage - :rtype: twilio.rest.pricing.v1.messaging.MessagingPage - """ - super(MessagingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessagingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v1.messaging.MessagingInstance - :rtype: twilio.rest.pricing.v1.messaging.MessagingInstance - """ - return MessagingInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.MessagingPage>' - - -class MessagingInstance(InstanceResource): - """ """ - - def __init__(self, version, payload): - """ - Initialize the MessagingInstance - - :returns: twilio.rest.pricing.v1.messaging.MessagingInstance - :rtype: twilio.rest.pricing.v1.messaging.MessagingInstance - """ - super(MessagingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = {'name': payload['name'], 'url': payload['url'], 'links': payload['links'], } - - # Context - self._context = None - self._solution = {} - - @property - def name(self): - """ - :returns: The name - :rtype: unicode - """ - return self._properties['name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.MessagingInstance>' diff --git a/twilio/rest/pricing/v1/messaging/__pycache__/__init__.cpython-36.pyc b/twilio/rest/pricing/v1/messaging/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 859597c..0000000 Binary files a/twilio/rest/pricing/v1/messaging/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/pricing/v1/messaging/__pycache__/country.cpython-36.pyc b/twilio/rest/pricing/v1/messaging/__pycache__/country.cpython-36.pyc deleted file mode 100644 index 6c36a6a..0000000 Binary files a/twilio/rest/pricing/v1/messaging/__pycache__/country.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/pricing/v1/messaging/country.py b/twilio/rest/pricing/v1/messaging/country.py deleted file mode 100644 index d2e9ab7..0000000 --- a/twilio/rest/pricing/v1/messaging/country.py +++ /dev/null @@ -1,337 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class CountryList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the CountryList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v1.messaging.country.CountryList - :rtype: twilio.rest.pricing.v1.messaging.country.CountryList - """ - super(CountryList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Messaging/Countries'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CountryInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.pricing.v1.messaging.country.CountryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CountryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.pricing.v1.messaging.country.CountryInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CountryInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CountryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CountryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CountryPage(self._version, response, self._solution) - - def get(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The iso_country - - :returns: twilio.rest.pricing.v1.messaging.country.CountryContext - :rtype: twilio.rest.pricing.v1.messaging.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __call__(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The iso_country - - :returns: twilio.rest.pricing.v1.messaging.country.CountryContext - :rtype: twilio.rest.pricing.v1.messaging.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.CountryList>' - - -class CountryPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the CountryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.pricing.v1.messaging.country.CountryPage - :rtype: twilio.rest.pricing.v1.messaging.country.CountryPage - """ - super(CountryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CountryInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v1.messaging.country.CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryInstance - """ - return CountryInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.CountryPage>' - - -class CountryContext(InstanceContext): - """ """ - - def __init__(self, version, iso_country): - """ - Initialize the CountryContext - - :param Version version: Version that contains the resource - :param iso_country: The iso_country - - :returns: twilio.rest.pricing.v1.messaging.country.CountryContext - :rtype: twilio.rest.pricing.v1.messaging.country.CountryContext - """ - super(CountryContext, self).__init__(version) - - # Path Solution - self._solution = {'iso_country': iso_country, } - self._uri = '/Messaging/Countries/{iso_country}'.format(**self._solution) - - def fetch(self): - """ - Fetch a CountryInstance - - :returns: Fetched CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CountryInstance(self._version, payload, iso_country=self._solution['iso_country'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Pricing.V1.CountryContext {}>'.format(context) - - -class CountryInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, iso_country=None): - """ - Initialize the CountryInstance - - :returns: twilio.rest.pricing.v1.messaging.country.CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryInstance - """ - super(CountryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'country': payload['country'], - 'iso_country': payload['iso_country'], - 'url': payload['url'], - 'outbound_sms_prices': payload.get('outbound_sms_prices'), - 'inbound_sms_prices': payload.get('inbound_sms_prices'), - 'price_unit': payload.get('price_unit'), - } - - # Context - self._context = None - self._solution = {'iso_country': iso_country or self._properties['iso_country'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CountryContext for this CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryContext - """ - if self._context is None: - self._context = CountryContext(self._version, iso_country=self._solution['iso_country'], ) - return self._context - - @property - def country(self): - """ - :returns: The country - :rtype: unicode - """ - return self._properties['country'] - - @property - def iso_country(self): - """ - :returns: The iso_country - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def outbound_sms_prices(self): - """ - :returns: The outbound_sms_prices - :rtype: unicode - """ - return self._properties['outbound_sms_prices'] - - @property - def inbound_sms_prices(self): - """ - :returns: The inbound_sms_prices - :rtype: unicode - """ - return self._properties['inbound_sms_prices'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a CountryInstance - - :returns: Fetched CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Pricing.V1.CountryInstance {}>'.format(context) diff --git a/twilio/rest/pricing/v1/phone_number/__init__.py b/twilio/rest/pricing/v1/phone_number/__init__.py deleted file mode 100644 index 833e6a1..0000000 --- a/twilio/rest/pricing/v1/phone_number/__init__.py +++ /dev/null @@ -1,146 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.pricing.v1.phone_number.country import CountryList - - -class PhoneNumberList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the PhoneNumberList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v1.phone_number.PhoneNumberList - :rtype: twilio.rest.pricing.v1.phone_number.PhoneNumberList - """ - super(PhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {} - - # Components - self._countries = None - - @property - def countries(self): - """ - Access the countries - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryList - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryList - """ - if self._countries is None: - self._countries = CountryList(self._version, ) - return self._countries - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.PhoneNumberList>' - - -class PhoneNumberPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the PhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.pricing.v1.phone_number.PhoneNumberPage - :rtype: twilio.rest.pricing.v1.phone_number.PhoneNumberPage - """ - super(PhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v1.phone_number.PhoneNumberInstance - :rtype: twilio.rest.pricing.v1.phone_number.PhoneNumberInstance - """ - return PhoneNumberInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.PhoneNumberPage>' - - -class PhoneNumberInstance(InstanceResource): - """ """ - - def __init__(self, version, payload): - """ - Initialize the PhoneNumberInstance - - :returns: twilio.rest.pricing.v1.phone_number.PhoneNumberInstance - :rtype: twilio.rest.pricing.v1.phone_number.PhoneNumberInstance - """ - super(PhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = {'name': payload['name'], 'url': payload['url'], 'links': payload['links'], } - - # Context - self._context = None - self._solution = {} - - @property - def name(self): - """ - :returns: The name - :rtype: unicode - """ - return self._properties['name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.PhoneNumberInstance>' diff --git a/twilio/rest/pricing/v1/phone_number/__pycache__/__init__.cpython-36.pyc b/twilio/rest/pricing/v1/phone_number/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 2b99273..0000000 Binary files a/twilio/rest/pricing/v1/phone_number/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/pricing/v1/phone_number/__pycache__/country.cpython-36.pyc b/twilio/rest/pricing/v1/phone_number/__pycache__/country.cpython-36.pyc deleted file mode 100644 index ff3b713..0000000 Binary files a/twilio/rest/pricing/v1/phone_number/__pycache__/country.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/pricing/v1/phone_number/country.py b/twilio/rest/pricing/v1/phone_number/country.py deleted file mode 100644 index 658a553..0000000 --- a/twilio/rest/pricing/v1/phone_number/country.py +++ /dev/null @@ -1,328 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class CountryList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the CountryList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryList - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryList - """ - super(CountryList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/PhoneNumbers/Countries'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CountryInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.pricing.v1.phone_number.country.CountryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CountryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.pricing.v1.phone_number.country.CountryInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CountryInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CountryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CountryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CountryPage(self._version, response, self._solution) - - def get(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The iso_country - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryContext - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __call__(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The iso_country - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryContext - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.CountryList>' - - -class CountryPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the CountryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryPage - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryPage - """ - super(CountryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CountryInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryInstance - """ - return CountryInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.CountryPage>' - - -class CountryContext(InstanceContext): - """ """ - - def __init__(self, version, iso_country): - """ - Initialize the CountryContext - - :param Version version: Version that contains the resource - :param iso_country: The iso_country - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryContext - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryContext - """ - super(CountryContext, self).__init__(version) - - # Path Solution - self._solution = {'iso_country': iso_country, } - self._uri = '/PhoneNumbers/Countries/{iso_country}'.format(**self._solution) - - def fetch(self): - """ - Fetch a CountryInstance - - :returns: Fetched CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CountryInstance(self._version, payload, iso_country=self._solution['iso_country'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Pricing.V1.CountryContext {}>'.format(context) - - -class CountryInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, iso_country=None): - """ - Initialize the CountryInstance - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryInstance - """ - super(CountryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'country': payload['country'], - 'iso_country': payload['iso_country'], - 'url': payload['url'], - 'phone_number_prices': payload.get('phone_number_prices'), - 'price_unit': payload.get('price_unit'), - } - - # Context - self._context = None - self._solution = {'iso_country': iso_country or self._properties['iso_country'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CountryContext for this CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryContext - """ - if self._context is None: - self._context = CountryContext(self._version, iso_country=self._solution['iso_country'], ) - return self._context - - @property - def country(self): - """ - :returns: The country - :rtype: unicode - """ - return self._properties['country'] - - @property - def iso_country(self): - """ - :returns: The iso_country - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def phone_number_prices(self): - """ - :returns: The phone_number_prices - :rtype: unicode - """ - return self._properties['phone_number_prices'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a CountryInstance - - :returns: Fetched CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Pricing.V1.CountryInstance {}>'.format(context) diff --git a/twilio/rest/pricing/v1/voice/__init__.py b/twilio/rest/pricing/v1/voice/__init__.py deleted file mode 100644 index aa5fd3f..0000000 --- a/twilio/rest/pricing/v1/voice/__init__.py +++ /dev/null @@ -1,160 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.pricing.v1.voice.country import CountryList -from twilio.rest.pricing.v1.voice.number import NumberList - - -class VoiceList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the VoiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v1.voice.VoiceList - :rtype: twilio.rest.pricing.v1.voice.VoiceList - """ - super(VoiceList, self).__init__(version) - - # Path Solution - self._solution = {} - - # Components - self._numbers = None - self._countries = None - - @property - def numbers(self): - """ - Access the numbers - - :returns: twilio.rest.pricing.v1.voice.number.NumberList - :rtype: twilio.rest.pricing.v1.voice.number.NumberList - """ - if self._numbers is None: - self._numbers = NumberList(self._version, ) - return self._numbers - - @property - def countries(self): - """ - Access the countries - - :returns: twilio.rest.pricing.v1.voice.country.CountryList - :rtype: twilio.rest.pricing.v1.voice.country.CountryList - """ - if self._countries is None: - self._countries = CountryList(self._version, ) - return self._countries - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.VoiceList>' - - -class VoicePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the VoicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.pricing.v1.voice.VoicePage - :rtype: twilio.rest.pricing.v1.voice.VoicePage - """ - super(VoicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of VoiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v1.voice.VoiceInstance - :rtype: twilio.rest.pricing.v1.voice.VoiceInstance - """ - return VoiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.VoicePage>' - - -class VoiceInstance(InstanceResource): - """ """ - - def __init__(self, version, payload): - """ - Initialize the VoiceInstance - - :returns: twilio.rest.pricing.v1.voice.VoiceInstance - :rtype: twilio.rest.pricing.v1.voice.VoiceInstance - """ - super(VoiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = {'name': payload['name'], 'url': payload['url'], 'links': payload['links'], } - - # Context - self._context = None - self._solution = {} - - @property - def name(self): - """ - :returns: The name - :rtype: unicode - """ - return self._properties['name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.VoiceInstance>' diff --git a/twilio/rest/pricing/v1/voice/__pycache__/__init__.cpython-36.pyc b/twilio/rest/pricing/v1/voice/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index ac33196..0000000 Binary files a/twilio/rest/pricing/v1/voice/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/pricing/v1/voice/__pycache__/country.cpython-36.pyc b/twilio/rest/pricing/v1/voice/__pycache__/country.cpython-36.pyc deleted file mode 100644 index c94f2f4..0000000 Binary files a/twilio/rest/pricing/v1/voice/__pycache__/country.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/pricing/v1/voice/__pycache__/number.cpython-36.pyc b/twilio/rest/pricing/v1/voice/__pycache__/number.cpython-36.pyc deleted file mode 100644 index a5fadb7..0000000 Binary files a/twilio/rest/pricing/v1/voice/__pycache__/number.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/pricing/v1/voice/country.py b/twilio/rest/pricing/v1/voice/country.py deleted file mode 100644 index 60a1587..0000000 --- a/twilio/rest/pricing/v1/voice/country.py +++ /dev/null @@ -1,337 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class CountryList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the CountryList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v1.voice.country.CountryList - :rtype: twilio.rest.pricing.v1.voice.country.CountryList - """ - super(CountryList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Voice/Countries'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CountryInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.pricing.v1.voice.country.CountryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CountryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.pricing.v1.voice.country.CountryInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CountryInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CountryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CountryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CountryPage(self._version, response, self._solution) - - def get(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The iso_country - - :returns: twilio.rest.pricing.v1.voice.country.CountryContext - :rtype: twilio.rest.pricing.v1.voice.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __call__(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The iso_country - - :returns: twilio.rest.pricing.v1.voice.country.CountryContext - :rtype: twilio.rest.pricing.v1.voice.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.CountryList>' - - -class CountryPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the CountryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.pricing.v1.voice.country.CountryPage - :rtype: twilio.rest.pricing.v1.voice.country.CountryPage - """ - super(CountryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CountryInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v1.voice.country.CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryInstance - """ - return CountryInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.CountryPage>' - - -class CountryContext(InstanceContext): - """ """ - - def __init__(self, version, iso_country): - """ - Initialize the CountryContext - - :param Version version: Version that contains the resource - :param iso_country: The iso_country - - :returns: twilio.rest.pricing.v1.voice.country.CountryContext - :rtype: twilio.rest.pricing.v1.voice.country.CountryContext - """ - super(CountryContext, self).__init__(version) - - # Path Solution - self._solution = {'iso_country': iso_country, } - self._uri = '/Voice/Countries/{iso_country}'.format(**self._solution) - - def fetch(self): - """ - Fetch a CountryInstance - - :returns: Fetched CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CountryInstance(self._version, payload, iso_country=self._solution['iso_country'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Pricing.V1.CountryContext {}>'.format(context) - - -class CountryInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, iso_country=None): - """ - Initialize the CountryInstance - - :returns: twilio.rest.pricing.v1.voice.country.CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryInstance - """ - super(CountryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'country': payload['country'], - 'iso_country': payload['iso_country'], - 'url': payload['url'], - 'outbound_prefix_prices': payload.get('outbound_prefix_prices'), - 'inbound_call_prices': payload.get('inbound_call_prices'), - 'price_unit': payload.get('price_unit'), - } - - # Context - self._context = None - self._solution = {'iso_country': iso_country or self._properties['iso_country'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CountryContext for this CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryContext - """ - if self._context is None: - self._context = CountryContext(self._version, iso_country=self._solution['iso_country'], ) - return self._context - - @property - def country(self): - """ - :returns: The country - :rtype: unicode - """ - return self._properties['country'] - - @property - def iso_country(self): - """ - :returns: The iso_country - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def outbound_prefix_prices(self): - """ - :returns: The outbound_prefix_prices - :rtype: unicode - """ - return self._properties['outbound_prefix_prices'] - - @property - def inbound_call_prices(self): - """ - :returns: The inbound_call_prices - :rtype: unicode - """ - return self._properties['inbound_call_prices'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a CountryInstance - - :returns: Fetched CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Pricing.V1.CountryInstance {}>'.format(context) diff --git a/twilio/rest/pricing/v1/voice/number.py b/twilio/rest/pricing/v1/voice/number.py deleted file mode 100644 index 1c1fff0..0000000 --- a/twilio/rest/pricing/v1/voice/number.py +++ /dev/null @@ -1,264 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class NumberList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the NumberList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v1.voice.number.NumberList - :rtype: twilio.rest.pricing.v1.voice.number.NumberList - """ - super(NumberList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, number): - """ - Constructs a NumberContext - - :param number: The number - - :returns: twilio.rest.pricing.v1.voice.number.NumberContext - :rtype: twilio.rest.pricing.v1.voice.number.NumberContext - """ - return NumberContext(self._version, number=number, ) - - def __call__(self, number): - """ - Constructs a NumberContext - - :param number: The number - - :returns: twilio.rest.pricing.v1.voice.number.NumberContext - :rtype: twilio.rest.pricing.v1.voice.number.NumberContext - """ - return NumberContext(self._version, number=number, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.NumberList>' - - -class NumberPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the NumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.pricing.v1.voice.number.NumberPage - :rtype: twilio.rest.pricing.v1.voice.number.NumberPage - """ - super(NumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v1.voice.number.NumberInstance - :rtype: twilio.rest.pricing.v1.voice.number.NumberInstance - """ - return NumberInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Pricing.V1.NumberPage>' - - -class NumberContext(InstanceContext): - """ """ - - def __init__(self, version, number): - """ - Initialize the NumberContext - - :param Version version: Version that contains the resource - :param number: The number - - :returns: twilio.rest.pricing.v1.voice.number.NumberContext - :rtype: twilio.rest.pricing.v1.voice.number.NumberContext - """ - super(NumberContext, self).__init__(version) - - # Path Solution - self._solution = {'number': number, } - self._uri = '/Voice/Numbers/{number}'.format(**self._solution) - - def fetch(self): - """ - Fetch a NumberInstance - - :returns: Fetched NumberInstance - :rtype: twilio.rest.pricing.v1.voice.number.NumberInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return NumberInstance(self._version, payload, number=self._solution['number'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Pricing.V1.NumberContext {}>'.format(context) - - -class NumberInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, number=None): - """ - Initialize the NumberInstance - - :returns: twilio.rest.pricing.v1.voice.number.NumberInstance - :rtype: twilio.rest.pricing.v1.voice.number.NumberInstance - """ - super(NumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'number': payload['number'], - 'country': payload['country'], - 'iso_country': payload['iso_country'], - 'outbound_call_price': payload['outbound_call_price'], - 'inbound_call_price': payload['inbound_call_price'], - 'price_unit': payload['price_unit'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'number': number or self._properties['number'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: NumberContext for this NumberInstance - :rtype: twilio.rest.pricing.v1.voice.number.NumberContext - """ - if self._context is None: - self._context = NumberContext(self._version, number=self._solution['number'], ) - return self._context - - @property - def number(self): - """ - :returns: The number - :rtype: unicode - """ - return self._properties['number'] - - @property - def country(self): - """ - :returns: The country - :rtype: unicode - """ - return self._properties['country'] - - @property - def iso_country(self): - """ - :returns: The iso_country - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def outbound_call_price(self): - """ - :returns: The outbound_call_price - :rtype: unicode - """ - return self._properties['outbound_call_price'] - - @property - def inbound_call_price(self): - """ - :returns: The inbound_call_price - :rtype: unicode - """ - return self._properties['inbound_call_price'] - - @property - def price_unit(self): - """ - :returns: The price_unit - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a NumberInstance - - :returns: Fetched NumberInstance - :rtype: twilio.rest.pricing.v1.voice.number.NumberInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Pricing.V1.NumberInstance {}>'.format(context) diff --git a/twilio/rest/proxy/__init__.py b/twilio/rest/proxy/__init__.py deleted file mode 100644 index 71283f0..0000000 --- a/twilio/rest/proxy/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.proxy.v1 import V1 - - -class Proxy(Domain): - - def __init__(self, twilio): - """ - Initialize the Proxy Domain - - :returns: Domain for Proxy - :rtype: twilio.rest.proxy.Proxy - """ - super(Proxy, self).__init__(twilio) - - self.base_url = 'https://proxy.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of proxy - :rtype: twilio.rest.proxy.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def services(self): - """ - :rtype: twilio.rest.proxy.v1.service.ServiceList - """ - return self.v1.services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy>' diff --git a/twilio/rest/proxy/__pycache__/__init__.cpython-36.pyc b/twilio/rest/proxy/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 1dcc2f9..0000000 Binary files a/twilio/rest/proxy/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/proxy/v1/__init__.py b/twilio/rest/proxy/v1/__init__.py deleted file mode 100644 index 73053a8..0000000 --- a/twilio/rest/proxy/v1/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.proxy.v1.service import ServiceList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Proxy - - :returns: V1 version of Proxy - :rtype: twilio.rest.proxy.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._services = None - - @property - def services(self): - """ - :rtype: twilio.rest.proxy.v1.service.ServiceList - """ - if self._services is None: - self._services = ServiceList(self) - return self._services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1>' diff --git a/twilio/rest/proxy/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/proxy/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index e883e29..0000000 Binary files a/twilio/rest/proxy/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/proxy/v1/service/__init__.py b/twilio/rest/proxy/v1/service/__init__.py deleted file mode 100644 index dbb3299..0000000 --- a/twilio/rest/proxy/v1/service/__init__.py +++ /dev/null @@ -1,610 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.proxy.v1.service.phone_number import PhoneNumberList -from twilio.rest.proxy.v1.service.session import SessionList -from twilio.rest.proxy.v1.service.short_code import ShortCodeList - - -class ServiceList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.proxy.v1.service.ServiceList - :rtype: twilio.rest.proxy.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServicePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def create(self, unique_name, default_ttl=values.unset, - callback_url=values.unset, geo_match_level=values.unset, - number_selection_behavior=values.unset, - intercept_callback_url=values.unset, - out_of_session_callback_url=values.unset): - """ - Create a new ServiceInstance - - :param unicode unique_name: The human-readable string that uniquely identifies this Service. - :param unicode default_ttl: Default TTL for a Session, in seconds. - :param unicode callback_url: URL Twilio will send callbacks to - :param ServiceInstance.GeoMatchLevel geo_match_level: Whether to find proxy numbers in the same areacode. - :param ServiceInstance.NumberSelectionBehavior number_selection_behavior: What behavior to use when choosing a proxy number. - :param unicode intercept_callback_url: A URL for Twilio call before each Interaction. - :param unicode out_of_session_callback_url: A URL for Twilio call when a new Interaction has no Session. - - :returns: Newly created ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'DefaultTtl': default_ttl, - 'CallbackUrl': callback_url, - 'GeoMatchLevel': geo_match_level, - 'NumberSelectionBehavior': number_selection_behavior, - 'InterceptCallbackUrl': intercept_callback_url, - 'OutOfSessionCallbackUrl': out_of_session_callback_url, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: A string that uniquely identifies this Service. - - :returns: twilio.rest.proxy.v1.service.ServiceContext - :rtype: twilio.rest.proxy.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: A string that uniquely identifies this Service. - - :returns: twilio.rest.proxy.v1.service.ServiceContext - :rtype: twilio.rest.proxy.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.ServiceList>' - - -class ServicePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.proxy.v1.service.ServicePage - :rtype: twilio.rest.proxy.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.proxy.v1.service.ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.ServicePage>' - - -class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: A string that uniquely identifies this Service. - - :returns: twilio.rest.proxy.v1.service.ServiceContext - :rtype: twilio.rest.proxy.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._sessions = None - self._phone_numbers = None - self._short_codes = None - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, unique_name=values.unset, default_ttl=values.unset, - callback_url=values.unset, geo_match_level=values.unset, - number_selection_behavior=values.unset, - intercept_callback_url=values.unset, - out_of_session_callback_url=values.unset): - """ - Update the ServiceInstance - - :param unicode unique_name: A human readable description of this resource. - :param unicode default_ttl: Default TTL for a Session, in seconds. - :param unicode callback_url: URL Twilio will send callbacks to - :param ServiceInstance.GeoMatchLevel geo_match_level: Whether to find proxy numbers in the same areacode. - :param ServiceInstance.NumberSelectionBehavior number_selection_behavior: What behavior to use when choosing a proxy number. - :param unicode intercept_callback_url: A URL for Twilio call before each Interaction. - :param unicode out_of_session_callback_url: A URL for Twilio call when a new Interaction has no Session. - - :returns: Updated ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'DefaultTtl': default_ttl, - 'CallbackUrl': callback_url, - 'GeoMatchLevel': geo_match_level, - 'NumberSelectionBehavior': number_selection_behavior, - 'InterceptCallbackUrl': intercept_callback_url, - 'OutOfSessionCallbackUrl': out_of_session_callback_url, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def sessions(self): - """ - Access the sessions - - :returns: twilio.rest.proxy.v1.service.session.SessionList - :rtype: twilio.rest.proxy.v1.service.session.SessionList - """ - if self._sessions is None: - self._sessions = SessionList(self._version, service_sid=self._solution['sid'], ) - return self._sessions - - @property - def phone_numbers(self): - """ - Access the phone_numbers - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberList - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberList - """ - if self._phone_numbers is None: - self._phone_numbers = PhoneNumberList(self._version, service_sid=self._solution['sid'], ) - return self._phone_numbers - - @property - def short_codes(self): - """ - Access the short_codes - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeList - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeList - """ - if self._short_codes is None: - self._short_codes = ShortCodeList(self._version, service_sid=self._solution['sid'], ) - return self._short_codes - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.ServiceContext {}>'.format(context) - - -class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class GeoMatchLevel(object): - AREA_CODE = "area-code" - OVERLAY = "overlay" - RADIUS = "radius" - COUNTRY = "country" - - class NumberSelectionBehavior(object): - AVOID_STICKY = "avoid-sticky" - PREFER_STICKY = "prefer-sticky" - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.proxy.v1.service.ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'account_sid': payload['account_sid'], - 'callback_url': payload['callback_url'], - 'default_ttl': deserialize.integer(payload['default_ttl']), - 'number_selection_behavior': payload['number_selection_behavior'], - 'geo_match_level': payload['geo_match_level'], - 'intercept_callback_url': payload['intercept_callback_url'], - 'out_of_session_callback_url': payload['out_of_session_callback_url'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceContext - """ - if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Service. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: A human readable description of this resource. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def callback_url(self): - """ - :returns: URL Twilio will send callbacks to - :rtype: unicode - """ - return self._properties['callback_url'] - - @property - def default_ttl(self): - """ - :returns: Default TTL for a Session, in seconds. - :rtype: unicode - """ - return self._properties['default_ttl'] - - @property - def number_selection_behavior(self): - """ - :returns: What behavior to use when choosing a proxy number. - :rtype: ServiceInstance.NumberSelectionBehavior - """ - return self._properties['number_selection_behavior'] - - @property - def geo_match_level(self): - """ - :returns: Whether to find proxy numbers in the same areacode. - :rtype: ServiceInstance.GeoMatchLevel - """ - return self._properties['geo_match_level'] - - @property - def intercept_callback_url(self): - """ - :returns: A URL for Twilio call before each Interaction. - :rtype: unicode - """ - return self._properties['intercept_callback_url'] - - @property - def out_of_session_callback_url(self): - """ - :returns: A URL for Twilio call when a new Interaction has no Session. - :rtype: unicode - """ - return self._properties['out_of_session_callback_url'] - - @property - def date_created(self): - """ - :returns: The date this Service was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Service was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, unique_name=values.unset, default_ttl=values.unset, - callback_url=values.unset, geo_match_level=values.unset, - number_selection_behavior=values.unset, - intercept_callback_url=values.unset, - out_of_session_callback_url=values.unset): - """ - Update the ServiceInstance - - :param unicode unique_name: A human readable description of this resource. - :param unicode default_ttl: Default TTL for a Session, in seconds. - :param unicode callback_url: URL Twilio will send callbacks to - :param ServiceInstance.GeoMatchLevel geo_match_level: Whether to find proxy numbers in the same areacode. - :param ServiceInstance.NumberSelectionBehavior number_selection_behavior: What behavior to use when choosing a proxy number. - :param unicode intercept_callback_url: A URL for Twilio call before each Interaction. - :param unicode out_of_session_callback_url: A URL for Twilio call when a new Interaction has no Session. - - :returns: Updated ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance - """ - return self._proxy.update( - unique_name=unique_name, - default_ttl=default_ttl, - callback_url=callback_url, - geo_match_level=geo_match_level, - number_selection_behavior=number_selection_behavior, - intercept_callback_url=intercept_callback_url, - out_of_session_callback_url=out_of_session_callback_url, - ) - - @property - def sessions(self): - """ - Access the sessions - - :returns: twilio.rest.proxy.v1.service.session.SessionList - :rtype: twilio.rest.proxy.v1.service.session.SessionList - """ - return self._proxy.sessions - - @property - def phone_numbers(self): - """ - Access the phone_numbers - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberList - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberList - """ - return self._proxy.phone_numbers - - @property - def short_codes(self): - """ - Access the short_codes - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeList - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeList - """ - return self._proxy.short_codes - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.ServiceInstance {}>'.format(context) diff --git a/twilio/rest/proxy/v1/service/__pycache__/__init__.cpython-36.pyc b/twilio/rest/proxy/v1/service/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index ede8065..0000000 Binary files a/twilio/rest/proxy/v1/service/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/proxy/v1/service/__pycache__/phone_number.cpython-36.pyc b/twilio/rest/proxy/v1/service/__pycache__/phone_number.cpython-36.pyc deleted file mode 100644 index b93171d..0000000 Binary files a/twilio/rest/proxy/v1/service/__pycache__/phone_number.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/proxy/v1/service/__pycache__/short_code.cpython-36.pyc b/twilio/rest/proxy/v1/service/__pycache__/short_code.cpython-36.pyc deleted file mode 100644 index 2f1f4e9..0000000 Binary files a/twilio/rest/proxy/v1/service/__pycache__/short_code.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/proxy/v1/service/phone_number.py b/twilio/rest/proxy/v1/service/phone_number.py deleted file mode 100644 index ac50864..0000000 --- a/twilio/rest/proxy/v1/service/phone_number.py +++ /dev/null @@ -1,428 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class PhoneNumberList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the PhoneNumberList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberList - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberList - """ - super(PhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/PhoneNumbers'.format(**self._solution) - - def create(self, sid=values.unset, phone_number=values.unset): - """ - Create a new PhoneNumberInstance - - :param unicode sid: A string that uniquely identifies this Phone Number. - :param unicode phone_number: The phone_number - - :returns: Newly created PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - """ - data = values.of({'Sid': sid, 'PhoneNumber': phone_number, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return PhoneNumberInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams PhoneNumberInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PhoneNumberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PhoneNumberInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return PhoneNumberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PhoneNumberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PhoneNumberPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a PhoneNumberContext - - :param sid: A string that uniquely identifies this Phone Number. - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a PhoneNumberContext - - :param sid: A string that uniquely identifies this Phone Number. - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.PhoneNumberList>' - - -class PhoneNumberPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the PhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberPage - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberPage - """ - super(PhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - """ - return PhoneNumberInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.PhoneNumberPage>' - - -class PhoneNumberContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the PhoneNumberContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param sid: A string that uniquely identifies this Phone Number. - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - """ - super(PhoneNumberContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/PhoneNumbers/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the PhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a PhoneNumberInstance - - :returns: Fetched PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return PhoneNumberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.PhoneNumberContext {}>'.format(context) - - -class PhoneNumberInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the PhoneNumberInstance - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - """ - super(PhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'phone_number': payload['phone_number'], - 'friendly_name': payload['friendly_name'], - 'iso_country': payload['iso_country'], - 'capabilities': payload['capabilities'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PhoneNumberContext for this PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - """ - if self._context is None: - self._context = PhoneNumberContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Phone Number. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The date this Phone Number was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Phone Number was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def phone_number(self): - """ - :returns: The phone number. - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def iso_country(self): - """ - :returns: ISO Country Code, - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def capabilities(self): - """ - :returns: A list of capabilities. - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - def delete(self): - """ - Deletes the PhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a PhoneNumberInstance - - :returns: Fetched PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.PhoneNumberInstance {}>'.format(context) diff --git a/twilio/rest/proxy/v1/service/session/__init__.py b/twilio/rest/proxy/v1/service/session/__init__.py deleted file mode 100644 index 0b42cc3..0000000 --- a/twilio/rest/proxy/v1/service/session/__init__.py +++ /dev/null @@ -1,644 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.proxy.v1.service.session.interaction import InteractionList -from twilio.rest.proxy.v1.service.session.participant import ParticipantList - - -class SessionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the SessionList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - - :returns: twilio.rest.proxy.v1.service.session.SessionList - :rtype: twilio.rest.proxy.v1.service.session.SessionList - """ - super(SessionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Sessions'.format(**self._solution) - - def stream(self, unique_name=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Streams SessionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode unique_name: A unique, developer assigned name of this Session. - :param SessionInstance.Status status: The Status of this Session - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.session.SessionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(unique_name=unique_name, status=status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, unique_name=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Lists SessionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode unique_name: A unique, developer assigned name of this Session. - :param SessionInstance.Status status: The Status of this Session - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.session.SessionInstance] - """ - return list(self.stream(unique_name=unique_name, status=status, limit=limit, page_size=page_size, )) - - def page(self, unique_name=values.unset, status=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SessionInstance records from the API. - Request is executed immediately - - :param unicode unique_name: A unique, developer assigned name of this Session. - :param SessionInstance.Status status: The Status of this Session - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionPage - """ - params = values.of({ - 'UniqueName': unique_name, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SessionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SessionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SessionPage(self._version, response, self._solution) - - def create(self, unique_name=values.unset, date_expiry=values.unset, - ttl=values.unset, mode=values.unset, status=values.unset, - participants=values.unset): - """ - Create a new SessionInstance - - :param unicode unique_name: A unique, developer assigned name of this Session. - :param datetime date_expiry: The date this Session was expiry - :param unicode ttl: TTL for a Session, in seconds. - :param SessionInstance.Mode mode: The Mode of this Session - :param SessionInstance.Status status: The Status of this Session - :param dict participants: A list of phone numbers to add to this Session. - - :returns: Newly created SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'DateExpiry': serialize.iso8601_datetime(date_expiry), - 'Ttl': ttl, - 'Mode': mode, - 'Status': status, - 'Participants': serialize.map(participants, lambda e: serialize.object(e)), - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return SessionInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def get(self, sid): - """ - Constructs a SessionContext - - :param sid: A string that uniquely identifies this Session. - - :returns: twilio.rest.proxy.v1.service.session.SessionContext - :rtype: twilio.rest.proxy.v1.service.session.SessionContext - """ - return SessionContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SessionContext - - :param sid: A string that uniquely identifies this Session. - - :returns: twilio.rest.proxy.v1.service.session.SessionContext - :rtype: twilio.rest.proxy.v1.service.session.SessionContext - """ - return SessionContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.SessionList>' - - -class SessionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SessionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - - :returns: twilio.rest.proxy.v1.service.session.SessionPage - :rtype: twilio.rest.proxy.v1.service.session.SessionPage - """ - super(SessionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SessionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.proxy.v1.service.session.SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance - """ - return SessionInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.SessionPage>' - - -class SessionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the SessionContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param sid: A string that uniquely identifies this Session. - - :returns: twilio.rest.proxy.v1.service.session.SessionContext - :rtype: twilio.rest.proxy.v1.service.session.SessionContext - """ - super(SessionContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Sessions/{sid}'.format(**self._solution) - - # Dependents - self._interactions = None - self._participants = None - - def fetch(self): - """ - Fetch a SessionInstance - - :returns: Fetched SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SessionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the SessionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, unique_name=values.unset, date_expiry=values.unset, - ttl=values.unset, mode=values.unset, status=values.unset, - participants=values.unset): - """ - Update the SessionInstance - - :param unicode unique_name: A unique, developer assigned name of this Session. - :param datetime date_expiry: The date this Session was expiry - :param unicode ttl: TTL for a Session, in seconds. - :param SessionInstance.Mode mode: The Mode of this Session - :param SessionInstance.Status status: The Status of this Session - :param dict participants: A list of phone numbers to add to this Session. - - :returns: Updated SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'DateExpiry': serialize.iso8601_datetime(date_expiry), - 'Ttl': ttl, - 'Mode': mode, - 'Status': status, - 'Participants': serialize.map(participants, lambda e: serialize.object(e)), - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SessionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def interactions(self): - """ - Access the interactions - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionList - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionList - """ - if self._interactions is None: - self._interactions = InteractionList( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['sid'], - ) - return self._interactions - - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantList - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantList - """ - if self._participants is None: - self._participants = ParticipantList( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['sid'], - ) - return self._participants - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.SessionContext {}>'.format(context) - - -class SessionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Status(object): - IN_PROGRESS = "in-progress" - CLOSED = "closed" - FAILED = "failed" - UNKNOWN = "unknown" - COMPLETED = "completed" - - class Mode(object): - MESSAGE_ONLY = "message-only" - VOICE_ONLY = "voice-only" - VOICE_AND_MESSAGE = "voice-and-message" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the SessionInstance - - :returns: twilio.rest.proxy.v1.service.session.SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance - """ - super(SessionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'service_sid': payload['service_sid'], - 'account_sid': payload['account_sid'], - 'date_started': deserialize.iso8601_datetime(payload['date_started']), - 'date_ended': deserialize.iso8601_datetime(payload['date_ended']), - 'date_last_interaction': deserialize.iso8601_datetime(payload['date_last_interaction']), - 'date_expiry': deserialize.iso8601_datetime(payload['date_expiry']), - 'unique_name': payload['unique_name'], - 'status': payload['status'], - 'closed_reason': payload['closed_reason'], - 'ttl': deserialize.integer(payload['ttl']), - 'mode': payload['mode'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SessionContext for this SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionContext - """ - if self._context is None: - self._context = SessionContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Session. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_started(self): - """ - :returns: The date this Session was started - :rtype: datetime - """ - return self._properties['date_started'] - - @property - def date_ended(self): - """ - :returns: The date this Session was ended - :rtype: datetime - """ - return self._properties['date_ended'] - - @property - def date_last_interaction(self): - """ - :returns: The date this Session was interaction - :rtype: datetime - """ - return self._properties['date_last_interaction'] - - @property - def date_expiry(self): - """ - :returns: The date this Session was expiry - :rtype: datetime - """ - return self._properties['date_expiry'] - - @property - def unique_name(self): - """ - :returns: A unique, developer assigned name of this Session. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def status(self): - """ - :returns: The Status of this Session - :rtype: SessionInstance.Status - """ - return self._properties['status'] - - @property - def closed_reason(self): - """ - :returns: Reason Session ended. - :rtype: unicode - """ - return self._properties['closed_reason'] - - @property - def ttl(self): - """ - :returns: TTL for a Session, in seconds. - :rtype: unicode - """ - return self._properties['ttl'] - - @property - def mode(self): - """ - :returns: The Mode of this Session - :rtype: SessionInstance.Mode - """ - return self._properties['mode'] - - @property - def date_created(self): - """ - :returns: The date this Session was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Session was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a SessionInstance - - :returns: Fetched SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SessionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, unique_name=values.unset, date_expiry=values.unset, - ttl=values.unset, mode=values.unset, status=values.unset, - participants=values.unset): - """ - Update the SessionInstance - - :param unicode unique_name: A unique, developer assigned name of this Session. - :param datetime date_expiry: The date this Session was expiry - :param unicode ttl: TTL for a Session, in seconds. - :param SessionInstance.Mode mode: The Mode of this Session - :param SessionInstance.Status status: The Status of this Session - :param dict participants: A list of phone numbers to add to this Session. - - :returns: Updated SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance - """ - return self._proxy.update( - unique_name=unique_name, - date_expiry=date_expiry, - ttl=ttl, - mode=mode, - status=status, - participants=participants, - ) - - @property - def interactions(self): - """ - Access the interactions - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionList - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionList - """ - return self._proxy.interactions - - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantList - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantList - """ - return self._proxy.participants - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.SessionInstance {}>'.format(context) diff --git a/twilio/rest/proxy/v1/service/session/__pycache__/__init__.cpython-36.pyc b/twilio/rest/proxy/v1/service/session/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index d7a0950..0000000 Binary files a/twilio/rest/proxy/v1/service/session/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/proxy/v1/service/session/__pycache__/interaction.cpython-36.pyc b/twilio/rest/proxy/v1/service/session/__pycache__/interaction.cpython-36.pyc deleted file mode 100644 index 194b825..0000000 Binary files a/twilio/rest/proxy/v1/service/session/__pycache__/interaction.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/proxy/v1/service/session/interaction.py b/twilio/rest/proxy/v1/service/session/interaction.py deleted file mode 100644 index 10d3514..0000000 --- a/twilio/rest/proxy/v1/service/session/interaction.py +++ /dev/null @@ -1,566 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class InteractionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, session_sid): - """ - Initialize the InteractionList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param session_sid: Session Sid. - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionList - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionList - """ - super(InteractionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'session_sid': session_sid, } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Interactions'.format(**self._solution) - - def stream(self, inbound_participant_status=values.unset, - outbound_participant_status=values.unset, limit=None, - page_size=None): - """ - Streams InteractionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param InteractionInstance.ResourceStatus inbound_participant_status: The Inbound Participant Status of this Interaction - :param InteractionInstance.ResourceStatus outbound_participant_status: The Outbound Participant Status of this Interaction - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.session.interaction.InteractionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - inbound_participant_status=inbound_participant_status, - outbound_participant_status=outbound_participant_status, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, inbound_participant_status=values.unset, - outbound_participant_status=values.unset, limit=None, page_size=None): - """ - Lists InteractionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param InteractionInstance.ResourceStatus inbound_participant_status: The Inbound Participant Status of this Interaction - :param InteractionInstance.ResourceStatus outbound_participant_status: The Outbound Participant Status of this Interaction - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.session.interaction.InteractionInstance] - """ - return list(self.stream( - inbound_participant_status=inbound_participant_status, - outbound_participant_status=outbound_participant_status, - limit=limit, - page_size=page_size, - )) - - def page(self, inbound_participant_status=values.unset, - outbound_participant_status=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of InteractionInstance records from the API. - Request is executed immediately - - :param InteractionInstance.ResourceStatus inbound_participant_status: The Inbound Participant Status of this Interaction - :param InteractionInstance.ResourceStatus outbound_participant_status: The Outbound Participant Status of this Interaction - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionPage - """ - params = values.of({ - 'InboundParticipantStatus': inbound_participant_status, - 'OutboundParticipantStatus': outbound_participant_status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return InteractionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of InteractionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InteractionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InteractionContext - - :param sid: A string that uniquely identifies this Interaction. - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - """ - return InteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a InteractionContext - - :param sid: A string that uniquely identifies this Interaction. - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - """ - return InteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.InteractionList>' - - -class InteractionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the InteractionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - :param session_sid: Session Sid. - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionPage - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionPage - """ - super(InteractionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InteractionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionInstance - """ - return InteractionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.InteractionPage>' - - -class InteractionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, session_sid, sid): - """ - Initialize the InteractionContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param session_sid: Session Sid. - :param sid: A string that uniquely identifies this Interaction. - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - """ - super(InteractionContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'session_sid': session_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Interactions/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a InteractionInstance - - :returns: Fetched InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return InteractionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the InteractionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.InteractionContext {}>'.format(context) - - -class InteractionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Type(object): - MESSAGE = "message" - VOICE = "voice" - UNKNOWN = "unknown" - - class ResourceStatus(object): - ACCEPTED = "accepted" - ANSWERED = "answered" - BUSY = "busy" - CANCELED = "canceled" - COMPLETED = "completed" - DELETED = "deleted" - DELIVERED = "delivered" - DELIVERY_UNKNOWN = "delivery-unknown" - FAILED = "failed" - IN_PROGRESS = "in-progress" - INITIATED = "initiated" - NO_ANSWER = "no-answer" - QUEUED = "queued" - RECEIVED = "received" - RECEIVING = "receiving" - RINGING = "ringing" - SCHEDULED = "scheduled" - SENDING = "sending" - SENT = "sent" - UNDELIVERED = "undelivered" - UNKNOWN = "unknown" - - def __init__(self, version, payload, service_sid, session_sid, sid=None): - """ - Initialize the InteractionInstance - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionInstance - """ - super(InteractionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'session_sid': payload['session_sid'], - 'service_sid': payload['service_sid'], - 'account_sid': payload['account_sid'], - 'data': payload['data'], - 'type': payload['type'], - 'inbound_participant_sid': payload['inbound_participant_sid'], - 'inbound_resource_sid': payload['inbound_resource_sid'], - 'inbound_resource_status': payload['inbound_resource_status'], - 'inbound_resource_type': payload['inbound_resource_type'], - 'inbound_resource_url': payload['inbound_resource_url'], - 'outbound_participant_sid': payload['outbound_participant_sid'], - 'outbound_resource_sid': payload['outbound_resource_sid'], - 'outbound_resource_status': payload['outbound_resource_status'], - 'outbound_resource_type': payload['outbound_resource_type'], - 'outbound_resource_url': payload['outbound_resource_url'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InteractionContext for this InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - """ - if self._context is None: - self._context = InteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Interaction. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def session_sid(self): - """ - :returns: Session Sid. - :rtype: unicode - """ - return self._properties['session_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def data(self): - """ - :returns: Further details about an interaction. - :rtype: unicode - """ - return self._properties['data'] - - @property - def type(self): - """ - :returns: The Type of this Interaction - :rtype: InteractionInstance.Type - """ - return self._properties['type'] - - @property - def inbound_participant_sid(self): - """ - :returns: Inbound Participant Sid. - :rtype: unicode - """ - return self._properties['inbound_participant_sid'] - - @property - def inbound_resource_sid(self): - """ - :returns: Inbound Resource Sid. - :rtype: unicode - """ - return self._properties['inbound_resource_sid'] - - @property - def inbound_resource_status(self): - """ - :returns: The Inbound Resource Status of this Interaction - :rtype: InteractionInstance.ResourceStatus - """ - return self._properties['inbound_resource_status'] - - @property - def inbound_resource_type(self): - """ - :returns: The type of the Inbound Resource, Call or Message. - :rtype: unicode - """ - return self._properties['inbound_resource_type'] - - @property - def inbound_resource_url(self): - """ - :returns: The URL of the Twilio resource. - :rtype: unicode - """ - return self._properties['inbound_resource_url'] - - @property - def outbound_participant_sid(self): - """ - :returns: Outbound Participant Sid. - :rtype: unicode - """ - return self._properties['outbound_participant_sid'] - - @property - def outbound_resource_sid(self): - """ - :returns: Outbound Resource Sid. - :rtype: unicode - """ - return self._properties['outbound_resource_sid'] - - @property - def outbound_resource_status(self): - """ - :returns: The Outbound Resource Status of this Interaction - :rtype: InteractionInstance.ResourceStatus - """ - return self._properties['outbound_resource_status'] - - @property - def outbound_resource_type(self): - """ - :returns: The type of the Outbound Resource, Call or Message. - :rtype: unicode - """ - return self._properties['outbound_resource_type'] - - @property - def outbound_resource_url(self): - """ - :returns: The URL of the Twilio resource. - :rtype: unicode - """ - return self._properties['outbound_resource_url'] - - @property - def date_created(self): - """ - :returns: The date this Interaction was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Interaction was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a InteractionInstance - - :returns: Fetched InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the InteractionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.InteractionInstance {}>'.format(context) diff --git a/twilio/rest/proxy/v1/service/session/participant/__init__.py b/twilio/rest/proxy/v1/service/session/participant/__init__.py deleted file mode 100644 index 735671c..0000000 --- a/twilio/rest/proxy/v1/service/session/participant/__init__.py +++ /dev/null @@ -1,585 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.proxy.v1.service.session.participant.message_interaction import MessageInteractionList - - -class ParticipantList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, session_sid): - """ - Initialize the ParticipantList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param session_sid: Session Sid. - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantList - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantList - """ - super(ParticipantList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'session_sid': session_sid, } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Participants'.format(**self._solution) - - def stream(self, identifier=values.unset, limit=None, page_size=None): - """ - Streams ParticipantInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode identifier: The identifier - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.session.participant.ParticipantInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identifier=identifier, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, identifier=values.unset, limit=None, page_size=None): - """ - Lists ParticipantInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode identifier: The identifier - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.session.participant.ParticipantInstance] - """ - return list(self.stream(identifier=identifier, limit=limit, page_size=page_size, )) - - def page(self, identifier=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ParticipantInstance records from the API. - Request is executed immediately - - :param unicode identifier: The identifier - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantPage - """ - params = values.of({ - 'Identifier': identifier, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ParticipantPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ParticipantInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ParticipantPage(self._version, response, self._solution) - - def create(self, identifier, friendly_name=values.unset, - proxy_identifier=values.unset, proxy_identifier_sid=values.unset): - """ - Create a new ParticipantInstance - - :param unicode identifier: The phone number of this Participant. - :param unicode friendly_name: A human readable description of this resource. - :param unicode proxy_identifier: The proxy phone number for this Participant. - :param unicode proxy_identifier_sid: Proxy Identifier Sid. - - :returns: Newly created ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - """ - data = values.of({ - 'Identifier': identifier, - 'FriendlyName': friendly_name, - 'ProxyIdentifier': proxy_identifier, - 'ProxyIdentifierSid': proxy_identifier_sid, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ParticipantInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - ) - - def get(self, sid): - """ - Constructs a ParticipantContext - - :param sid: A string that uniquely identifies this Participant. - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a ParticipantContext - - :param sid: A string that uniquely identifies this Participant. - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.ParticipantList>' - - -class ParticipantPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ParticipantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - :param session_sid: Session Sid. - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantPage - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantPage - """ - super(ParticipantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ParticipantInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - """ - return ParticipantInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.ParticipantPage>' - - -class ParticipantContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, session_sid, sid): - """ - Initialize the ParticipantContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param session_sid: Session Sid. - :param sid: A string that uniquely identifies this Participant. - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - """ - super(ParticipantContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'session_sid': session_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Participants/{sid}'.format(**self._solution) - - # Dependents - self._message_interactions = None - - def fetch(self): - """ - Fetch a ParticipantInstance - - :returns: Fetched ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ParticipantInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the ParticipantInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, identifier=values.unset, friendly_name=values.unset, - proxy_identifier=values.unset, proxy_identifier_sid=values.unset): - """ - Update the ParticipantInstance - - :param unicode identifier: The phone number of this Participant. - :param unicode friendly_name: A human readable description of this resource. - :param unicode proxy_identifier: The proxy phone number for this Participant. - :param unicode proxy_identifier_sid: Proxy Identifier Sid. - - :returns: Updated ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - """ - data = values.of({ - 'Identifier': identifier, - 'FriendlyName': friendly_name, - 'ProxyIdentifier': proxy_identifier, - 'ProxyIdentifierSid': proxy_identifier_sid, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ParticipantInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], - ) - - @property - def message_interactions(self): - """ - Access the message_interactions - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionList - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionList - """ - if self._message_interactions is None: - self._message_interactions = MessageInteractionList( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['sid'], - ) - return self._message_interactions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.ParticipantContext {}>'.format(context) - - -class ParticipantInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, session_sid, sid=None): - """ - Initialize the ParticipantInstance - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - """ - super(ParticipantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'session_sid': payload['session_sid'], - 'service_sid': payload['service_sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'identifier': payload['identifier'], - 'proxy_identifier': payload['proxy_identifier'], - 'proxy_identifier_sid': payload['proxy_identifier_sid'], - 'date_deleted': deserialize.iso8601_datetime(payload['date_deleted']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ParticipantContext for this ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - """ - if self._context is None: - self._context = ParticipantContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Participant. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def session_sid(self): - """ - :returns: Session Sid. - :rtype: unicode - """ - return self._properties['session_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def identifier(self): - """ - :returns: The phone number of this Participant. - :rtype: unicode - """ - return self._properties['identifier'] - - @property - def proxy_identifier(self): - """ - :returns: The proxy_identifier - :rtype: unicode - """ - return self._properties['proxy_identifier'] - - @property - def proxy_identifier_sid(self): - """ - :returns: Proxy Identifier Sid. - :rtype: unicode - """ - return self._properties['proxy_identifier_sid'] - - @property - def date_deleted(self): - """ - :returns: The date this Participant was deleted - :rtype: datetime - """ - return self._properties['date_deleted'] - - @property - def date_created(self): - """ - :returns: The date this Participant was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Participant was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ParticipantInstance - - :returns: Fetched ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ParticipantInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, identifier=values.unset, friendly_name=values.unset, - proxy_identifier=values.unset, proxy_identifier_sid=values.unset): - """ - Update the ParticipantInstance - - :param unicode identifier: The phone number of this Participant. - :param unicode friendly_name: A human readable description of this resource. - :param unicode proxy_identifier: The proxy phone number for this Participant. - :param unicode proxy_identifier_sid: Proxy Identifier Sid. - - :returns: Updated ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - """ - return self._proxy.update( - identifier=identifier, - friendly_name=friendly_name, - proxy_identifier=proxy_identifier, - proxy_identifier_sid=proxy_identifier_sid, - ) - - @property - def message_interactions(self): - """ - Access the message_interactions - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionList - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionList - """ - return self._proxy.message_interactions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.ParticipantInstance {}>'.format(context) diff --git a/twilio/rest/proxy/v1/service/session/participant/__pycache__/__init__.cpython-36.pyc b/twilio/rest/proxy/v1/service/session/participant/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index a8e9b91..0000000 Binary files a/twilio/rest/proxy/v1/service/session/participant/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/proxy/v1/service/session/participant/__pycache__/message_interaction.cpython-36.pyc b/twilio/rest/proxy/v1/service/session/participant/__pycache__/message_interaction.cpython-36.pyc deleted file mode 100644 index c0724f3..0000000 Binary files a/twilio/rest/proxy/v1/service/session/participant/__pycache__/message_interaction.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py b/twilio/rest/proxy/v1/service/session/participant/message_interaction.py deleted file mode 100644 index 15b2ee5..0000000 --- a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py +++ /dev/null @@ -1,578 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class MessageInteractionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, session_sid, participant_sid): - """ - Initialize the MessageInteractionList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param session_sid: Session Sid. - :param participant_sid: Participant Sid. - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionList - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionList - """ - super(MessageInteractionList, self).__init__(version) - - # Path Solution - self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'participant_sid': participant_sid, - } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Participants/{participant_sid}/MessageInteractions'.format(**self._solution) - - def create(self, body=values.unset, media_url=values.unset): - """ - Create a new MessageInteractionInstance - - :param unicode body: The body - :param unicode media_url: The media_url - - :returns: Newly created MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance - """ - data = values.of({'Body': body, 'MediaUrl': serialize.map(media_url, lambda e: e), }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return MessageInteractionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams MessageInteractionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists MessageInteractionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of MessageInteractionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return MessageInteractionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessageInteractionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessageInteractionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MessageInteractionContext - - :param sid: A string that uniquely identifies this Message Interaction. - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - """ - return MessageInteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MessageInteractionContext - - :param sid: A string that uniquely identifies this Message Interaction. - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - """ - return MessageInteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.MessageInteractionList>' - - -class MessageInteractionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the MessageInteractionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - :param session_sid: Session Sid. - :param participant_sid: Participant Sid. - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionPage - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionPage - """ - super(MessageInteractionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessageInteractionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance - """ - return MessageInteractionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.MessageInteractionPage>' - - -class MessageInteractionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, session_sid, participant_sid, sid): - """ - Initialize the MessageInteractionContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param session_sid: Session Sid. - :param participant_sid: Participant Sid. - :param sid: A string that uniquely identifies this Message Interaction. - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - """ - super(MessageInteractionContext, self).__init__(version) - - # Path Solution - self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'participant_sid': participant_sid, - 'sid': sid, - } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Participants/{participant_sid}/MessageInteractions/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a MessageInteractionInstance - - :returns: Fetched MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return MessageInteractionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.MessageInteractionContext {}>'.format(context) - - -class MessageInteractionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Type(object): - MESSAGE = "message" - VOICE = "voice" - UNKNOWN = "unknown" - - class ResourceStatus(object): - ACCEPTED = "accepted" - ANSWERED = "answered" - BUSY = "busy" - CANCELED = "canceled" - COMPLETED = "completed" - DELETED = "deleted" - DELIVERED = "delivered" - DELIVERY_UNKNOWN = "delivery-unknown" - FAILED = "failed" - IN_PROGRESS = "in-progress" - INITIATED = "initiated" - NO_ANSWER = "no-answer" - QUEUED = "queued" - RECEIVED = "received" - RECEIVING = "receiving" - RINGING = "ringing" - SCHEDULED = "scheduled" - SENDING = "sending" - SENT = "sent" - UNDELIVERED = "undelivered" - UNKNOWN = "unknown" - - def __init__(self, version, payload, service_sid, session_sid, participant_sid, - sid=None): - """ - Initialize the MessageInteractionInstance - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance - """ - super(MessageInteractionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'session_sid': payload['session_sid'], - 'service_sid': payload['service_sid'], - 'account_sid': payload['account_sid'], - 'data': payload['data'], - 'type': payload['type'], - 'participant_sid': payload['participant_sid'], - 'inbound_participant_sid': payload['inbound_participant_sid'], - 'inbound_resource_sid': payload['inbound_resource_sid'], - 'inbound_resource_status': payload['inbound_resource_status'], - 'inbound_resource_type': payload['inbound_resource_type'], - 'inbound_resource_url': payload['inbound_resource_url'], - 'outbound_participant_sid': payload['outbound_participant_sid'], - 'outbound_resource_sid': payload['outbound_resource_sid'], - 'outbound_resource_status': payload['outbound_resource_status'], - 'outbound_resource_type': payload['outbound_resource_type'], - 'outbound_resource_url': payload['outbound_resource_url'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'participant_sid': participant_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessageInteractionContext for this MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - """ - if self._context is None: - self._context = MessageInteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Message Interaction. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def session_sid(self): - """ - :returns: Session Sid. - :rtype: unicode - """ - return self._properties['session_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def data(self): - """ - :returns: Further details about an interaction. - :rtype: unicode - """ - return self._properties['data'] - - @property - def type(self): - """ - :returns: The Type of this Message Interaction - :rtype: MessageInteractionInstance.Type - """ - return self._properties['type'] - - @property - def participant_sid(self): - """ - :returns: Participant Sid. - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def inbound_participant_sid(self): - """ - :returns: Inbound Participant Sid. - :rtype: unicode - """ - return self._properties['inbound_participant_sid'] - - @property - def inbound_resource_sid(self): - """ - :returns: Inbound Resource Sid. - :rtype: unicode - """ - return self._properties['inbound_resource_sid'] - - @property - def inbound_resource_status(self): - """ - :returns: The Inbound Resource Status of this Message Interaction - :rtype: MessageInteractionInstance.ResourceStatus - """ - return self._properties['inbound_resource_status'] - - @property - def inbound_resource_type(self): - """ - :returns: The type of the Inbound Resource, Call or Message. - :rtype: unicode - """ - return self._properties['inbound_resource_type'] - - @property - def inbound_resource_url(self): - """ - :returns: The URL of the Twilio resource. - :rtype: unicode - """ - return self._properties['inbound_resource_url'] - - @property - def outbound_participant_sid(self): - """ - :returns: Outbound Participant Sid. - :rtype: unicode - """ - return self._properties['outbound_participant_sid'] - - @property - def outbound_resource_sid(self): - """ - :returns: Outbound Resource Sid. - :rtype: unicode - """ - return self._properties['outbound_resource_sid'] - - @property - def outbound_resource_status(self): - """ - :returns: The Outbound Resource Status of this Message Interaction - :rtype: MessageInteractionInstance.ResourceStatus - """ - return self._properties['outbound_resource_status'] - - @property - def outbound_resource_type(self): - """ - :returns: The type of the Outbound Resource, Call or Message. - :rtype: unicode - """ - return self._properties['outbound_resource_type'] - - @property - def outbound_resource_url(self): - """ - :returns: The URL of the Twilio resource. - :rtype: unicode - """ - return self._properties['outbound_resource_url'] - - @property - def date_created(self): - """ - :returns: The date this Message Interaction was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Message Interaction was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a MessageInteractionInstance - - :returns: Fetched MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.MessageInteractionInstance {}>'.format(context) diff --git a/twilio/rest/proxy/v1/service/short_code.py b/twilio/rest/proxy/v1/service/short_code.py deleted file mode 100644 index 7c32034..0000000 --- a/twilio/rest/proxy/v1/service/short_code.py +++ /dev/null @@ -1,418 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class ShortCodeList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the ShortCodeList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeList - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeList - """ - super(ShortCodeList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/ShortCodes'.format(**self._solution) - - def create(self, sid): - """ - Create a new ShortCodeInstance - - :param unicode sid: A string that uniquely identifies this Short Code. - - :returns: Newly created ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - """ - data = values.of({'Sid': sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams ShortCodeInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.short_code.ShortCodeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ShortCodeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.short_code.ShortCodeInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ShortCodeInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ShortCodePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ShortCodeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ShortCodePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ShortCodeContext - - :param sid: A string that uniquely identifies this Short Code. - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ShortCodeContext - - :param sid: A string that uniquely identifies this Short Code. - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.ShortCodeList>' - - -class ShortCodePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ShortCodePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodePage - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodePage - """ - super(ShortCodePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ShortCodeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - """ - return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Proxy.V1.ShortCodePage>' - - -class ShortCodeContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the ShortCodeContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param sid: A string that uniquely identifies this Short Code. - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - """ - super(ShortCodeContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/ShortCodes/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the ShortCodeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def fetch(self): - """ - Fetch a ShortCodeInstance - - :returns: Fetched ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ShortCodeInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.ShortCodeContext {}>'.format(context) - - -class ShortCodeInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ShortCodeInstance - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - """ - super(ShortCodeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'short_code': payload['short_code'], - 'iso_country': payload['iso_country'], - 'capabilities': payload['capabilities'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ShortCodeContext for this ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - """ - if self._context is None: - self._context = ShortCodeContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Short Code. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The date this Short Code was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Short Code was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def short_code(self): - """ - :returns: Shortcode. - :rtype: unicode - """ - return self._properties['short_code'] - - @property - def iso_country(self): - """ - :returns: ISO Country Code, - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def capabilities(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - def delete(self): - """ - Deletes the ShortCodeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch a ShortCodeInstance - - :returns: Fetched ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Proxy.V1.ShortCodeInstance {}>'.format(context) diff --git a/twilio/rest/studio/__init__.py b/twilio/rest/studio/__init__.py deleted file mode 100644 index a9abc21..0000000 --- a/twilio/rest/studio/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.studio.v1 import V1 - - -class Studio(Domain): - - def __init__(self, twilio): - """ - Initialize the Studio Domain - - :returns: Domain for Studio - :rtype: twilio.rest.studio.Studio - """ - super(Studio, self).__init__(twilio) - - self.base_url = 'https://studio.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of studio - :rtype: twilio.rest.studio.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def flows(self): - """ - :rtype: twilio.rest.studio.v1.flow.FlowList - """ - return self.v1.flows - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Studio>' diff --git a/twilio/rest/studio/__pycache__/__init__.cpython-36.pyc b/twilio/rest/studio/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 44eea5b..0000000 Binary files a/twilio/rest/studio/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/studio/v1/__init__.py b/twilio/rest/studio/v1/__init__.py deleted file mode 100644 index 41c0b25..0000000 --- a/twilio/rest/studio/v1/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.studio.v1.flow import FlowList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Studio - - :returns: V1 version of Studio - :rtype: twilio.rest.studio.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._flows = None - - @property - def flows(self): - """ - :rtype: twilio.rest.studio.v1.flow.FlowList - """ - if self._flows is None: - self._flows = FlowList(self) - return self._flows - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Studio.V1>' diff --git a/twilio/rest/studio/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/studio/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 5e2126a..0000000 Binary files a/twilio/rest/studio/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/studio/v1/flow/__init__.py b/twilio/rest/studio/v1/flow/__init__.py deleted file mode 100644 index b390e09..0000000 --- a/twilio/rest/studio/v1/flow/__init__.py +++ /dev/null @@ -1,417 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.studio.v1.flow.engagement import EngagementList - - -class FlowList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the FlowList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.studio.v1.flow.FlowList - :rtype: twilio.rest.studio.v1.flow.FlowList - """ - super(FlowList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Flows'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FlowInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v1.flow.FlowInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FlowInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v1.flow.FlowInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FlowInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return FlowPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FlowInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FlowPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a FlowContext - - :param sid: The sid - - :returns: twilio.rest.studio.v1.flow.FlowContext - :rtype: twilio.rest.studio.v1.flow.FlowContext - """ - return FlowContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FlowContext - - :param sid: The sid - - :returns: twilio.rest.studio.v1.flow.FlowContext - :rtype: twilio.rest.studio.v1.flow.FlowContext - """ - return FlowContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Studio.V1.FlowList>' - - -class FlowPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the FlowPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.studio.v1.flow.FlowPage - :rtype: twilio.rest.studio.v1.flow.FlowPage - """ - super(FlowPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FlowInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v1.flow.FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowInstance - """ - return FlowInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Studio.V1.FlowPage>' - - -class FlowContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the FlowContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.studio.v1.flow.FlowContext - :rtype: twilio.rest.studio.v1.flow.FlowContext - """ - super(FlowContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Flows/{sid}'.format(**self._solution) - - # Dependents - self._engagements = None - - def fetch(self): - """ - Fetch a FlowInstance - - :returns: Fetched FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return FlowInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the FlowInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def engagements(self): - """ - Access the engagements - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementList - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementList - """ - if self._engagements is None: - self._engagements = EngagementList(self._version, flow_sid=self._solution['sid'], ) - return self._engagements - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Studio.V1.FlowContext {}>'.format(context) - - -class FlowInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Status(object): - DRAFT = "draft" - PUBLISHED = "published" - - def __init__(self, version, payload, sid=None): - """ - Initialize the FlowInstance - - :returns: twilio.rest.studio.v1.flow.FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowInstance - """ - super(FlowInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'status': payload['status'], - 'version': deserialize.integer(payload['version']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FlowContext for this FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowContext - """ - if self._context is None: - self._context = FlowContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def status(self): - """ - :returns: The status - :rtype: FlowInstance.Status - """ - return self._properties['status'] - - @property - def version(self): - """ - :returns: The version - :rtype: unicode - """ - return self._properties['version'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a FlowInstance - - :returns: Fetched FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the FlowInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def engagements(self): - """ - Access the engagements - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementList - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementList - """ - return self._proxy.engagements - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Studio.V1.FlowInstance {}>'.format(context) diff --git a/twilio/rest/studio/v1/flow/__pycache__/__init__.cpython-36.pyc b/twilio/rest/studio/v1/flow/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 19fe0bb..0000000 Binary files a/twilio/rest/studio/v1/flow/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/studio/v1/flow/engagement/__init__.py b/twilio/rest/studio/v1/flow/engagement/__init__.py deleted file mode 100644 index 48d094e..0000000 --- a/twilio/rest/studio/v1/flow/engagement/__init__.py +++ /dev/null @@ -1,454 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.studio.v1.flow.engagement.step import StepList - - -class EngagementList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, flow_sid): - """ - Initialize the EngagementList - - :param Version version: Version that contains the resource - :param flow_sid: The flow_sid - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementList - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementList - """ - super(EngagementList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, } - self._uri = '/Flows/{flow_sid}/Engagements'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams EngagementInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v1.flow.engagement.EngagementInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists EngagementInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v1.flow.engagement.EngagementInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EngagementInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return EngagementPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EngagementInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EngagementPage(self._version, response, self._solution) - - def create(self, to, from_, parameters=values.unset): - """ - Create a new EngagementInstance - - :param unicode to: The to - :param unicode from_: The from - :param unicode parameters: The parameters - - :returns: Newly created EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementInstance - """ - data = values.of({'To': to, 'From': from_, 'Parameters': parameters, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return EngagementInstance(self._version, payload, flow_sid=self._solution['flow_sid'], ) - - def get(self, sid): - """ - Constructs a EngagementContext - - :param sid: The sid - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementContext - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementContext - """ - return EngagementContext(self._version, flow_sid=self._solution['flow_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EngagementContext - - :param sid: The sid - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementContext - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementContext - """ - return EngagementContext(self._version, flow_sid=self._solution['flow_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Studio.V1.EngagementList>' - - -class EngagementPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the EngagementPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: The flow_sid - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementPage - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementPage - """ - super(EngagementPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EngagementInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementInstance - """ - return EngagementInstance(self._version, payload, flow_sid=self._solution['flow_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Studio.V1.EngagementPage>' - - -class EngagementContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, flow_sid, sid): - """ - Initialize the EngagementContext - - :param Version version: Version that contains the resource - :param flow_sid: The flow_sid - :param sid: The sid - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementContext - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementContext - """ - super(EngagementContext, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'sid': sid, } - self._uri = '/Flows/{flow_sid}/Engagements/{sid}'.format(**self._solution) - - # Dependents - self._steps = None - - def fetch(self): - """ - Fetch a EngagementInstance - - :returns: Fetched EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return EngagementInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - sid=self._solution['sid'], - ) - - @property - def steps(self): - """ - Access the steps - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepList - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepList - """ - if self._steps is None: - self._steps = StepList( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['sid'], - ) - return self._steps - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Studio.V1.EngagementContext {}>'.format(context) - - -class EngagementInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Status(object): - ACTIVE = "active" - ENDED = "ended" - - def __init__(self, version, payload, flow_sid, sid=None): - """ - Initialize the EngagementInstance - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementInstance - """ - super(EngagementInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'flow_sid': payload['flow_sid'], - 'contact_sid': payload['contact_sid'], - 'contact_channel_address': payload['contact_channel_address'], - 'status': payload['status'], - 'context': payload['context'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'flow_sid': flow_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EngagementContext for this EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementContext - """ - if self._context is None: - self._context = EngagementContext( - self._version, - flow_sid=self._solution['flow_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def flow_sid(self): - """ - :returns: The flow_sid - :rtype: unicode - """ - return self._properties['flow_sid'] - - @property - def contact_sid(self): - """ - :returns: The contact_sid - :rtype: unicode - """ - return self._properties['contact_sid'] - - @property - def contact_channel_address(self): - """ - :returns: The contact_channel_address - :rtype: unicode - """ - return self._properties['contact_channel_address'] - - @property - def status(self): - """ - :returns: The status - :rtype: EngagementInstance.Status - """ - return self._properties['status'] - - @property - def context(self): - """ - :returns: The context - :rtype: dict - """ - return self._properties['context'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a EngagementInstance - - :returns: Fetched EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementInstance - """ - return self._proxy.fetch() - - @property - def steps(self): - """ - Access the steps - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepList - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepList - """ - return self._proxy.steps - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Studio.V1.EngagementInstance {}>'.format(context) diff --git a/twilio/rest/studio/v1/flow/engagement/__pycache__/__init__.cpython-36.pyc b/twilio/rest/studio/v1/flow/engagement/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index f21cea1..0000000 Binary files a/twilio/rest/studio/v1/flow/engagement/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/studio/v1/flow/engagement/__pycache__/step.cpython-36.pyc b/twilio/rest/studio/v1/flow/engagement/__pycache__/step.cpython-36.pyc deleted file mode 100644 index d329209..0000000 Binary files a/twilio/rest/studio/v1/flow/engagement/__pycache__/step.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/studio/v1/flow/engagement/step.py b/twilio/rest/studio/v1/flow/engagement/step.py deleted file mode 100644 index 104d1ac..0000000 --- a/twilio/rest/studio/v1/flow/engagement/step.py +++ /dev/null @@ -1,423 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class StepList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, flow_sid, engagement_sid): - """ - Initialize the StepList - - :param Version version: Version that contains the resource - :param flow_sid: The flow_sid - :param engagement_sid: The engagement_sid - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepList - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepList - """ - super(StepList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'engagement_sid': engagement_sid, } - self._uri = '/Flows/{flow_sid}/Engagements/{engagement_sid}/Steps'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams StepInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v1.flow.engagement.step.StepInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists StepInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v1.flow.engagement.step.StepInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of StepInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return StepPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of StepInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return StepPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a StepContext - - :param sid: The sid - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepContext - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepContext - """ - return StepContext( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a StepContext - - :param sid: The sid - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepContext - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepContext - """ - return StepContext( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Studio.V1.StepList>' - - -class StepPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the StepPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: The flow_sid - :param engagement_sid: The engagement_sid - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepPage - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepPage - """ - super(StepPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of StepInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepInstance - """ - return StepInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Studio.V1.StepPage>' - - -class StepContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, flow_sid, engagement_sid, sid): - """ - Initialize the StepContext - - :param Version version: Version that contains the resource - :param flow_sid: The flow_sid - :param engagement_sid: The engagement_sid - :param sid: The sid - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepContext - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepContext - """ - super(StepContext, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'engagement_sid': engagement_sid, 'sid': sid, } - self._uri = '/Flows/{flow_sid}/Engagements/{engagement_sid}/Steps/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a StepInstance - - :returns: Fetched StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return StepInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Studio.V1.StepContext {}>'.format(context) - - -class StepInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, flow_sid, engagement_sid, sid=None): - """ - Initialize the StepInstance - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepInstance - """ - super(StepInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'flow_sid': payload['flow_sid'], - 'engagement_sid': payload['engagement_sid'], - 'name': payload['name'], - 'context': payload['context'], - 'transitioned_from': payload['transitioned_from'], - 'transitioned_to': payload['transitioned_to'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'flow_sid': flow_sid, - 'engagement_sid': engagement_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: StepContext for this StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepContext - """ - if self._context is None: - self._context = StepContext( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def flow_sid(self): - """ - :returns: The flow_sid - :rtype: unicode - """ - return self._properties['flow_sid'] - - @property - def engagement_sid(self): - """ - :returns: The engagement_sid - :rtype: unicode - """ - return self._properties['engagement_sid'] - - @property - def name(self): - """ - :returns: The name - :rtype: unicode - """ - return self._properties['name'] - - @property - def context(self): - """ - :returns: The context - :rtype: dict - """ - return self._properties['context'] - - @property - def transitioned_from(self): - """ - :returns: The transitioned_from - :rtype: unicode - """ - return self._properties['transitioned_from'] - - @property - def transitioned_to(self): - """ - :returns: The transitioned_to - :rtype: unicode - """ - return self._properties['transitioned_to'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a StepInstance - - :returns: Fetched StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Studio.V1.StepInstance {}>'.format(context) diff --git a/twilio/rest/sync/__init__.py b/twilio/rest/sync/__init__.py deleted file mode 100644 index 6576b6e..0000000 --- a/twilio/rest/sync/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.sync.v1 import V1 - - -class Sync(Domain): - - def __init__(self, twilio): - """ - Initialize the Sync Domain - - :returns: Domain for Sync - :rtype: twilio.rest.sync.Sync - """ - super(Sync, self).__init__(twilio) - - self.base_url = 'https://sync.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of sync - :rtype: twilio.rest.sync.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def services(self): - """ - :rtype: twilio.rest.sync.v1.service.ServiceList - """ - return self.v1.services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync>' diff --git a/twilio/rest/sync/__pycache__/__init__.cpython-36.pyc b/twilio/rest/sync/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 083546e..0000000 Binary files a/twilio/rest/sync/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/sync/v1/__init__.py b/twilio/rest/sync/v1/__init__.py deleted file mode 100644 index c1aab31..0000000 --- a/twilio/rest/sync/v1/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.sync.v1.service import ServiceList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Sync - - :returns: V1 version of Sync - :rtype: twilio.rest.sync.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._services = None - - @property - def services(self): - """ - :rtype: twilio.rest.sync.v1.service.ServiceList - """ - if self._services is None: - self._services = ServiceList(self) - return self._services - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1>' diff --git a/twilio/rest/sync/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/sync/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 6090386..0000000 Binary files a/twilio/rest/sync/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/sync/v1/service/__init__.py b/twilio/rest/sync/v1/service/__init__.py deleted file mode 100644 index 902dc57..0000000 --- a/twilio/rest/sync/v1/service/__init__.py +++ /dev/null @@ -1,582 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.sync.v1.service.document import DocumentList -from twilio.rest.sync.v1.service.sync_list import SyncListList -from twilio.rest.sync.v1.service.sync_map import SyncMapList -from twilio.rest.sync.v1.service.sync_stream import SyncStreamList - - -class ServiceList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.sync.v1.service.ServiceList - :rtype: twilio.rest.sync.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name=values.unset, webhook_url=values.unset, - reachability_webhooks_enabled=values.unset, - acl_enabled=values.unset): - """ - Create a new ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode webhook_url: The webhook_url - :param bool reachability_webhooks_enabled: The reachability_webhooks_enabled - :param bool acl_enabled: The acl_enabled - - :returns: Newly created ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'WebhookUrl': webhook_url, - 'ReachabilityWebhooksEnabled': reachability_webhooks_enabled, - 'AclEnabled': acl_enabled, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServicePage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.sync.v1.service.ServiceContext - :rtype: twilio.rest.sync.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.sync.v1.service.ServiceContext - :rtype: twilio.rest.sync.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.ServiceList>' - - -class ServicePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.sync.v1.service.ServicePage - :rtype: twilio.rest.sync.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.ServicePage>' - - -class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.sync.v1.service.ServiceContext - :rtype: twilio.rest.sync.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._documents = None - self._sync_lists = None - self._sync_maps = None - self._sync_streams = None - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, webhook_url=values.unset, friendly_name=values.unset, - reachability_webhooks_enabled=values.unset, - acl_enabled=values.unset): - """ - Update the ServiceInstance - - :param unicode webhook_url: The webhook_url - :param unicode friendly_name: The friendly_name - :param bool reachability_webhooks_enabled: The reachability_webhooks_enabled - :param bool acl_enabled: The acl_enabled - - :returns: Updated ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance - """ - data = values.of({ - 'WebhookUrl': webhook_url, - 'FriendlyName': friendly_name, - 'ReachabilityWebhooksEnabled': reachability_webhooks_enabled, - 'AclEnabled': acl_enabled, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def documents(self): - """ - Access the documents - - :returns: twilio.rest.sync.v1.service.document.DocumentList - :rtype: twilio.rest.sync.v1.service.document.DocumentList - """ - if self._documents is None: - self._documents = DocumentList(self._version, service_sid=self._solution['sid'], ) - return self._documents - - @property - def sync_lists(self): - """ - Access the sync_lists - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListList - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListList - """ - if self._sync_lists is None: - self._sync_lists = SyncListList(self._version, service_sid=self._solution['sid'], ) - return self._sync_lists - - @property - def sync_maps(self): - """ - Access the sync_maps - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapList - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapList - """ - if self._sync_maps is None: - self._sync_maps = SyncMapList(self._version, service_sid=self._solution['sid'], ) - return self._sync_maps - - @property - def sync_streams(self): - """ - Access the sync_streams - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamList - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamList - """ - if self._sync_streams is None: - self._sync_streams = SyncStreamList(self._version, service_sid=self._solution['sid'], ) - return self._sync_streams - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.ServiceContext {}>'.format(context) - - -class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.sync.v1.service.ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'webhook_url': payload['webhook_url'], - 'reachability_webhooks_enabled': payload['reachability_webhooks_enabled'], - 'acl_enabled': payload['acl_enabled'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceContext - """ - if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def webhook_url(self): - """ - :returns: The webhook_url - :rtype: unicode - """ - return self._properties['webhook_url'] - - @property - def reachability_webhooks_enabled(self): - """ - :returns: The reachability_webhooks_enabled - :rtype: bool - """ - return self._properties['reachability_webhooks_enabled'] - - @property - def acl_enabled(self): - """ - :returns: The acl_enabled - :rtype: bool - """ - return self._properties['acl_enabled'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ServiceInstance - - :returns: Fetched ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, webhook_url=values.unset, friendly_name=values.unset, - reachability_webhooks_enabled=values.unset, - acl_enabled=values.unset): - """ - Update the ServiceInstance - - :param unicode webhook_url: The webhook_url - :param unicode friendly_name: The friendly_name - :param bool reachability_webhooks_enabled: The reachability_webhooks_enabled - :param bool acl_enabled: The acl_enabled - - :returns: Updated ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance - """ - return self._proxy.update( - webhook_url=webhook_url, - friendly_name=friendly_name, - reachability_webhooks_enabled=reachability_webhooks_enabled, - acl_enabled=acl_enabled, - ) - - @property - def documents(self): - """ - Access the documents - - :returns: twilio.rest.sync.v1.service.document.DocumentList - :rtype: twilio.rest.sync.v1.service.document.DocumentList - """ - return self._proxy.documents - - @property - def sync_lists(self): - """ - Access the sync_lists - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListList - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListList - """ - return self._proxy.sync_lists - - @property - def sync_maps(self): - """ - Access the sync_maps - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapList - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapList - """ - return self._proxy.sync_maps - - @property - def sync_streams(self): - """ - Access the sync_streams - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamList - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamList - """ - return self._proxy.sync_streams - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.ServiceInstance {}>'.format(context) diff --git a/twilio/rest/sync/v1/service/__pycache__/__init__.cpython-36.pyc b/twilio/rest/sync/v1/service/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index d4c1329..0000000 Binary files a/twilio/rest/sync/v1/service/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/sync/v1/service/document/__init__.py b/twilio/rest/sync/v1/service/document/__init__.py deleted file mode 100644 index 3e1e4e5..0000000 --- a/twilio/rest/sync/v1/service/document/__init__.py +++ /dev/null @@ -1,515 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.sync.v1.service.document.document_permission import DocumentPermissionList - - -class DocumentList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the DocumentList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.sync.v1.service.document.DocumentList - :rtype: twilio.rest.sync.v1.service.document.DocumentList - """ - super(DocumentList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Documents'.format(**self._solution) - - def create(self, unique_name=values.unset, data=values.unset, ttl=values.unset): - """ - Create a new DocumentInstance - - :param unicode unique_name: The unique_name - :param dict data: The data - :param unicode ttl: The ttl - - :returns: Newly created DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance - """ - data = values.of({'UniqueName': unique_name, 'Data': serialize.object(data), 'Ttl': ttl, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams DocumentInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.document.DocumentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DocumentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.document.DocumentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DocumentInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return DocumentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DocumentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DocumentPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a DocumentContext - - :param sid: The sid - - :returns: twilio.rest.sync.v1.service.document.DocumentContext - :rtype: twilio.rest.sync.v1.service.document.DocumentContext - """ - return DocumentContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a DocumentContext - - :param sid: The sid - - :returns: twilio.rest.sync.v1.service.document.DocumentContext - :rtype: twilio.rest.sync.v1.service.document.DocumentContext - """ - return DocumentContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.DocumentList>' - - -class DocumentPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the DocumentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.sync.v1.service.document.DocumentPage - :rtype: twilio.rest.sync.v1.service.document.DocumentPage - """ - super(DocumentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DocumentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.document.DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance - """ - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.DocumentPage>' - - -class DocumentContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the DocumentContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.sync.v1.service.document.DocumentContext - :rtype: twilio.rest.sync.v1.service.document.DocumentContext - """ - super(DocumentContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Documents/{sid}'.format(**self._solution) - - # Dependents - self._document_permissions = None - - def fetch(self): - """ - Fetch a DocumentInstance - - :returns: Fetched DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return DocumentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the DocumentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, data=values.unset, ttl=values.unset): - """ - Update the DocumentInstance - - :param dict data: The data - :param unicode ttl: The ttl - - :returns: Updated DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance - """ - data = values.of({'Data': serialize.object(data), 'Ttl': ttl, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return DocumentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def document_permissions(self): - """ - Access the document_permissions - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionList - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionList - """ - if self._document_permissions is None: - self._document_permissions = DocumentPermissionList( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['sid'], - ) - return self._document_permissions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.DocumentContext {}>'.format(context) - - -class DocumentInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the DocumentInstance - - :returns: twilio.rest.sync.v1.service.document.DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance - """ - super(DocumentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'url': payload['url'], - 'links': payload['links'], - 'revision': payload['revision'], - 'data': payload['data'], - 'date_expires': deserialize.iso8601_datetime(payload['date_expires']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DocumentContext for this DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentContext - """ - if self._context is None: - self._context = DocumentContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def data(self): - """ - :returns: The data - :rtype: dict - """ - return self._properties['data'] - - @property - def date_expires(self): - """ - :returns: The date_expires - :rtype: datetime - """ - return self._properties['date_expires'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch a DocumentInstance - - :returns: Fetched DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the DocumentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, data=values.unset, ttl=values.unset): - """ - Update the DocumentInstance - - :param dict data: The data - :param unicode ttl: The ttl - - :returns: Updated DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance - """ - return self._proxy.update(data=data, ttl=ttl, ) - - @property - def document_permissions(self): - """ - Access the document_permissions - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionList - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionList - """ - return self._proxy.document_permissions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.DocumentInstance {}>'.format(context) diff --git a/twilio/rest/sync/v1/service/document/__pycache__/__init__.cpython-36.pyc b/twilio/rest/sync/v1/service/document/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 7f4d55f..0000000 Binary files a/twilio/rest/sync/v1/service/document/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/sync/v1/service/document/__pycache__/document_permission.cpython-36.pyc b/twilio/rest/sync/v1/service/document/__pycache__/document_permission.cpython-36.pyc deleted file mode 100644 index 6d2f601..0000000 Binary files a/twilio/rest/sync/v1/service/document/__pycache__/document_permission.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/sync/v1/service/document/document_permission.py b/twilio/rest/sync/v1/service/document/document_permission.py deleted file mode 100644 index 196d0e8..0000000 --- a/twilio/rest/sync/v1/service/document/document_permission.py +++ /dev/null @@ -1,453 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class DocumentPermissionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, document_sid): - """ - Initialize the DocumentPermissionList - - :param Version version: Version that contains the resource - :param service_sid: Sync Service Instance SID. - :param document_sid: Sync Document SID. - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionList - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionList - """ - super(DocumentPermissionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'document_sid': document_sid, } - self._uri = '/Services/{service_sid}/Documents/{document_sid}/Permissions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DocumentPermissionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DocumentPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DocumentPermissionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return DocumentPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DocumentPermissionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DocumentPermissionPage(self._version, response, self._solution) - - def get(self, identity): - """ - Constructs a DocumentPermissionContext - - :param identity: Identity of the user to whom the Sync Document Permission applies. - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - """ - return DocumentPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=identity, - ) - - def __call__(self, identity): - """ - Constructs a DocumentPermissionContext - - :param identity: Identity of the user to whom the Sync Document Permission applies. - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - """ - return DocumentPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=identity, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.DocumentPermissionList>' - - -class DocumentPermissionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the DocumentPermissionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Sync Service Instance SID. - :param document_sid: Sync Document SID. - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionPage - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionPage - """ - super(DocumentPermissionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DocumentPermissionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - """ - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.DocumentPermissionPage>' - - -class DocumentPermissionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, document_sid, identity): - """ - Initialize the DocumentPermissionContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param document_sid: Sync Document SID or unique name. - :param identity: Identity of the user to whom the Sync Document Permission applies. - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - """ - super(DocumentPermissionContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'document_sid': document_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Documents/{document_sid}/Permissions/{identity}'.format(**self._solution) - - def fetch(self): - """ - Fetch a DocumentPermissionInstance - - :returns: Fetched DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=self._solution['identity'], - ) - - def delete(self): - """ - Deletes the DocumentPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, read, write, manage): - """ - Update the DocumentPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: Updated DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - """ - data = values.of({'Read': read, 'Write': write, 'Manage': manage, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=self._solution['identity'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.DocumentPermissionContext {}>'.format(context) - - -class DocumentPermissionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, document_sid, identity=None): - """ - Initialize the DocumentPermissionInstance - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - """ - super(DocumentPermissionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'document_sid': payload['document_sid'], - 'identity': payload['identity'], - 'read': payload['read'], - 'write': payload['write'], - 'manage': payload['manage'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'document_sid': document_sid, - 'identity': identity or self._properties['identity'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DocumentPermissionContext for this DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - """ - if self._context is None: - self._context = DocumentPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=self._solution['identity'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: Twilio Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Sync Service Instance SID. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def document_sid(self): - """ - :returns: Sync Document SID. - :rtype: unicode - """ - return self._properties['document_sid'] - - @property - def identity(self): - """ - :returns: Identity of the user to whom the Sync Document Permission applies. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def read(self): - """ - :returns: Read access. - :rtype: bool - """ - return self._properties['read'] - - @property - def write(self): - """ - :returns: Write access. - :rtype: bool - """ - return self._properties['write'] - - @property - def manage(self): - """ - :returns: Manage access. - :rtype: bool - """ - return self._properties['manage'] - - @property - def url(self): - """ - :returns: URL of this Sync Document Permission. - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a DocumentPermissionInstance - - :returns: Fetched DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the DocumentPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, read, write, manage): - """ - Update the DocumentPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: Updated DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - """ - return self._proxy.update(read, write, manage, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.DocumentPermissionInstance {}>'.format(context) diff --git a/twilio/rest/sync/v1/service/sync_list/__init__.py b/twilio/rest/sync/v1/service/sync_list/__init__.py deleted file mode 100644 index 8e507d6..0000000 --- a/twilio/rest/sync/v1/service/sync_list/__init__.py +++ /dev/null @@ -1,530 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.sync.v1.service.sync_list.sync_list_item import SyncListItemList -from twilio.rest.sync.v1.service.sync_list.sync_list_permission import SyncListPermissionList - - -class SyncListList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the SyncListList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListList - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListList - """ - super(SyncListList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Lists'.format(**self._solution) - - def create(self, unique_name=values.unset, ttl=values.unset): - """ - Create a new SyncListInstance - - :param unicode unique_name: The unique_name - :param unicode ttl: The ttl - - :returns: Newly created SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance - """ - data = values.of({'UniqueName': unique_name, 'Ttl': ttl, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncListInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_list.SyncListInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_list.SyncListInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncListInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SyncListPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncListInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncListPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SyncListContext - - :param sid: The sid - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListContext - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListContext - """ - return SyncListContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SyncListContext - - :param sid: The sid - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListContext - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListContext - """ - return SyncListContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncListList>' - - -class SyncListPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncListPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListPage - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListPage - """ - super(SyncListPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncListInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance - """ - return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncListPage>' - - -class SyncListContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the SyncListContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListContext - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListContext - """ - super(SyncListContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Lists/{sid}'.format(**self._solution) - - # Dependents - self._sync_list_items = None - self._sync_list_permissions = None - - def fetch(self): - """ - Fetch a SyncListInstance - - :returns: Fetched SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SyncListInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the SyncListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, ttl=values.unset): - """ - Update the SyncListInstance - - :param unicode ttl: The ttl - - :returns: Updated SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance - """ - data = values.of({'Ttl': ttl, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SyncListInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def sync_list_items(self): - """ - Access the sync_list_items - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemList - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemList - """ - if self._sync_list_items is None: - self._sync_list_items = SyncListItemList( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['sid'], - ) - return self._sync_list_items - - @property - def sync_list_permissions(self): - """ - Access the sync_list_permissions - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionList - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionList - """ - if self._sync_list_permissions is None: - self._sync_list_permissions = SyncListPermissionList( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['sid'], - ) - return self._sync_list_permissions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncListContext {}>'.format(context) - - -class SyncListInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the SyncListInstance - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance - """ - super(SyncListInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'url': payload['url'], - 'links': payload['links'], - 'revision': payload['revision'], - 'date_expires': deserialize.iso8601_datetime(payload['date_expires']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListContext for this SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListContext - """ - if self._context is None: - self._context = SyncListContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def date_expires(self): - """ - :returns: The date_expires - :rtype: datetime - """ - return self._properties['date_expires'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch a SyncListInstance - - :returns: Fetched SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, ttl=values.unset): - """ - Update the SyncListInstance - - :param unicode ttl: The ttl - - :returns: Updated SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance - """ - return self._proxy.update(ttl=ttl, ) - - @property - def sync_list_items(self): - """ - Access the sync_list_items - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemList - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemList - """ - return self._proxy.sync_list_items - - @property - def sync_list_permissions(self): - """ - Access the sync_list_permissions - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionList - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionList - """ - return self._proxy.sync_list_permissions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncListInstance {}>'.format(context) diff --git a/twilio/rest/sync/v1/service/sync_list/__pycache__/__init__.cpython-36.pyc b/twilio/rest/sync/v1/service/sync_list/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 94bbca5..0000000 Binary files a/twilio/rest/sync/v1/service/sync_list/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/sync/v1/service/sync_list/__pycache__/sync_list_item.cpython-36.pyc b/twilio/rest/sync/v1/service/sync_list/__pycache__/sync_list_item.cpython-36.pyc deleted file mode 100644 index c1b38ec..0000000 Binary files a/twilio/rest/sync/v1/service/sync_list/__pycache__/sync_list_item.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/sync/v1/service/sync_list/__pycache__/sync_list_permission.cpython-36.pyc b/twilio/rest/sync/v1/service/sync_list/__pycache__/sync_list_permission.cpython-36.pyc deleted file mode 100644 index b35cf1c..0000000 Binary files a/twilio/rest/sync/v1/service/sync_list/__pycache__/sync_list_permission.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py b/twilio/rest/sync/v1/service/sync_list/sync_list_item.py deleted file mode 100644 index 639eac5..0000000 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py +++ /dev/null @@ -1,532 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class SyncListItemList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, list_sid): - """ - Initialize the SyncListItemList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param list_sid: The list_sid - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemList - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemList - """ - super(SyncListItemList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Items'.format(**self._solution) - - def create(self, data, ttl=values.unset): - """ - Create a new SyncListItemInstance - - :param dict data: The data - :param unicode ttl: The ttl - - :returns: Newly created SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - """ - data = values.of({'Data': serialize.object(data), 'Ttl': ttl, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - ) - - def stream(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Streams SyncListItemInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param SyncListItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncListItemInstance.QueryFromBoundType bounds: The bounds - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, from_=from_, bounds=bounds, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Lists SyncListItemInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param SyncListItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncListItemInstance.QueryFromBoundType bounds: The bounds - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance] - """ - return list(self.stream(order=order, from_=from_, bounds=bounds, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, from_=values.unset, bounds=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncListItemInstance records from the API. - Request is executed immediately - - :param SyncListItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncListItemInstance.QueryFromBoundType bounds: The bounds - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemPage - """ - params = values.of({ - 'Order': order, - 'From': from_, - 'Bounds': bounds, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SyncListItemPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncListItemInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncListItemPage(self._version, response, self._solution) - - def get(self, index): - """ - Constructs a SyncListItemContext - - :param index: The index - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - """ - return SyncListItemContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=index, - ) - - def __call__(self, index): - """ - Constructs a SyncListItemContext - - :param index: The index - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - """ - return SyncListItemContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=index, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncListItemList>' - - -class SyncListItemPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncListItemPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param list_sid: The list_sid - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemPage - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemPage - """ - super(SyncListItemPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncListItemInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - """ - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncListItemPage>' - - -class SyncListItemContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, list_sid, index): - """ - Initialize the SyncListItemContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param list_sid: The list_sid - :param index: The index - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - """ - super(SyncListItemContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, 'index': index, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Items/{index}'.format(**self._solution) - - def fetch(self): - """ - Fetch a SyncListItemInstance - - :returns: Fetched SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=self._solution['index'], - ) - - def delete(self): - """ - Deletes the SyncListItemInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, data=values.unset, ttl=values.unset): - """ - Update the SyncListItemInstance - - :param dict data: The data - :param unicode ttl: The ttl - - :returns: Updated SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - """ - data = values.of({'Data': serialize.object(data), 'Ttl': ttl, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=self._solution['index'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncListItemContext {}>'.format(context) - - -class SyncListItemInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class QueryResultOrder(object): - ASC = "asc" - DESC = "desc" - - class QueryFromBoundType(object): - INCLUSIVE = "inclusive" - EXCLUSIVE = "exclusive" - - def __init__(self, version, payload, service_sid, list_sid, index=None): - """ - Initialize the SyncListItemInstance - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - """ - super(SyncListItemInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'index': deserialize.integer(payload['index']), - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'list_sid': payload['list_sid'], - 'url': payload['url'], - 'revision': payload['revision'], - 'data': payload['data'], - 'date_expires': deserialize.iso8601_datetime(payload['date_expires']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'list_sid': list_sid, - 'index': index or self._properties['index'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListItemContext for this SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - """ - if self._context is None: - self._context = SyncListItemContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=self._solution['index'], - ) - return self._context - - @property - def index(self): - """ - :returns: The index - :rtype: unicode - """ - return self._properties['index'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def list_sid(self): - """ - :returns: The list_sid - :rtype: unicode - """ - return self._properties['list_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def data(self): - """ - :returns: The data - :rtype: dict - """ - return self._properties['data'] - - @property - def date_expires(self): - """ - :returns: The date_expires - :rtype: datetime - """ - return self._properties['date_expires'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch a SyncListItemInstance - - :returns: Fetched SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncListItemInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, data=values.unset, ttl=values.unset): - """ - Update the SyncListItemInstance - - :param dict data: The data - :param unicode ttl: The ttl - - :returns: Updated SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - """ - return self._proxy.update(data=data, ttl=ttl, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncListItemInstance {}>'.format(context) diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py b/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py deleted file mode 100644 index b09e379..0000000 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py +++ /dev/null @@ -1,453 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class SyncListPermissionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, list_sid): - """ - Initialize the SyncListPermissionList - - :param Version version: Version that contains the resource - :param service_sid: Sync Service Instance SID. - :param list_sid: Sync List SID. - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionList - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionList - """ - super(SyncListPermissionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Permissions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncListPermissionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncListPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncListPermissionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SyncListPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncListPermissionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncListPermissionPage(self._version, response, self._solution) - - def get(self, identity): - """ - Constructs a SyncListPermissionContext - - :param identity: Identity of the user to whom the Sync List Permission applies. - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionContext - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionContext - """ - return SyncListPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=identity, - ) - - def __call__(self, identity): - """ - Constructs a SyncListPermissionContext - - :param identity: Identity of the user to whom the Sync List Permission applies. - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionContext - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionContext - """ - return SyncListPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=identity, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncListPermissionList>' - - -class SyncListPermissionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncListPermissionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Sync Service Instance SID. - :param list_sid: Sync List SID. - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionPage - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionPage - """ - super(SyncListPermissionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncListPermissionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncListPermissionPage>' - - -class SyncListPermissionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, list_sid, identity): - """ - Initialize the SyncListPermissionContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param list_sid: Sync List SID or unique name. - :param identity: Identity of the user to whom the Sync List Permission applies. - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionContext - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionContext - """ - super(SyncListPermissionContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Permissions/{identity}'.format(**self._solution) - - def fetch(self): - """ - Fetch a SyncListPermissionInstance - - :returns: Fetched SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=self._solution['identity'], - ) - - def delete(self): - """ - Deletes the SyncListPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, read, write, manage): - """ - Update the SyncListPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: Updated SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - data = values.of({'Read': read, 'Write': write, 'Manage': manage, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=self._solution['identity'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncListPermissionContext {}>'.format(context) - - -class SyncListPermissionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, list_sid, identity=None): - """ - Initialize the SyncListPermissionInstance - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - super(SyncListPermissionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'list_sid': payload['list_sid'], - 'identity': payload['identity'], - 'read': payload['read'], - 'write': payload['write'], - 'manage': payload['manage'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'list_sid': list_sid, - 'identity': identity or self._properties['identity'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListPermissionContext for this SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionContext - """ - if self._context is None: - self._context = SyncListPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=self._solution['identity'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: Twilio Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Sync Service Instance SID. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def list_sid(self): - """ - :returns: Sync List SID. - :rtype: unicode - """ - return self._properties['list_sid'] - - @property - def identity(self): - """ - :returns: Identity of the user to whom the Sync List Permission applies. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def read(self): - """ - :returns: Read access. - :rtype: bool - """ - return self._properties['read'] - - @property - def write(self): - """ - :returns: Write access. - :rtype: bool - """ - return self._properties['write'] - - @property - def manage(self): - """ - :returns: Manage access. - :rtype: bool - """ - return self._properties['manage'] - - @property - def url(self): - """ - :returns: URL of this Sync List Permission. - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a SyncListPermissionInstance - - :returns: Fetched SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncListPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, read, write, manage): - """ - Update the SyncListPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: Updated SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - return self._proxy.update(read, write, manage, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncListPermissionInstance {}>'.format(context) diff --git a/twilio/rest/sync/v1/service/sync_map/__init__.py b/twilio/rest/sync/v1/service/sync_map/__init__.py deleted file mode 100644 index 0dd366b..0000000 --- a/twilio/rest/sync/v1/service/sync_map/__init__.py +++ /dev/null @@ -1,530 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.sync.v1.service.sync_map.sync_map_item import SyncMapItemList -from twilio.rest.sync.v1.service.sync_map.sync_map_permission import SyncMapPermissionList - - -class SyncMapList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the SyncMapList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapList - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapList - """ - super(SyncMapList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Maps'.format(**self._solution) - - def create(self, unique_name=values.unset, ttl=values.unset): - """ - Create a new SyncMapInstance - - :param unicode unique_name: The unique_name - :param unicode ttl: The ttl - - :returns: Newly created SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - """ - data = values.of({'UniqueName': unique_name, 'Ttl': ttl, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncMapInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_map.SyncMapInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncMapInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_map.SyncMapInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncMapInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SyncMapPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncMapInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncMapPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SyncMapContext - - :param sid: The sid - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapContext - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapContext - """ - return SyncMapContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SyncMapContext - - :param sid: The sid - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapContext - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapContext - """ - return SyncMapContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncMapList>' - - -class SyncMapPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncMapPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapPage - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapPage - """ - super(SyncMapPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncMapInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - """ - return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncMapPage>' - - -class SyncMapContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the SyncMapContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapContext - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapContext - """ - super(SyncMapContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Maps/{sid}'.format(**self._solution) - - # Dependents - self._sync_map_items = None - self._sync_map_permissions = None - - def fetch(self): - """ - Fetch a SyncMapInstance - - :returns: Fetched SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SyncMapInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the SyncMapInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, ttl=values.unset): - """ - Update the SyncMapInstance - - :param unicode ttl: The ttl - - :returns: Updated SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - """ - data = values.of({'Ttl': ttl, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SyncMapInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def sync_map_items(self): - """ - Access the sync_map_items - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemList - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemList - """ - if self._sync_map_items is None: - self._sync_map_items = SyncMapItemList( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['sid'], - ) - return self._sync_map_items - - @property - def sync_map_permissions(self): - """ - Access the sync_map_permissions - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionList - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionList - """ - if self._sync_map_permissions is None: - self._sync_map_permissions = SyncMapPermissionList( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['sid'], - ) - return self._sync_map_permissions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncMapContext {}>'.format(context) - - -class SyncMapInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the SyncMapInstance - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - """ - super(SyncMapInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'url': payload['url'], - 'links': payload['links'], - 'revision': payload['revision'], - 'date_expires': deserialize.iso8601_datetime(payload['date_expires']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapContext for this SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapContext - """ - if self._context is None: - self._context = SyncMapContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def date_expires(self): - """ - :returns: The date_expires - :rtype: datetime - """ - return self._properties['date_expires'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch a SyncMapInstance - - :returns: Fetched SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncMapInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, ttl=values.unset): - """ - Update the SyncMapInstance - - :param unicode ttl: The ttl - - :returns: Updated SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - """ - return self._proxy.update(ttl=ttl, ) - - @property - def sync_map_items(self): - """ - Access the sync_map_items - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemList - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemList - """ - return self._proxy.sync_map_items - - @property - def sync_map_permissions(self): - """ - Access the sync_map_permissions - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionList - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionList - """ - return self._proxy.sync_map_permissions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncMapInstance {}>'.format(context) diff --git a/twilio/rest/sync/v1/service/sync_map/__pycache__/__init__.cpython-36.pyc b/twilio/rest/sync/v1/service/sync_map/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 45a816c..0000000 Binary files a/twilio/rest/sync/v1/service/sync_map/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/sync/v1/service/sync_map/__pycache__/sync_map_item.cpython-36.pyc b/twilio/rest/sync/v1/service/sync_map/__pycache__/sync_map_item.cpython-36.pyc deleted file mode 100644 index b096462..0000000 Binary files a/twilio/rest/sync/v1/service/sync_map/__pycache__/sync_map_item.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/sync/v1/service/sync_map/__pycache__/sync_map_permission.cpython-36.pyc b/twilio/rest/sync/v1/service/sync_map/__pycache__/sync_map_permission.cpython-36.pyc deleted file mode 100644 index 55aa8ed..0000000 Binary files a/twilio/rest/sync/v1/service/sync_map/__pycache__/sync_map_permission.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py b/twilio/rest/sync/v1/service/sync_map/sync_map_item.py deleted file mode 100644 index ec5759c..0000000 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py +++ /dev/null @@ -1,533 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class SyncMapItemList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, map_sid): - """ - Initialize the SyncMapItemList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param map_sid: The map_sid - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemList - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemList - """ - super(SyncMapItemList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Items'.format(**self._solution) - - def create(self, key, data, ttl=values.unset): - """ - Create a new SyncMapItemInstance - - :param unicode key: The key - :param dict data: The data - :param unicode ttl: The ttl - - :returns: Newly created SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - """ - data = values.of({'Key': key, 'Data': serialize.object(data), 'Ttl': ttl, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - ) - - def stream(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Streams SyncMapItemInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param SyncMapItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncMapItemInstance.QueryFromBoundType bounds: The bounds - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, from_=from_, bounds=bounds, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Lists SyncMapItemInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param SyncMapItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncMapItemInstance.QueryFromBoundType bounds: The bounds - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance] - """ - return list(self.stream(order=order, from_=from_, bounds=bounds, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, from_=values.unset, bounds=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncMapItemInstance records from the API. - Request is executed immediately - - :param SyncMapItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncMapItemInstance.QueryFromBoundType bounds: The bounds - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemPage - """ - params = values.of({ - 'Order': order, - 'From': from_, - 'Bounds': bounds, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SyncMapItemPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncMapItemInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncMapItemPage(self._version, response, self._solution) - - def get(self, key): - """ - Constructs a SyncMapItemContext - - :param key: The key - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemContext - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemContext - """ - return SyncMapItemContext( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=key, - ) - - def __call__(self, key): - """ - Constructs a SyncMapItemContext - - :param key: The key - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemContext - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemContext - """ - return SyncMapItemContext( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=key, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncMapItemList>' - - -class SyncMapItemPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncMapItemPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param map_sid: The map_sid - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemPage - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemPage - """ - super(SyncMapItemPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncMapItemInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - """ - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncMapItemPage>' - - -class SyncMapItemContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, map_sid, key): - """ - Initialize the SyncMapItemContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param map_sid: The map_sid - :param key: The key - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemContext - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemContext - """ - super(SyncMapItemContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, 'key': key, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Items/{key}'.format(**self._solution) - - def fetch(self): - """ - Fetch a SyncMapItemInstance - - :returns: Fetched SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=self._solution['key'], - ) - - def delete(self): - """ - Deletes the SyncMapItemInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, data=values.unset, ttl=values.unset): - """ - Update the SyncMapItemInstance - - :param dict data: The data - :param unicode ttl: The ttl - - :returns: Updated SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - """ - data = values.of({'Data': serialize.object(data), 'Ttl': ttl, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=self._solution['key'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncMapItemContext {}>'.format(context) - - -class SyncMapItemInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class QueryResultOrder(object): - ASC = "asc" - DESC = "desc" - - class QueryFromBoundType(object): - INCLUSIVE = "inclusive" - EXCLUSIVE = "exclusive" - - def __init__(self, version, payload, service_sid, map_sid, key=None): - """ - Initialize the SyncMapItemInstance - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - """ - super(SyncMapItemInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'key': payload['key'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'map_sid': payload['map_sid'], - 'url': payload['url'], - 'revision': payload['revision'], - 'data': payload['data'], - 'date_expires': deserialize.iso8601_datetime(payload['date_expires']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'map_sid': map_sid, - 'key': key or self._properties['key'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapItemContext for this SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemContext - """ - if self._context is None: - self._context = SyncMapItemContext( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=self._solution['key'], - ) - return self._context - - @property - def key(self): - """ - :returns: The key - :rtype: unicode - """ - return self._properties['key'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def map_sid(self): - """ - :returns: The map_sid - :rtype: unicode - """ - return self._properties['map_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def data(self): - """ - :returns: The data - :rtype: dict - """ - return self._properties['data'] - - @property - def date_expires(self): - """ - :returns: The date_expires - :rtype: datetime - """ - return self._properties['date_expires'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch a SyncMapItemInstance - - :returns: Fetched SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncMapItemInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, data=values.unset, ttl=values.unset): - """ - Update the SyncMapItemInstance - - :param dict data: The data - :param unicode ttl: The ttl - - :returns: Updated SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - """ - return self._proxy.update(data=data, ttl=ttl, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncMapItemInstance {}>'.format(context) diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py b/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py deleted file mode 100644 index c8b3292..0000000 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py +++ /dev/null @@ -1,453 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import 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.page import Page - - -class SyncMapPermissionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, map_sid): - """ - Initialize the SyncMapPermissionList - - :param Version version: Version that contains the resource - :param service_sid: Sync Service Instance SID. - :param map_sid: Sync Map SID. - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionList - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionList - """ - super(SyncMapPermissionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Permissions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncMapPermissionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncMapPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncMapPermissionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SyncMapPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncMapPermissionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncMapPermissionPage(self._version, response, self._solution) - - def get(self, identity): - """ - Constructs a SyncMapPermissionContext - - :param identity: Identity of the user to whom the Sync Map Permission applies. - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionContext - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionContext - """ - return SyncMapPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=identity, - ) - - def __call__(self, identity): - """ - Constructs a SyncMapPermissionContext - - :param identity: Identity of the user to whom the Sync Map Permission applies. - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionContext - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionContext - """ - return SyncMapPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=identity, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncMapPermissionList>' - - -class SyncMapPermissionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncMapPermissionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Sync Service Instance SID. - :param map_sid: Sync Map SID. - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionPage - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionPage - """ - super(SyncMapPermissionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncMapPermissionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncMapPermissionPage>' - - -class SyncMapPermissionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, map_sid, identity): - """ - Initialize the SyncMapPermissionContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param map_sid: Sync Map SID or unique name. - :param identity: Identity of the user to whom the Sync Map Permission applies. - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionContext - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionContext - """ - super(SyncMapPermissionContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Permissions/{identity}'.format(**self._solution) - - def fetch(self): - """ - Fetch a SyncMapPermissionInstance - - :returns: Fetched SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=self._solution['identity'], - ) - - def delete(self): - """ - Deletes the SyncMapPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, read, write, manage): - """ - Update the SyncMapPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: Updated SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - data = values.of({'Read': read, 'Write': write, 'Manage': manage, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=self._solution['identity'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncMapPermissionContext {}>'.format(context) - - -class SyncMapPermissionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, map_sid, identity=None): - """ - Initialize the SyncMapPermissionInstance - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - super(SyncMapPermissionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'map_sid': payload['map_sid'], - 'identity': payload['identity'], - 'read': payload['read'], - 'write': payload['write'], - 'manage': payload['manage'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'service_sid': service_sid, - 'map_sid': map_sid, - 'identity': identity or self._properties['identity'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapPermissionContext for this SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionContext - """ - if self._context is None: - self._context = SyncMapPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=self._solution['identity'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: Twilio Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Sync Service Instance SID. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def map_sid(self): - """ - :returns: Sync Map SID. - :rtype: unicode - """ - return self._properties['map_sid'] - - @property - def identity(self): - """ - :returns: Identity of the user to whom the Sync Map Permission applies. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def read(self): - """ - :returns: Read access. - :rtype: bool - """ - return self._properties['read'] - - @property - def write(self): - """ - :returns: Write access. - :rtype: bool - """ - return self._properties['write'] - - @property - def manage(self): - """ - :returns: Manage access. - :rtype: bool - """ - return self._properties['manage'] - - @property - def url(self): - """ - :returns: URL of this Sync Map Permission. - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a SyncMapPermissionInstance - - :returns: Fetched SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncMapPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, read, write, manage): - """ - Update the SyncMapPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: Updated SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - return self._proxy.update(read, write, manage, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncMapPermissionInstance {}>'.format(context) diff --git a/twilio/rest/sync/v1/service/sync_stream/__init__.py b/twilio/rest/sync/v1/service/sync_stream/__init__.py deleted file mode 100644 index 9027b4c..0000000 --- a/twilio/rest/sync/v1/service/sync_stream/__init__.py +++ /dev/null @@ -1,493 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.sync.v1.service.sync_stream.stream_message import StreamMessageList - - -class SyncStreamList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the SyncStreamList - - :param Version version: Version that contains the resource - :param service_sid: Service Instance SID. - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamList - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamList - """ - super(SyncStreamList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Streams'.format(**self._solution) - - def create(self, unique_name=values.unset, ttl=values.unset): - """ - Create a new SyncStreamInstance - - :param unicode unique_name: Stream unique name. - :param unicode ttl: Stream TTL. - - :returns: Newly created SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - """ - data = values.of({'UniqueName': unique_name, 'Ttl': ttl, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return SyncStreamInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncStreamInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncStreamInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncStreamInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SyncStreamPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncStreamInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncStreamPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SyncStreamContext - - :param sid: Stream SID or unique name. - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - """ - return SyncStreamContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SyncStreamContext - - :param sid: Stream SID or unique name. - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - """ - return SyncStreamContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncStreamList>' - - -class SyncStreamPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncStreamPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Instance SID. - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamPage - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamPage - """ - super(SyncStreamPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncStreamInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - """ - return SyncStreamInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.SyncStreamPage>' - - -class SyncStreamContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the SyncStreamContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: Stream SID or unique name. - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - """ - super(SyncStreamContext, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Streams/{sid}'.format(**self._solution) - - # Dependents - self._stream_messages = None - - def fetch(self): - """ - Fetch a SyncStreamInstance - - :returns: Fetched SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SyncStreamInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the SyncStreamInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, ttl=values.unset): - """ - Update the SyncStreamInstance - - :param unicode ttl: Stream TTL. - - :returns: Updated SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - """ - data = values.of({'Ttl': ttl, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SyncStreamInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def stream_messages(self): - """ - Access the stream_messages - - :returns: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageList - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageList - """ - if self._stream_messages is None: - self._stream_messages = StreamMessageList( - self._version, - service_sid=self._solution['service_sid'], - stream_sid=self._solution['sid'], - ) - return self._stream_messages - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncStreamContext {}>'.format(context) - - -class SyncStreamInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the SyncStreamInstance - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - """ - super(SyncStreamInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'account_sid': payload['account_sid'], - 'service_sid': payload['service_sid'], - 'url': payload['url'], - 'links': payload['links'], - 'date_expires': deserialize.iso8601_datetime(payload['date_expires']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'created_by': payload['created_by'], - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncStreamContext for this SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - """ - if self._context is None: - self._context = SyncStreamContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: Stream SID. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: Stream unique name. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: Twilio Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Service Instance SID. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: URL of this Stream. - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - @property - def date_expires(self): - """ - :returns: The date this Stream expires. - :rtype: datetime - """ - return self._properties['date_expires'] - - @property - def date_created(self): - """ - :returns: The date this Stream was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Stream was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: Identity of the Stream creator. - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch a SyncStreamInstance - - :returns: Fetched SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncStreamInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, ttl=values.unset): - """ - Update the SyncStreamInstance - - :param unicode ttl: Stream TTL. - - :returns: Updated SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - """ - return self._proxy.update(ttl=ttl, ) - - @property - def stream_messages(self): - """ - Access the stream_messages - - :returns: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageList - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageList - """ - return self._proxy.stream_messages - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Sync.V1.SyncStreamInstance {}>'.format(context) diff --git a/twilio/rest/sync/v1/service/sync_stream/__pycache__/__init__.cpython-36.pyc b/twilio/rest/sync/v1/service/sync_stream/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 392162a..0000000 Binary files a/twilio/rest/sync/v1/service/sync_stream/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/sync/v1/service/sync_stream/__pycache__/stream_message.cpython-36.pyc b/twilio/rest/sync/v1/service/sync_stream/__pycache__/stream_message.cpython-36.pyc deleted file mode 100644 index eb972a1..0000000 Binary files a/twilio/rest/sync/v1/service/sync_stream/__pycache__/stream_message.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/sync/v1/service/sync_stream/stream_message.py b/twilio/rest/sync/v1/service/sync_stream/stream_message.py deleted file mode 100644 index 5d4ead9..0000000 --- a/twilio/rest/sync/v1/service/sync_stream/stream_message.py +++ /dev/null @@ -1,161 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class StreamMessageList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, stream_sid): - """ - Initialize the StreamMessageList - - :param Version version: Version that contains the resource - :param service_sid: Service Instance SID. - :param stream_sid: Stream SID. - - :returns: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageList - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageList - """ - super(StreamMessageList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'stream_sid': stream_sid, } - self._uri = '/Services/{service_sid}/Streams/{stream_sid}/Messages'.format(**self._solution) - - def create(self, data): - """ - Create a new StreamMessageInstance - - :param dict data: Stream Message body. - - :returns: Newly created StreamMessageInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance - """ - data = values.of({'Data': serialize.object(data), }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return StreamMessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - stream_sid=self._solution['stream_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.StreamMessageList>' - - -class StreamMessagePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the StreamMessagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Instance SID. - :param stream_sid: Stream SID. - - :returns: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessagePage - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessagePage - """ - super(StreamMessagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of StreamMessageInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance - """ - return StreamMessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - stream_sid=self._solution['stream_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.StreamMessagePage>' - - -class StreamMessageInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, stream_sid): - """ - Initialize the StreamMessageInstance - - :returns: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance - """ - super(StreamMessageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = {'sid': payload['sid'], 'data': payload['data'], } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'stream_sid': stream_sid, } - - @property - def sid(self): - """ - :returns: Stream Message SID. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def data(self): - """ - :returns: Stream Message body. - :rtype: dict - """ - return self._properties['data'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Sync.V1.StreamMessageInstance>' diff --git a/twilio/rest/taskrouter/__init__.py b/twilio/rest/taskrouter/__init__.py deleted file mode 100644 index fd026a5..0000000 --- a/twilio/rest/taskrouter/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.taskrouter.v1 import V1 - - -class Taskrouter(Domain): - - def __init__(self, twilio): - """ - Initialize the Taskrouter Domain - - :returns: Domain for Taskrouter - :rtype: twilio.rest.taskrouter.Taskrouter - """ - super(Taskrouter, self).__init__(twilio) - - self.base_url = 'https://taskrouter.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of taskrouter - :rtype: twilio.rest.taskrouter.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def workspaces(self): - """ - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceList - """ - return self.v1.workspaces - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter>' diff --git a/twilio/rest/taskrouter/__pycache__/__init__.cpython-36.pyc b/twilio/rest/taskrouter/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 2133e93..0000000 Binary files a/twilio/rest/taskrouter/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/__init__.py b/twilio/rest/taskrouter/v1/__init__.py deleted file mode 100644 index c1ea2e7..0000000 --- a/twilio/rest/taskrouter/v1/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.taskrouter.v1.workspace import WorkspaceList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Taskrouter - - :returns: V1 version of Taskrouter - :rtype: twilio.rest.taskrouter.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._workspaces = None - - @property - def workspaces(self): - """ - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceList - """ - if self._workspaces is None: - self._workspaces = WorkspaceList(self) - return self._workspaces - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1>' diff --git a/twilio/rest/taskrouter/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/taskrouter/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 6bc0a8c..0000000 Binary files a/twilio/rest/taskrouter/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/__init__.py b/twilio/rest/taskrouter/v1/workspace/__init__.py deleted file mode 100644 index 81a6379..0000000 --- a/twilio/rest/taskrouter/v1/workspace/__init__.py +++ /dev/null @@ -1,796 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.taskrouter.v1.workspace.activity import ActivityList -from twilio.rest.taskrouter.v1.workspace.event import EventList -from twilio.rest.taskrouter.v1.workspace.task import TaskList -from twilio.rest.taskrouter.v1.workspace.task_channel import TaskChannelList -from twilio.rest.taskrouter.v1.workspace.task_queue import TaskQueueList -from twilio.rest.taskrouter.v1.workspace.worker import WorkerList -from twilio.rest.taskrouter.v1.workspace.workflow import WorkflowList -from twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics import WorkspaceCumulativeStatisticsList -from twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics import WorkspaceRealTimeStatisticsList -from twilio.rest.taskrouter.v1.workspace.workspace_statistics import WorkspaceStatisticsList - - -class WorkspaceList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the WorkspaceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.taskrouter.v1.workspace.WorkspaceList - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceList - """ - super(WorkspaceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Workspaces'.format(**self._solution) - - def stream(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Streams WorkspaceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode friendly_name: The friendly_name - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.WorkspaceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Lists WorkspaceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: The friendly_name - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.WorkspaceInstance] - """ - return list(self.stream(friendly_name=friendly_name, limit=limit, page_size=page_size, )) - - def page(self, friendly_name=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of WorkspaceInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: The friendly_name - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspacePage - """ - params = values.of({ - 'FriendlyName': friendly_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return WorkspacePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of WorkspaceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspacePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return WorkspacePage(self._version, response, self._solution) - - def create(self, friendly_name, event_callback_url=values.unset, - events_filter=values.unset, multi_task_enabled=values.unset, - template=values.unset, prioritize_queue_order=values.unset): - """ - Create a new WorkspaceInstance - - :param unicode friendly_name: The friendly_name - :param unicode event_callback_url: The event_callback_url - :param unicode events_filter: The events_filter - :param bool multi_task_enabled: The multi_task_enabled - :param unicode template: The template - :param WorkspaceInstance.QueueOrder prioritize_queue_order: The prioritize_queue_order - - :returns: Newly created WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'EventCallbackUrl': event_callback_url, - 'EventsFilter': events_filter, - 'MultiTaskEnabled': multi_task_enabled, - 'Template': template, - 'PrioritizeQueueOrder': prioritize_queue_order, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return WorkspaceInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a WorkspaceContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - """ - return WorkspaceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a WorkspaceContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - """ - return WorkspaceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkspaceList>' - - -class WorkspacePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkspacePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.WorkspacePage - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspacePage - """ - super(WorkspacePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkspaceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - """ - return WorkspaceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkspacePage>' - - -class WorkspaceContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the WorkspaceContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - """ - super(WorkspaceContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Workspaces/{sid}'.format(**self._solution) - - # Dependents - self._activities = None - self._events = None - self._tasks = None - self._task_queues = None - self._workers = None - self._workflows = None - self._statistics = None - self._real_time_statistics = None - self._cumulative_statistics = None - self._task_channels = None - - def fetch(self): - """ - Fetch a WorkspaceInstance - - :returns: Fetched WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkspaceInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, default_activity_sid=values.unset, - event_callback_url=values.unset, events_filter=values.unset, - friendly_name=values.unset, multi_task_enabled=values.unset, - timeout_activity_sid=values.unset, - prioritize_queue_order=values.unset): - """ - Update the WorkspaceInstance - - :param unicode default_activity_sid: The default_activity_sid - :param unicode event_callback_url: The event_callback_url - :param unicode events_filter: The events_filter - :param unicode friendly_name: The friendly_name - :param bool multi_task_enabled: The multi_task_enabled - :param unicode timeout_activity_sid: The timeout_activity_sid - :param WorkspaceInstance.QueueOrder prioritize_queue_order: The prioritize_queue_order - - :returns: Updated WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - """ - data = values.of({ - 'DefaultActivitySid': default_activity_sid, - 'EventCallbackUrl': event_callback_url, - 'EventsFilter': events_filter, - 'FriendlyName': friendly_name, - 'MultiTaskEnabled': multi_task_enabled, - 'TimeoutActivitySid': timeout_activity_sid, - 'PrioritizeQueueOrder': prioritize_queue_order, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return WorkspaceInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the WorkspaceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def activities(self): - """ - Access the activities - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityList - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityList - """ - if self._activities is None: - self._activities = ActivityList(self._version, workspace_sid=self._solution['sid'], ) - return self._activities - - @property - def events(self): - """ - Access the events - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventList - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventList - """ - if self._events is None: - self._events = EventList(self._version, workspace_sid=self._solution['sid'], ) - return self._events - - @property - def tasks(self): - """ - Access the tasks - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskList - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskList - """ - if self._tasks is None: - self._tasks = TaskList(self._version, workspace_sid=self._solution['sid'], ) - return self._tasks - - @property - def task_queues(self): - """ - Access the task_queues - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList - """ - if self._task_queues is None: - self._task_queues = TaskQueueList(self._version, workspace_sid=self._solution['sid'], ) - return self._task_queues - - @property - def workers(self): - """ - Access the workers - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerList - """ - if self._workers is None: - self._workers = WorkerList(self._version, workspace_sid=self._solution['sid'], ) - return self._workers - - @property - def workflows(self): - """ - Access the workflows - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowList - """ - if self._workflows is None: - self._workflows = WorkflowList(self._version, workspace_sid=self._solution['sid'], ) - return self._workflows - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList - """ - if self._statistics is None: - self._statistics = WorkspaceStatisticsList(self._version, workspace_sid=self._solution['sid'], ) - return self._statistics - - @property - def real_time_statistics(self): - """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsList - """ - if self._real_time_statistics is None: - self._real_time_statistics = WorkspaceRealTimeStatisticsList( - self._version, - workspace_sid=self._solution['sid'], - ) - return self._real_time_statistics - - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsList - """ - if self._cumulative_statistics is None: - self._cumulative_statistics = WorkspaceCumulativeStatisticsList( - self._version, - workspace_sid=self._solution['sid'], - ) - return self._cumulative_statistics - - @property - def task_channels(self): - """ - Access the task_channels - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelList - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelList - """ - if self._task_channels is None: - self._task_channels = TaskChannelList(self._version, workspace_sid=self._solution['sid'], ) - return self._task_channels - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkspaceContext {}>'.format(context) - - -class WorkspaceInstance(InstanceResource): - """ """ - - class QueueOrder(object): - FIFO = "FIFO" - LIFO = "LIFO" - - def __init__(self, version, payload, sid=None): - """ - Initialize the WorkspaceInstance - - :returns: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - """ - super(WorkspaceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'default_activity_name': payload['default_activity_name'], - 'default_activity_sid': payload['default_activity_sid'], - 'event_callback_url': payload['event_callback_url'], - 'events_filter': payload['events_filter'], - 'friendly_name': payload['friendly_name'], - 'multi_task_enabled': payload['multi_task_enabled'], - 'sid': payload['sid'], - 'timeout_activity_name': payload['timeout_activity_name'], - 'timeout_activity_sid': payload['timeout_activity_sid'], - 'prioritize_queue_order': payload['prioritize_queue_order'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkspaceContext for this WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - """ - if self._context is None: - self._context = WorkspaceContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def default_activity_name(self): - """ - :returns: The default_activity_name - :rtype: unicode - """ - return self._properties['default_activity_name'] - - @property - def default_activity_sid(self): - """ - :returns: The default_activity_sid - :rtype: unicode - """ - return self._properties['default_activity_sid'] - - @property - def event_callback_url(self): - """ - :returns: The event_callback_url - :rtype: unicode - """ - return self._properties['event_callback_url'] - - @property - def events_filter(self): - """ - :returns: The events_filter - :rtype: unicode - """ - return self._properties['events_filter'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def multi_task_enabled(self): - """ - :returns: The multi_task_enabled - :rtype: bool - """ - return self._properties['multi_task_enabled'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def timeout_activity_name(self): - """ - :returns: The timeout_activity_name - :rtype: unicode - """ - return self._properties['timeout_activity_name'] - - @property - def timeout_activity_sid(self): - """ - :returns: The timeout_activity_sid - :rtype: unicode - """ - return self._properties['timeout_activity_sid'] - - @property - def prioritize_queue_order(self): - """ - :returns: The prioritize_queue_order - :rtype: WorkspaceInstance.QueueOrder - """ - return self._properties['prioritize_queue_order'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a WorkspaceInstance - - :returns: Fetched WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - """ - return self._proxy.fetch() - - def update(self, default_activity_sid=values.unset, - event_callback_url=values.unset, events_filter=values.unset, - friendly_name=values.unset, multi_task_enabled=values.unset, - timeout_activity_sid=values.unset, - prioritize_queue_order=values.unset): - """ - Update the WorkspaceInstance - - :param unicode default_activity_sid: The default_activity_sid - :param unicode event_callback_url: The event_callback_url - :param unicode events_filter: The events_filter - :param unicode friendly_name: The friendly_name - :param bool multi_task_enabled: The multi_task_enabled - :param unicode timeout_activity_sid: The timeout_activity_sid - :param WorkspaceInstance.QueueOrder prioritize_queue_order: The prioritize_queue_order - - :returns: Updated WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - """ - return self._proxy.update( - default_activity_sid=default_activity_sid, - event_callback_url=event_callback_url, - events_filter=events_filter, - friendly_name=friendly_name, - multi_task_enabled=multi_task_enabled, - timeout_activity_sid=timeout_activity_sid, - prioritize_queue_order=prioritize_queue_order, - ) - - def delete(self): - """ - Deletes the WorkspaceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def activities(self): - """ - Access the activities - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityList - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityList - """ - return self._proxy.activities - - @property - def events(self): - """ - Access the events - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventList - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventList - """ - return self._proxy.events - - @property - def tasks(self): - """ - Access the tasks - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskList - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskList - """ - return self._proxy.tasks - - @property - def task_queues(self): - """ - Access the task_queues - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList - """ - return self._proxy.task_queues - - @property - def workers(self): - """ - Access the workers - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerList - """ - return self._proxy.workers - - @property - def workflows(self): - """ - Access the workflows - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowList - """ - return self._proxy.workflows - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList - """ - return self._proxy.statistics - - @property - def real_time_statistics(self): - """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsList - """ - return self._proxy.real_time_statistics - - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsList - """ - return self._proxy.cumulative_statistics - - @property - def task_channels(self): - """ - Access the task_channels - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelList - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelList - """ - return self._proxy.task_channels - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkspaceInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/__pycache__/__init__.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 5eca0ed..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/__pycache__/activity.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/__pycache__/activity.cpython-36.pyc deleted file mode 100644 index a04b826..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/__pycache__/activity.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/__pycache__/event.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/__pycache__/event.cpython-36.pyc deleted file mode 100644 index 30b6a1f..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/__pycache__/event.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/__pycache__/task_channel.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/__pycache__/task_channel.cpython-36.pyc deleted file mode 100644 index 88882ba..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/__pycache__/task_channel.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/__pycache__/workspace_cumulative_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/__pycache__/workspace_cumulative_statistics.cpython-36.pyc deleted file mode 100644 index aba5663..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/__pycache__/workspace_cumulative_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/__pycache__/workspace_real_time_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/__pycache__/workspace_real_time_statistics.cpython-36.pyc deleted file mode 100644 index e96ee71..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/__pycache__/workspace_real_time_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/__pycache__/workspace_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/__pycache__/workspace_statistics.cpython-36.pyc deleted file mode 100644 index c39666e..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/__pycache__/workspace_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/activity.py b/twilio/rest/taskrouter/v1/workspace/activity.py deleted file mode 100644 index affb6eb..0000000 --- a/twilio/rest/taskrouter/v1/workspace/activity.py +++ /dev/null @@ -1,461 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class ActivityList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the ActivityList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityList - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityList - """ - super(ActivityList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Activities'.format(**self._solution) - - def stream(self, friendly_name=values.unset, available=values.unset, limit=None, - page_size=None): - """ - Streams ActivityInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode friendly_name: The friendly_name - :param unicode available: The available - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, available=available, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, friendly_name=values.unset, available=values.unset, limit=None, - page_size=None): - """ - Lists ActivityInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: The friendly_name - :param unicode available: The available - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance] - """ - return list(self.stream( - friendly_name=friendly_name, - available=available, - limit=limit, - page_size=page_size, - )) - - def page(self, friendly_name=values.unset, available=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ActivityInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: The friendly_name - :param unicode available: The available - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityPage - """ - params = values.of({ - 'FriendlyName': friendly_name, - 'Available': available, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ActivityPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ActivityInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ActivityPage(self._version, response, self._solution) - - def create(self, friendly_name, available=values.unset): - """ - Create a new ActivityInstance - - :param unicode friendly_name: The friendly_name - :param bool available: The available - - :returns: Newly created ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - """ - data = values.of({'FriendlyName': friendly_name, 'Available': available, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return ActivityInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def get(self, sid): - """ - Constructs a ActivityContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - """ - return ActivityContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ActivityContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - """ - return ActivityContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.ActivityList>' - - -class ActivityPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ActivityPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityPage - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityPage - """ - super(ActivityPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ActivityInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - """ - return ActivityInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.ActivityPage>' - - -class ActivityContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, sid): - """ - Initialize the ActivityContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - """ - super(ActivityContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Activities/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a ActivityInstance - - :returns: Fetched ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ActivityInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset): - """ - Update the ActivityInstance - - :param unicode friendly_name: The friendly_name - - :returns: Updated ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ActivityInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the ActivityInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.ActivityContext {}>'.format(context) - - -class ActivityInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the ActivityInstance - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - """ - super(ActivityInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'available': payload['available'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'sid': payload['sid'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ActivityContext for this ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - """ - if self._context is None: - self._context = ActivityContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def available(self): - """ - :returns: The available - :rtype: bool - """ - return self._properties['available'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a ActivityInstance - - :returns: Fetched ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset): - """ - Update the ActivityInstance - - :param unicode friendly_name: The friendly_name - - :returns: Updated ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) - - def delete(self): - """ - Deletes the ActivityInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.ActivityInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/event.py b/twilio/rest/taskrouter/v1/workspace/event.py deleted file mode 100644 index b632ade..0000000 --- a/twilio/rest/taskrouter/v1/workspace/event.py +++ /dev/null @@ -1,507 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class EventList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the EventList - - :param Version version: Version that contains the resource - :param workspace_sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventList - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventList - """ - super(EventList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Events'.format(**self._solution) - - def stream(self, end_date=values.unset, event_type=values.unset, - minutes=values.unset, reservation_sid=values.unset, - start_date=values.unset, task_queue_sid=values.unset, - task_sid=values.unset, worker_sid=values.unset, - workflow_sid=values.unset, limit=None, page_size=None): - """ - Streams EventInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param datetime end_date: The end_date - :param unicode event_type: The event_type - :param unicode minutes: The minutes - :param unicode reservation_sid: The reservation_sid - :param datetime start_date: The start_date - :param unicode task_queue_sid: The task_queue_sid - :param unicode task_sid: The task_sid - :param unicode worker_sid: The worker_sid - :param unicode workflow_sid: The workflow_sid - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.event.EventInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - end_date=end_date, - event_type=event_type, - minutes=minutes, - reservation_sid=reservation_sid, - start_date=start_date, - task_queue_sid=task_queue_sid, - task_sid=task_sid, - worker_sid=worker_sid, - workflow_sid=workflow_sid, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, end_date=values.unset, event_type=values.unset, - minutes=values.unset, reservation_sid=values.unset, - start_date=values.unset, task_queue_sid=values.unset, - task_sid=values.unset, worker_sid=values.unset, - workflow_sid=values.unset, limit=None, page_size=None): - """ - Lists EventInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime end_date: The end_date - :param unicode event_type: The event_type - :param unicode minutes: The minutes - :param unicode reservation_sid: The reservation_sid - :param datetime start_date: The start_date - :param unicode task_queue_sid: The task_queue_sid - :param unicode task_sid: The task_sid - :param unicode worker_sid: The worker_sid - :param unicode workflow_sid: The workflow_sid - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.event.EventInstance] - """ - return list(self.stream( - end_date=end_date, - event_type=event_type, - minutes=minutes, - reservation_sid=reservation_sid, - start_date=start_date, - task_queue_sid=task_queue_sid, - task_sid=task_sid, - worker_sid=worker_sid, - workflow_sid=workflow_sid, - limit=limit, - page_size=page_size, - )) - - def page(self, end_date=values.unset, event_type=values.unset, - minutes=values.unset, reservation_sid=values.unset, - start_date=values.unset, task_queue_sid=values.unset, - task_sid=values.unset, worker_sid=values.unset, - workflow_sid=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of EventInstance records from the API. - Request is executed immediately - - :param datetime end_date: The end_date - :param unicode event_type: The event_type - :param unicode minutes: The minutes - :param unicode reservation_sid: The reservation_sid - :param datetime start_date: The start_date - :param unicode task_queue_sid: The task_queue_sid - :param unicode task_sid: The task_sid - :param unicode worker_sid: The worker_sid - :param unicode workflow_sid: The workflow_sid - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventPage - """ - params = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'EventType': event_type, - 'Minutes': minutes, - 'ReservationSid': reservation_sid, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskQueueSid': task_queue_sid, - 'TaskSid': task_sid, - 'WorkerSid': worker_sid, - 'WorkflowSid': workflow_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return EventPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EventInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EventPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a EventContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventContext - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventContext - """ - return EventContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EventContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventContext - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventContext - """ - return EventContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.EventList>' - - -class EventPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the EventPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventPage - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventPage - """ - super(EventPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EventInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventInstance - """ - return EventInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.EventPage>' - - -class EventContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, sid): - """ - Initialize the EventContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventContext - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventContext - """ - super(EventContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Events/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a EventInstance - - :returns: Fetched EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return EventInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.EventContext {}>'.format(context) - - -class EventInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the EventInstance - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventInstance - """ - super(EventInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'actor_sid': payload['actor_sid'], - 'actor_type': payload['actor_type'], - 'actor_url': payload['actor_url'], - 'description': payload['description'], - 'event_data': payload['event_data'], - 'event_date': deserialize.iso8601_datetime(payload['event_date']), - 'event_type': payload['event_type'], - 'resource_sid': payload['resource_sid'], - 'resource_type': payload['resource_type'], - 'resource_url': payload['resource_url'], - 'sid': payload['sid'], - 'source': payload['source'], - 'source_ip_address': payload['source_ip_address'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EventContext for this EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventContext - """ - if self._context is None: - self._context = EventContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def actor_sid(self): - """ - :returns: The actor_sid - :rtype: unicode - """ - return self._properties['actor_sid'] - - @property - def actor_type(self): - """ - :returns: The actor_type - :rtype: unicode - """ - return self._properties['actor_type'] - - @property - def actor_url(self): - """ - :returns: The actor_url - :rtype: unicode - """ - return self._properties['actor_url'] - - @property - def description(self): - """ - :returns: The description - :rtype: unicode - """ - return self._properties['description'] - - @property - def event_data(self): - """ - :returns: The event_data - :rtype: unicode - """ - return self._properties['event_data'] - - @property - def event_date(self): - """ - :returns: The event_date - :rtype: datetime - """ - return self._properties['event_date'] - - @property - def event_type(self): - """ - :returns: The event_type - :rtype: unicode - """ - return self._properties['event_type'] - - @property - def resource_sid(self): - """ - :returns: The resource_sid - :rtype: unicode - """ - return self._properties['resource_sid'] - - @property - def resource_type(self): - """ - :returns: The resource_type - :rtype: unicode - """ - return self._properties['resource_type'] - - @property - def resource_url(self): - """ - :returns: The resource_url - :rtype: unicode - """ - return self._properties['resource_url'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def source(self): - """ - :returns: The source - :rtype: unicode - """ - return self._properties['source'] - - @property - def source_ip_address(self): - """ - :returns: The source_ip_address - :rtype: unicode - """ - return self._properties['source_ip_address'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a EventInstance - - :returns: Fetched EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.EventInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/task/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py deleted file mode 100644 index d4968b0..0000000 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ /dev/null @@ -1,698 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.taskrouter.v1.workspace.task.reservation import ReservationList - - -class TaskList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the TaskList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskList - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskList - """ - super(TaskList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Tasks'.format(**self._solution) - - def stream(self, priority=values.unset, assignment_status=values.unset, - workflow_sid=values.unset, workflow_name=values.unset, - task_queue_sid=values.unset, task_queue_name=values.unset, - evaluate_task_attributes=values.unset, ordering=values.unset, - has_addons=values.unset, limit=None, page_size=None): - """ - Streams TaskInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode priority: The priority - :param unicode assignment_status: The assignment_status - :param unicode workflow_sid: The workflow_sid - :param unicode workflow_name: The workflow_name - :param unicode task_queue_sid: The task_queue_sid - :param unicode task_queue_name: The task_queue_name - :param unicode evaluate_task_attributes: The evaluate_task_attributes - :param unicode ordering: The ordering - :param bool has_addons: The has_addons - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.task.TaskInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - priority=priority, - assignment_status=assignment_status, - workflow_sid=workflow_sid, - workflow_name=workflow_name, - task_queue_sid=task_queue_sid, - task_queue_name=task_queue_name, - evaluate_task_attributes=evaluate_task_attributes, - ordering=ordering, - has_addons=has_addons, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, priority=values.unset, assignment_status=values.unset, - workflow_sid=values.unset, workflow_name=values.unset, - task_queue_sid=values.unset, task_queue_name=values.unset, - evaluate_task_attributes=values.unset, ordering=values.unset, - has_addons=values.unset, limit=None, page_size=None): - """ - Lists TaskInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode priority: The priority - :param unicode assignment_status: The assignment_status - :param unicode workflow_sid: The workflow_sid - :param unicode workflow_name: The workflow_name - :param unicode task_queue_sid: The task_queue_sid - :param unicode task_queue_name: The task_queue_name - :param unicode evaluate_task_attributes: The evaluate_task_attributes - :param unicode ordering: The ordering - :param bool has_addons: The has_addons - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.task.TaskInstance] - """ - return list(self.stream( - priority=priority, - assignment_status=assignment_status, - workflow_sid=workflow_sid, - workflow_name=workflow_name, - task_queue_sid=task_queue_sid, - task_queue_name=task_queue_name, - evaluate_task_attributes=evaluate_task_attributes, - ordering=ordering, - has_addons=has_addons, - limit=limit, - page_size=page_size, - )) - - def page(self, priority=values.unset, assignment_status=values.unset, - workflow_sid=values.unset, workflow_name=values.unset, - task_queue_sid=values.unset, task_queue_name=values.unset, - evaluate_task_attributes=values.unset, ordering=values.unset, - has_addons=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of TaskInstance records from the API. - Request is executed immediately - - :param unicode priority: The priority - :param unicode assignment_status: The assignment_status - :param unicode workflow_sid: The workflow_sid - :param unicode workflow_name: The workflow_name - :param unicode task_queue_sid: The task_queue_sid - :param unicode task_queue_name: The task_queue_name - :param unicode evaluate_task_attributes: The evaluate_task_attributes - :param unicode ordering: The ordering - :param bool has_addons: The has_addons - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskPage - """ - params = values.of({ - 'Priority': priority, - 'AssignmentStatus': serialize.map(assignment_status, lambda e: e), - 'WorkflowSid': workflow_sid, - 'WorkflowName': workflow_name, - 'TaskQueueSid': task_queue_sid, - 'TaskQueueName': task_queue_name, - 'EvaluateTaskAttributes': evaluate_task_attributes, - 'Ordering': ordering, - 'HasAddons': has_addons, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return TaskPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TaskInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TaskPage(self._version, response, self._solution) - - def create(self, timeout=values.unset, priority=values.unset, - task_channel=values.unset, workflow_sid=values.unset, - attributes=values.unset): - """ - Create a new TaskInstance - - :param unicode timeout: The timeout - :param unicode priority: The priority - :param unicode task_channel: The task_channel - :param unicode workflow_sid: The workflow_sid - :param unicode attributes: The attributes - - :returns: Newly created TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - """ - data = values.of({ - 'Timeout': timeout, - 'Priority': priority, - 'TaskChannel': task_channel, - 'WorkflowSid': workflow_sid, - 'Attributes': attributes, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return TaskInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def get(self, sid): - """ - Constructs a TaskContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskContext - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskContext - """ - return TaskContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TaskContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskContext - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskContext - """ - return TaskContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskList>' - - -class TaskPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TaskPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskPage - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskPage - """ - super(TaskPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - """ - return TaskInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskPage>' - - -class TaskContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, sid): - """ - Initialize the TaskContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskContext - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskContext - """ - super(TaskContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Tasks/{sid}'.format(**self._solution) - - # Dependents - self._reservations = None - - def fetch(self): - """ - Fetch a TaskInstance - - :returns: Fetched TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return TaskInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def update(self, attributes=values.unset, assignment_status=values.unset, - reason=values.unset, priority=values.unset, - task_channel=values.unset): - """ - Update the TaskInstance - - :param unicode attributes: The attributes - :param TaskInstance.Status assignment_status: The assignment_status - :param unicode reason: The reason - :param unicode priority: The priority - :param unicode task_channel: The task_channel - - :returns: Updated TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - """ - data = values.of({ - 'Attributes': attributes, - 'AssignmentStatus': assignment_status, - 'Reason': reason, - 'Priority': priority, - 'TaskChannel': task_channel, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return TaskInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the TaskInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def reservations(self): - """ - Access the reservations - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationList - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationList - """ - if self._reservations is None: - self._reservations = ReservationList( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['sid'], - ) - return self._reservations - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.TaskContext {}>'.format(context) - - -class TaskInstance(InstanceResource): - """ """ - - class Status(object): - PENDING = "pending" - RESERVED = "reserved" - ASSIGNED = "assigned" - CANCELED = "canceled" - COMPLETED = "completed" - WRAPPING = "wrapping" - - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the TaskInstance - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - """ - super(TaskInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'age': deserialize.integer(payload['age']), - 'assignment_status': payload['assignment_status'], - 'attributes': payload['attributes'], - 'addons': payload['addons'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'priority': deserialize.integer(payload['priority']), - 'reason': payload['reason'], - 'sid': payload['sid'], - 'task_queue_sid': payload['task_queue_sid'], - 'task_queue_friendly_name': payload['task_queue_friendly_name'], - 'task_channel_sid': payload['task_channel_sid'], - 'task_channel_unique_name': payload['task_channel_unique_name'], - 'timeout': deserialize.integer(payload['timeout']), - 'workflow_sid': payload['workflow_sid'], - 'workflow_friendly_name': payload['workflow_friendly_name'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskContext for this TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskContext - """ - if self._context is None: - self._context = TaskContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def age(self): - """ - :returns: The age - :rtype: unicode - """ - return self._properties['age'] - - @property - def assignment_status(self): - """ - :returns: The assignment_status - :rtype: TaskInstance.Status - """ - return self._properties['assignment_status'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def addons(self): - """ - :returns: The addons - :rtype: unicode - """ - return self._properties['addons'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def priority(self): - """ - :returns: The priority - :rtype: unicode - """ - return self._properties['priority'] - - @property - def reason(self): - """ - :returns: The reason - :rtype: unicode - """ - return self._properties['reason'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def task_queue_sid(self): - """ - :returns: The task_queue_sid - :rtype: unicode - """ - return self._properties['task_queue_sid'] - - @property - def task_queue_friendly_name(self): - """ - :returns: The task_queue_friendly_name - :rtype: unicode - """ - return self._properties['task_queue_friendly_name'] - - @property - def task_channel_sid(self): - """ - :returns: The task_channel_sid - :rtype: unicode - """ - return self._properties['task_channel_sid'] - - @property - def task_channel_unique_name(self): - """ - :returns: The task_channel_unique_name - :rtype: unicode - """ - return self._properties['task_channel_unique_name'] - - @property - def timeout(self): - """ - :returns: The timeout - :rtype: unicode - """ - return self._properties['timeout'] - - @property - def workflow_sid(self): - """ - :returns: The workflow_sid - :rtype: unicode - """ - return self._properties['workflow_sid'] - - @property - def workflow_friendly_name(self): - """ - :returns: The workflow_friendly_name - :rtype: unicode - """ - return self._properties['workflow_friendly_name'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a TaskInstance - - :returns: Fetched TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - """ - return self._proxy.fetch() - - def update(self, attributes=values.unset, assignment_status=values.unset, - reason=values.unset, priority=values.unset, - task_channel=values.unset): - """ - Update the TaskInstance - - :param unicode attributes: The attributes - :param TaskInstance.Status assignment_status: The assignment_status - :param unicode reason: The reason - :param unicode priority: The priority - :param unicode task_channel: The task_channel - - :returns: Updated TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - """ - return self._proxy.update( - attributes=attributes, - assignment_status=assignment_status, - reason=reason, - priority=priority, - task_channel=task_channel, - ) - - def delete(self): - """ - Deletes the TaskInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def reservations(self): - """ - Access the reservations - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationList - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationList - """ - return self._proxy.reservations - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.TaskInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/task/__pycache__/__init__.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/task/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index fc11dd7..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/task/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/task/__pycache__/reservation.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/task/__pycache__/reservation.cpython-36.pyc deleted file mode 100644 index 0d04306..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/task/__pycache__/reservation.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/task/reservation.py b/twilio/rest/taskrouter/v1/workspace/task/reservation.py deleted file mode 100644 index 83c526f..0000000 --- a/twilio/rest/taskrouter/v1/workspace/task/reservation.py +++ /dev/null @@ -1,743 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class ReservationList(ListResource): - """ """ - - def __init__(self, version, workspace_sid, task_sid): - """ - Initialize the ReservationList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param task_sid: The task_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationList - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationList - """ - super(ReservationList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_sid': task_sid, } - self._uri = '/Workspaces/{workspace_sid}/Tasks/{task_sid}/Reservations'.format(**self._solution) - - def stream(self, reservation_status=values.unset, limit=None, page_size=None): - """ - Streams ReservationInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param ReservationInstance.Status reservation_status: The reservation_status - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(reservation_status=reservation_status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, reservation_status=values.unset, limit=None, page_size=None): - """ - Lists ReservationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param ReservationInstance.Status reservation_status: The reservation_status - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance] - """ - return list(self.stream(reservation_status=reservation_status, limit=limit, page_size=page_size, )) - - def page(self, reservation_status=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ReservationInstance records from the API. - Request is executed immediately - - :param ReservationInstance.Status reservation_status: The reservation_status - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationPage - """ - params = values.of({ - 'ReservationStatus': reservation_status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ReservationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ReservationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ReservationPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ReservationContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - """ - return ReservationContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['task_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a ReservationContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - """ - return ReservationContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['task_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.ReservationList>' - - -class ReservationPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ReservationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - :param task_sid: The task_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationPage - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationPage - """ - super(ReservationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ReservationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - """ - return ReservationInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['task_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.ReservationPage>' - - -class ReservationContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, task_sid, sid): - """ - Initialize the ReservationContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param task_sid: The task_sid - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - """ - super(ReservationContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_sid': task_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Tasks/{task_sid}/Reservations/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a ReservationInstance - - :returns: Fetched ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ReservationInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], - ) - - def update(self, reservation_status=values.unset, - worker_activity_sid=values.unset, instruction=values.unset, - dequeue_post_work_activity_sid=values.unset, - dequeue_from=values.unset, dequeue_record=values.unset, - dequeue_timeout=values.unset, dequeue_to=values.unset, - dequeue_status_callback_url=values.unset, call_from=values.unset, - call_record=values.unset, call_timeout=values.unset, - call_to=values.unset, call_url=values.unset, - call_status_callback_url=values.unset, call_accept=values.unset, - redirect_call_sid=values.unset, redirect_accept=values.unset, - redirect_url=values.unset, to=values.unset, from_=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - status_callback_event=values.unset, timeout=values.unset, - record=values.unset, muted=values.unset, beep=values.unset, - start_conference_on_enter=values.unset, - end_conference_on_exit=values.unset, wait_url=values.unset, - wait_method=values.unset, early_media=values.unset, - max_participants=values.unset, - conference_status_callback=values.unset, - conference_status_callback_method=values.unset, - conference_status_callback_event=values.unset, - conference_record=values.unset, conference_trim=values.unset, - recording_channels=values.unset, - recording_status_callback=values.unset, - recording_status_callback_method=values.unset, - conference_recording_status_callback=values.unset, - conference_recording_status_callback_method=values.unset, - region=values.unset, sip_auth_username=values.unset, - sip_auth_password=values.unset, - dequeue_status_callback_event=values.unset, - post_work_activity_sid=values.unset): - """ - Update the ReservationInstance - - :param ReservationInstance.Status reservation_status: The reservation_status - :param unicode worker_activity_sid: The worker_activity_sid - :param unicode instruction: The instruction - :param unicode dequeue_post_work_activity_sid: The dequeue_post_work_activity_sid - :param unicode dequeue_from: The dequeue_from - :param unicode dequeue_record: The dequeue_record - :param unicode dequeue_timeout: The dequeue_timeout - :param unicode dequeue_to: The dequeue_to - :param unicode dequeue_status_callback_url: The dequeue_status_callback_url - :param unicode call_from: The call_from - :param unicode call_record: The call_record - :param unicode call_timeout: The call_timeout - :param unicode call_to: The call_to - :param unicode call_url: The call_url - :param unicode call_status_callback_url: The call_status_callback_url - :param bool call_accept: The call_accept - :param unicode redirect_call_sid: The redirect_call_sid - :param bool redirect_accept: The redirect_accept - :param unicode redirect_url: The redirect_url - :param unicode to: The to - :param unicode from_: The from - :param unicode status_callback: The status_callback - :param unicode status_callback_method: The status_callback_method - :param ReservationInstance.CallStatus status_callback_event: The status_callback_event - :param unicode timeout: The timeout - :param bool record: The record - :param bool muted: The muted - :param unicode beep: The beep - :param bool start_conference_on_enter: The start_conference_on_enter - :param bool end_conference_on_exit: The end_conference_on_exit - :param unicode wait_url: The wait_url - :param unicode wait_method: The wait_method - :param bool early_media: The early_media - :param unicode max_participants: The max_participants - :param unicode conference_status_callback: The conference_status_callback - :param unicode conference_status_callback_method: The conference_status_callback_method - :param ReservationInstance.ConferenceEvent conference_status_callback_event: The conference_status_callback_event - :param unicode conference_record: The conference_record - :param unicode conference_trim: The conference_trim - :param unicode recording_channels: The recording_channels - :param unicode recording_status_callback: The recording_status_callback - :param unicode recording_status_callback_method: The recording_status_callback_method - :param unicode conference_recording_status_callback: The conference_recording_status_callback - :param unicode conference_recording_status_callback_method: The conference_recording_status_callback_method - :param unicode region: The region - :param unicode sip_auth_username: The sip_auth_username - :param unicode sip_auth_password: The sip_auth_password - :param unicode dequeue_status_callback_event: The dequeue_status_callback_event - :param unicode post_work_activity_sid: The post_work_activity_sid - - :returns: Updated ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - """ - data = values.of({ - 'ReservationStatus': reservation_status, - 'WorkerActivitySid': worker_activity_sid, - 'Instruction': instruction, - 'DequeuePostWorkActivitySid': dequeue_post_work_activity_sid, - 'DequeueFrom': dequeue_from, - 'DequeueRecord': dequeue_record, - 'DequeueTimeout': dequeue_timeout, - 'DequeueTo': dequeue_to, - 'DequeueStatusCallbackUrl': dequeue_status_callback_url, - 'CallFrom': call_from, - 'CallRecord': call_record, - 'CallTimeout': call_timeout, - 'CallTo': call_to, - 'CallUrl': call_url, - 'CallStatusCallbackUrl': call_status_callback_url, - 'CallAccept': call_accept, - 'RedirectCallSid': redirect_call_sid, - 'RedirectAccept': redirect_accept, - 'RedirectUrl': redirect_url, - 'To': to, - 'From': from_, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'StatusCallbackEvent': serialize.map(status_callback_event, lambda e: e), - 'Timeout': timeout, - 'Record': record, - 'Muted': muted, - 'Beep': beep, - 'StartConferenceOnEnter': start_conference_on_enter, - 'EndConferenceOnExit': end_conference_on_exit, - 'WaitUrl': wait_url, - 'WaitMethod': wait_method, - 'EarlyMedia': early_media, - 'MaxParticipants': max_participants, - 'ConferenceStatusCallback': conference_status_callback, - 'ConferenceStatusCallbackMethod': conference_status_callback_method, - 'ConferenceStatusCallbackEvent': serialize.map(conference_status_callback_event, lambda e: e), - 'ConferenceRecord': conference_record, - 'ConferenceTrim': conference_trim, - 'RecordingChannels': recording_channels, - 'RecordingStatusCallback': recording_status_callback, - 'RecordingStatusCallbackMethod': recording_status_callback_method, - 'ConferenceRecordingStatusCallback': conference_recording_status_callback, - 'ConferenceRecordingStatusCallbackMethod': conference_recording_status_callback_method, - 'Region': region, - 'SipAuthUsername': sip_auth_username, - 'SipAuthPassword': sip_auth_password, - 'DequeueStatusCallbackEvent': serialize.map(dequeue_status_callback_event, lambda e: e), - 'PostWorkActivitySid': post_work_activity_sid, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ReservationInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.ReservationContext {}>'.format(context) - - -class ReservationInstance(InstanceResource): - """ """ - - class Status(object): - PENDING = "pending" - ACCEPTED = "accepted" - REJECTED = "rejected" - TIMEOUT = "timeout" - CANCELED = "canceled" - RESCINDED = "rescinded" - - class CallStatus(object): - INITIATED = "initiated" - RINGING = "ringing" - ANSWERED = "answered" - COMPLETED = "completed" - - class ConferenceEvent(object): - START = "start" - END = "end" - JOIN = "join" - LEAVE = "leave" - MUTE = "mute" - HOLD = "hold" - SPEAKER = "speaker" - - def __init__(self, version, payload, workspace_sid, task_sid, sid=None): - """ - Initialize the ReservationInstance - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - """ - super(ReservationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'reservation_status': payload['reservation_status'], - 'sid': payload['sid'], - 'task_sid': payload['task_sid'], - 'worker_name': payload['worker_name'], - 'worker_sid': payload['worker_sid'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = { - 'workspace_sid': workspace_sid, - 'task_sid': task_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ReservationContext for this ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - """ - if self._context is None: - self._context = ReservationContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def reservation_status(self): - """ - :returns: The reservation_status - :rtype: ReservationInstance.Status - """ - return self._properties['reservation_status'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def task_sid(self): - """ - :returns: The task_sid - :rtype: unicode - """ - return self._properties['task_sid'] - - @property - def worker_name(self): - """ - :returns: The worker_name - :rtype: unicode - """ - return self._properties['worker_name'] - - @property - def worker_sid(self): - """ - :returns: The worker_sid - :rtype: unicode - """ - return self._properties['worker_sid'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ReservationInstance - - :returns: Fetched ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - """ - return self._proxy.fetch() - - def update(self, reservation_status=values.unset, - worker_activity_sid=values.unset, instruction=values.unset, - dequeue_post_work_activity_sid=values.unset, - dequeue_from=values.unset, dequeue_record=values.unset, - dequeue_timeout=values.unset, dequeue_to=values.unset, - dequeue_status_callback_url=values.unset, call_from=values.unset, - call_record=values.unset, call_timeout=values.unset, - call_to=values.unset, call_url=values.unset, - call_status_callback_url=values.unset, call_accept=values.unset, - redirect_call_sid=values.unset, redirect_accept=values.unset, - redirect_url=values.unset, to=values.unset, from_=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - status_callback_event=values.unset, timeout=values.unset, - record=values.unset, muted=values.unset, beep=values.unset, - start_conference_on_enter=values.unset, - end_conference_on_exit=values.unset, wait_url=values.unset, - wait_method=values.unset, early_media=values.unset, - max_participants=values.unset, - conference_status_callback=values.unset, - conference_status_callback_method=values.unset, - conference_status_callback_event=values.unset, - conference_record=values.unset, conference_trim=values.unset, - recording_channels=values.unset, - recording_status_callback=values.unset, - recording_status_callback_method=values.unset, - conference_recording_status_callback=values.unset, - conference_recording_status_callback_method=values.unset, - region=values.unset, sip_auth_username=values.unset, - sip_auth_password=values.unset, - dequeue_status_callback_event=values.unset, - post_work_activity_sid=values.unset): - """ - Update the ReservationInstance - - :param ReservationInstance.Status reservation_status: The reservation_status - :param unicode worker_activity_sid: The worker_activity_sid - :param unicode instruction: The instruction - :param unicode dequeue_post_work_activity_sid: The dequeue_post_work_activity_sid - :param unicode dequeue_from: The dequeue_from - :param unicode dequeue_record: The dequeue_record - :param unicode dequeue_timeout: The dequeue_timeout - :param unicode dequeue_to: The dequeue_to - :param unicode dequeue_status_callback_url: The dequeue_status_callback_url - :param unicode call_from: The call_from - :param unicode call_record: The call_record - :param unicode call_timeout: The call_timeout - :param unicode call_to: The call_to - :param unicode call_url: The call_url - :param unicode call_status_callback_url: The call_status_callback_url - :param bool call_accept: The call_accept - :param unicode redirect_call_sid: The redirect_call_sid - :param bool redirect_accept: The redirect_accept - :param unicode redirect_url: The redirect_url - :param unicode to: The to - :param unicode from_: The from - :param unicode status_callback: The status_callback - :param unicode status_callback_method: The status_callback_method - :param ReservationInstance.CallStatus status_callback_event: The status_callback_event - :param unicode timeout: The timeout - :param bool record: The record - :param bool muted: The muted - :param unicode beep: The beep - :param bool start_conference_on_enter: The start_conference_on_enter - :param bool end_conference_on_exit: The end_conference_on_exit - :param unicode wait_url: The wait_url - :param unicode wait_method: The wait_method - :param bool early_media: The early_media - :param unicode max_participants: The max_participants - :param unicode conference_status_callback: The conference_status_callback - :param unicode conference_status_callback_method: The conference_status_callback_method - :param ReservationInstance.ConferenceEvent conference_status_callback_event: The conference_status_callback_event - :param unicode conference_record: The conference_record - :param unicode conference_trim: The conference_trim - :param unicode recording_channels: The recording_channels - :param unicode recording_status_callback: The recording_status_callback - :param unicode recording_status_callback_method: The recording_status_callback_method - :param unicode conference_recording_status_callback: The conference_recording_status_callback - :param unicode conference_recording_status_callback_method: The conference_recording_status_callback_method - :param unicode region: The region - :param unicode sip_auth_username: The sip_auth_username - :param unicode sip_auth_password: The sip_auth_password - :param unicode dequeue_status_callback_event: The dequeue_status_callback_event - :param unicode post_work_activity_sid: The post_work_activity_sid - - :returns: Updated ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - """ - return self._proxy.update( - reservation_status=reservation_status, - worker_activity_sid=worker_activity_sid, - instruction=instruction, - dequeue_post_work_activity_sid=dequeue_post_work_activity_sid, - dequeue_from=dequeue_from, - dequeue_record=dequeue_record, - dequeue_timeout=dequeue_timeout, - dequeue_to=dequeue_to, - dequeue_status_callback_url=dequeue_status_callback_url, - call_from=call_from, - call_record=call_record, - call_timeout=call_timeout, - call_to=call_to, - call_url=call_url, - call_status_callback_url=call_status_callback_url, - call_accept=call_accept, - redirect_call_sid=redirect_call_sid, - redirect_accept=redirect_accept, - redirect_url=redirect_url, - to=to, - from_=from_, - status_callback=status_callback, - status_callback_method=status_callback_method, - status_callback_event=status_callback_event, - timeout=timeout, - record=record, - muted=muted, - beep=beep, - start_conference_on_enter=start_conference_on_enter, - end_conference_on_exit=end_conference_on_exit, - wait_url=wait_url, - wait_method=wait_method, - early_media=early_media, - max_participants=max_participants, - conference_status_callback=conference_status_callback, - conference_status_callback_method=conference_status_callback_method, - conference_status_callback_event=conference_status_callback_event, - conference_record=conference_record, - conference_trim=conference_trim, - recording_channels=recording_channels, - recording_status_callback=recording_status_callback, - recording_status_callback_method=recording_status_callback_method, - conference_recording_status_callback=conference_recording_status_callback, - conference_recording_status_callback_method=conference_recording_status_callback_method, - region=region, - sip_auth_username=sip_auth_username, - sip_auth_password=sip_auth_password, - dequeue_status_callback_event=dequeue_status_callback_event, - post_work_activity_sid=post_work_activity_sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.ReservationInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/task_channel.py b/twilio/rest/taskrouter/v1/workspace/task_channel.py deleted file mode 100644 index 17c13f6..0000000 --- a/twilio/rest/taskrouter/v1/workspace/task_channel.py +++ /dev/null @@ -1,368 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class TaskChannelList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the TaskChannelList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelList - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelList - """ - super(TaskChannelList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskChannels'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams TaskChannelInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists TaskChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TaskChannelInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return TaskChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TaskChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TaskChannelPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a TaskChannelContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - """ - return TaskChannelContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TaskChannelContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - """ - return TaskChannelContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskChannelList>' - - -class TaskChannelPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TaskChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelPage - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelPage - """ - super(TaskChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - """ - return TaskChannelInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskChannelPage>' - - -class TaskChannelContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, sid): - """ - Initialize the TaskChannelContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - """ - super(TaskChannelContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskChannels/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a TaskChannelInstance - - :returns: Fetched TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return TaskChannelInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.TaskChannelContext {}>'.format(context) - - -class TaskChannelInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the TaskChannelInstance - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - """ - super(TaskChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskChannelContext for this TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - """ - if self._context is None: - self._context = TaskChannelContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a TaskChannelInstance - - :returns: Fetched TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.TaskChannelInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py deleted file mode 100644 index df4b3aa..0000000 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py +++ /dev/null @@ -1,689 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics import TaskQueueCumulativeStatisticsList -from twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics import TaskQueueRealTimeStatisticsList -from twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics import TaskQueueStatisticsList -from twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics import TaskQueuesStatisticsList - - -class TaskQueueList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the TaskQueueList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList - """ - super(TaskQueueList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskQueues'.format(**self._solution) - - # Components - self._statistics = None - - def stream(self, friendly_name=values.unset, - evaluate_worker_attributes=values.unset, worker_sid=values.unset, - limit=None, page_size=None): - """ - Streams TaskQueueInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode friendly_name: The friendly_name - :param unicode evaluate_worker_attributes: The evaluate_worker_attributes - :param unicode worker_sid: The worker_sid - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - friendly_name=friendly_name, - evaluate_worker_attributes=evaluate_worker_attributes, - worker_sid=worker_sid, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, friendly_name=values.unset, - evaluate_worker_attributes=values.unset, worker_sid=values.unset, - limit=None, page_size=None): - """ - Lists TaskQueueInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: The friendly_name - :param unicode evaluate_worker_attributes: The evaluate_worker_attributes - :param unicode worker_sid: The worker_sid - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance] - """ - return list(self.stream( - friendly_name=friendly_name, - evaluate_worker_attributes=evaluate_worker_attributes, - worker_sid=worker_sid, - limit=limit, - page_size=page_size, - )) - - def page(self, friendly_name=values.unset, - evaluate_worker_attributes=values.unset, worker_sid=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TaskQueueInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: The friendly_name - :param unicode evaluate_worker_attributes: The evaluate_worker_attributes - :param unicode worker_sid: The worker_sid - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueuePage - """ - params = values.of({ - 'FriendlyName': friendly_name, - 'EvaluateWorkerAttributes': evaluate_worker_attributes, - 'WorkerSid': worker_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return TaskQueuePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TaskQueueInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueuePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TaskQueuePage(self._version, response, self._solution) - - def create(self, friendly_name, reservation_activity_sid, - assignment_activity_sid, target_workers=values.unset, - max_reserved_workers=values.unset, task_order=values.unset): - """ - Create a new TaskQueueInstance - - :param unicode friendly_name: The friendly_name - :param unicode reservation_activity_sid: The reservation_activity_sid - :param unicode assignment_activity_sid: The assignment_activity_sid - :param unicode target_workers: The target_workers - :param unicode max_reserved_workers: The max_reserved_workers - :param TaskQueueInstance.TaskOrder task_order: The task_order - - :returns: Newly created TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'ReservationActivitySid': reservation_activity_sid, - 'AssignmentActivitySid': assignment_activity_sid, - 'TargetWorkers': target_workers, - 'MaxReservedWorkers': max_reserved_workers, - 'TaskOrder': task_order, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsList - """ - if self._statistics is None: - self._statistics = TaskQueuesStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._statistics - - def get(self, sid): - """ - Constructs a TaskQueueContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext - """ - return TaskQueueContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TaskQueueContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext - """ - return TaskQueueContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskQueueList>' - - -class TaskQueuePage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TaskQueuePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueuePage - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueuePage - """ - super(TaskQueuePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskQueueInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - """ - return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskQueuePage>' - - -class TaskQueueContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, sid): - """ - Initialize the TaskQueueContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext - """ - super(TaskQueueContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskQueues/{sid}'.format(**self._solution) - - # Dependents - self._statistics = None - self._real_time_statistics = None - self._cumulative_statistics = None - - def fetch(self): - """ - Fetch a TaskQueueInstance - - :returns: Fetched TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return TaskQueueInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, target_workers=values.unset, - reservation_activity_sid=values.unset, - assignment_activity_sid=values.unset, - max_reserved_workers=values.unset, task_order=values.unset): - """ - Update the TaskQueueInstance - - :param unicode friendly_name: The friendly_name - :param unicode target_workers: The target_workers - :param unicode reservation_activity_sid: The reservation_activity_sid - :param unicode assignment_activity_sid: The assignment_activity_sid - :param unicode max_reserved_workers: The max_reserved_workers - :param TaskQueueInstance.TaskOrder task_order: The task_order - - :returns: Updated TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'TargetWorkers': target_workers, - 'ReservationActivitySid': reservation_activity_sid, - 'AssignmentActivitySid': assignment_activity_sid, - 'MaxReservedWorkers': max_reserved_workers, - 'TaskOrder': task_order, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return TaskQueueInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the TaskQueueInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsList - """ - if self._statistics is None: - self._statistics = TaskQueueStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['sid'], - ) - return self._statistics - - @property - def real_time_statistics(self): - """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsList - """ - if self._real_time_statistics is None: - self._real_time_statistics = TaskQueueRealTimeStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['sid'], - ) - return self._real_time_statistics - - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsList - """ - if self._cumulative_statistics is None: - self._cumulative_statistics = TaskQueueCumulativeStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['sid'], - ) - return self._cumulative_statistics - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.TaskQueueContext {}>'.format(context) - - -class TaskQueueInstance(InstanceResource): - """ """ - - class TaskOrder(object): - FIFO = "FIFO" - LIFO = "LIFO" - - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the TaskQueueInstance - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - """ - super(TaskQueueInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'assignment_activity_sid': payload['assignment_activity_sid'], - 'assignment_activity_name': payload['assignment_activity_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'max_reserved_workers': deserialize.integer(payload['max_reserved_workers']), - 'reservation_activity_sid': payload['reservation_activity_sid'], - 'reservation_activity_name': payload['reservation_activity_name'], - 'sid': payload['sid'], - 'target_workers': payload['target_workers'], - 'task_order': payload['task_order'], - 'url': payload['url'], - 'workspace_sid': payload['workspace_sid'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskQueueContext for this TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext - """ - if self._context is None: - self._context = TaskQueueContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def assignment_activity_sid(self): - """ - :returns: The assignment_activity_sid - :rtype: unicode - """ - return self._properties['assignment_activity_sid'] - - @property - def assignment_activity_name(self): - """ - :returns: The assignment_activity_name - :rtype: unicode - """ - return self._properties['assignment_activity_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def max_reserved_workers(self): - """ - :returns: The max_reserved_workers - :rtype: unicode - """ - return self._properties['max_reserved_workers'] - - @property - def reservation_activity_sid(self): - """ - :returns: The reservation_activity_sid - :rtype: unicode - """ - return self._properties['reservation_activity_sid'] - - @property - def reservation_activity_name(self): - """ - :returns: The reservation_activity_name - :rtype: unicode - """ - return self._properties['reservation_activity_name'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def target_workers(self): - """ - :returns: The target_workers - :rtype: unicode - """ - return self._properties['target_workers'] - - @property - def task_order(self): - """ - :returns: The task_order - :rtype: TaskQueueInstance.TaskOrder - """ - return self._properties['task_order'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a TaskQueueInstance - - :returns: Fetched TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, target_workers=values.unset, - reservation_activity_sid=values.unset, - assignment_activity_sid=values.unset, - max_reserved_workers=values.unset, task_order=values.unset): - """ - Update the TaskQueueInstance - - :param unicode friendly_name: The friendly_name - :param unicode target_workers: The target_workers - :param unicode reservation_activity_sid: The reservation_activity_sid - :param unicode assignment_activity_sid: The assignment_activity_sid - :param unicode max_reserved_workers: The max_reserved_workers - :param TaskQueueInstance.TaskOrder task_order: The task_order - - :returns: Updated TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - target_workers=target_workers, - reservation_activity_sid=reservation_activity_sid, - assignment_activity_sid=assignment_activity_sid, - max_reserved_workers=max_reserved_workers, - task_order=task_order, - ) - - def delete(self): - """ - Deletes the TaskQueueInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsList - """ - return self._proxy.statistics - - @property - def real_time_statistics(self): - """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsList - """ - return self._proxy.real_time_statistics - - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsList - """ - return self._proxy.cumulative_statistics - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.TaskQueueInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/__init__.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 8758f2a..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/task_queue_cumulative_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/task_queue_cumulative_statistics.cpython-36.pyc deleted file mode 100644 index f8e16ca..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/task_queue_cumulative_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/task_queue_real_time_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/task_queue_real_time_statistics.cpython-36.pyc deleted file mode 100644 index d79ed58..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/task_queue_real_time_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/task_queue_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/task_queue_statistics.cpython-36.pyc deleted file mode 100644 index c378aa7..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/task_queue_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/task_queues_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/task_queues_statistics.cpython-36.pyc deleted file mode 100644 index 043710f..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/task_queue/__pycache__/task_queues_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py deleted file mode 100644 index 6abdefe..0000000 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py +++ /dev/null @@ -1,443 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class TaskQueueCumulativeStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueCumulativeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param task_queue_sid: The task_queue_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsList - """ - super(TaskQueueCumulativeStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - - def get(self): - """ - Constructs a TaskQueueCumulativeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsContext - """ - return TaskQueueCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __call__(self): - """ - Constructs a TaskQueueCumulativeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsContext - """ - return TaskQueueCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskQueueCumulativeStatisticsList>' - - -class TaskQueueCumulativeStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TaskQueueCumulativeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - :param task_queue_sid: The task_queue_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsPage - """ - super(TaskQueueCumulativeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskQueueCumulativeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsInstance - """ - return TaskQueueCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskQueueCumulativeStatisticsPage>' - - -class TaskQueueCumulativeStatisticsContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueCumulativeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param task_queue_sid: The task_queue_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsContext - """ - super(TaskQueueCumulativeStatisticsContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskQueues/{task_queue_sid}/CumulativeStatistics'.format(**self._solution) - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch a TaskQueueCumulativeStatisticsInstance - - :param datetime end_date: The end_date - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - - :returns: Fetched TaskQueueCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsInstance - """ - params = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return TaskQueueCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.TaskQueueCumulativeStatisticsContext {}>'.format(context) - - -class TaskQueueCumulativeStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueCumulativeStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsInstance - """ - super(TaskQueueCumulativeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'avg_task_acceptance_time': deserialize.integer(payload['avg_task_acceptance_time']), - 'start_time': deserialize.iso8601_datetime(payload['start_time']), - 'end_time': deserialize.iso8601_datetime(payload['end_time']), - 'reservations_created': deserialize.integer(payload['reservations_created']), - 'reservations_accepted': deserialize.integer(payload['reservations_accepted']), - 'reservations_rejected': deserialize.integer(payload['reservations_rejected']), - 'reservations_timed_out': deserialize.integer(payload['reservations_timed_out']), - 'reservations_canceled': deserialize.integer(payload['reservations_canceled']), - 'reservations_rescinded': deserialize.integer(payload['reservations_rescinded']), - 'split_by_wait_time': payload['split_by_wait_time'], - 'task_queue_sid': payload['task_queue_sid'], - 'wait_duration_until_accepted': payload['wait_duration_until_accepted'], - 'wait_duration_until_canceled': payload['wait_duration_until_canceled'], - 'tasks_canceled': deserialize.integer(payload['tasks_canceled']), - 'tasks_completed': deserialize.integer(payload['tasks_completed']), - 'tasks_deleted': deserialize.integer(payload['tasks_deleted']), - 'tasks_entered': deserialize.integer(payload['tasks_entered']), - 'tasks_moved': deserialize.integer(payload['tasks_moved']), - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskQueueCumulativeStatisticsContext for this TaskQueueCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsContext - """ - if self._context is None: - self._context = TaskQueueCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def avg_task_acceptance_time(self): - """ - :returns: The avg_task_acceptance_time - :rtype: unicode - """ - return self._properties['avg_task_acceptance_time'] - - @property - def start_time(self): - """ - :returns: The start_time - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The end_time - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def reservations_created(self): - """ - :returns: The reservations_created - :rtype: unicode - """ - return self._properties['reservations_created'] - - @property - def reservations_accepted(self): - """ - :returns: The reservations_accepted - :rtype: unicode - """ - return self._properties['reservations_accepted'] - - @property - def reservations_rejected(self): - """ - :returns: The reservations_rejected - :rtype: unicode - """ - return self._properties['reservations_rejected'] - - @property - def reservations_timed_out(self): - """ - :returns: The reservations_timed_out - :rtype: unicode - """ - return self._properties['reservations_timed_out'] - - @property - def reservations_canceled(self): - """ - :returns: The reservations_canceled - :rtype: unicode - """ - return self._properties['reservations_canceled'] - - @property - def reservations_rescinded(self): - """ - :returns: The reservations_rescinded - :rtype: unicode - """ - return self._properties['reservations_rescinded'] - - @property - def split_by_wait_time(self): - """ - :returns: The split_by_wait_time - :rtype: dict - """ - return self._properties['split_by_wait_time'] - - @property - def task_queue_sid(self): - """ - :returns: The task_queue_sid - :rtype: unicode - """ - return self._properties['task_queue_sid'] - - @property - def wait_duration_until_accepted(self): - """ - :returns: The wait_duration_until_accepted - :rtype: dict - """ - return self._properties['wait_duration_until_accepted'] - - @property - def wait_duration_until_canceled(self): - """ - :returns: The wait_duration_until_canceled - :rtype: dict - """ - return self._properties['wait_duration_until_canceled'] - - @property - def tasks_canceled(self): - """ - :returns: The tasks_canceled - :rtype: unicode - """ - return self._properties['tasks_canceled'] - - @property - def tasks_completed(self): - """ - :returns: The tasks_completed - :rtype: unicode - """ - return self._properties['tasks_completed'] - - @property - def tasks_deleted(self): - """ - :returns: The tasks_deleted - :rtype: unicode - """ - return self._properties['tasks_deleted'] - - @property - def tasks_entered(self): - """ - :returns: The tasks_entered - :rtype: unicode - """ - return self._properties['tasks_entered'] - - @property - def tasks_moved(self): - """ - :returns: The tasks_moved - :rtype: unicode - """ - return self._properties['tasks_moved'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch a TaskQueueCumulativeStatisticsInstance - - :param datetime end_date: The end_date - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - - :returns: Fetched TaskQueueCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsInstance - """ - return self._proxy.fetch( - end_date=end_date, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.TaskQueueCumulativeStatisticsInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py deleted file mode 100644 index 7e8398c..0000000 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py +++ /dev/null @@ -1,328 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class TaskQueueRealTimeStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueRealTimeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param task_queue_sid: The task_queue_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsList - """ - super(TaskQueueRealTimeStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - - def get(self): - """ - Constructs a TaskQueueRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - """ - return TaskQueueRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __call__(self): - """ - Constructs a TaskQueueRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - """ - return TaskQueueRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsList>' - - -class TaskQueueRealTimeStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TaskQueueRealTimeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - :param task_queue_sid: The task_queue_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsPage - """ - super(TaskQueueRealTimeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskQueueRealTimeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsInstance - """ - return TaskQueueRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsPage>' - - -class TaskQueueRealTimeStatisticsContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueRealTimeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param task_queue_sid: The task_queue_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - """ - super(TaskQueueRealTimeStatisticsContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskQueues/{task_queue_sid}/RealTimeStatistics'.format(**self._solution) - - def fetch(self, task_channel=values.unset): - """ - Fetch a TaskQueueRealTimeStatisticsInstance - - :param unicode task_channel: The task_channel - - :returns: Fetched TaskQueueRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsInstance - """ - params = values.of({'TaskChannel': task_channel, }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return TaskQueueRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsContext {}>'.format(context) - - -class TaskQueueRealTimeStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueRealTimeStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsInstance - """ - super(TaskQueueRealTimeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'activity_statistics': payload['activity_statistics'], - 'longest_task_waiting_age': deserialize.integer(payload['longest_task_waiting_age']), - 'task_queue_sid': payload['task_queue_sid'], - 'tasks_by_priority': payload['tasks_by_priority'], - 'tasks_by_status': payload['tasks_by_status'], - 'total_available_workers': deserialize.integer(payload['total_available_workers']), - 'total_eligible_workers': deserialize.integer(payload['total_eligible_workers']), - 'total_tasks': deserialize.integer(payload['total_tasks']), - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskQueueRealTimeStatisticsContext for this TaskQueueRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - """ - if self._context is None: - self._context = TaskQueueRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def activity_statistics(self): - """ - :returns: The activity_statistics - :rtype: dict - """ - return self._properties['activity_statistics'] - - @property - def longest_task_waiting_age(self): - """ - :returns: The longest_task_waiting_age - :rtype: unicode - """ - return self._properties['longest_task_waiting_age'] - - @property - def task_queue_sid(self): - """ - :returns: The task_queue_sid - :rtype: unicode - """ - return self._properties['task_queue_sid'] - - @property - def tasks_by_priority(self): - """ - :returns: The tasks_by_priority - :rtype: dict - """ - return self._properties['tasks_by_priority'] - - @property - def tasks_by_status(self): - """ - :returns: The tasks_by_status - :rtype: dict - """ - return self._properties['tasks_by_status'] - - @property - def total_available_workers(self): - """ - :returns: The total_available_workers - :rtype: unicode - """ - return self._properties['total_available_workers'] - - @property - def total_eligible_workers(self): - """ - :returns: The total_eligible_workers - :rtype: unicode - """ - return self._properties['total_eligible_workers'] - - @property - def total_tasks(self): - """ - :returns: The total_tasks - :rtype: unicode - """ - return self._properties['total_tasks'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, task_channel=values.unset): - """ - Fetch a TaskQueueRealTimeStatisticsInstance - - :param unicode task_channel: The task_channel - - :returns: Fetched TaskQueueRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsInstance - """ - return self._proxy.fetch(task_channel=task_channel, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py deleted file mode 100644 index 8c7e394..0000000 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py +++ /dev/null @@ -1,307 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class TaskQueueStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param task_queue_sid: The task_queue_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsList - """ - super(TaskQueueStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - - def get(self): - """ - Constructs a TaskQueueStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - """ - return TaskQueueStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __call__(self): - """ - Constructs a TaskQueueStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - """ - return TaskQueueStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskQueueStatisticsList>' - - -class TaskQueueStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TaskQueueStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - :param task_queue_sid: The task_queue_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsPage - """ - super(TaskQueueStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskQueueStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsInstance - """ - return TaskQueueStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskQueueStatisticsPage>' - - -class TaskQueueStatisticsContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param task_queue_sid: The task_queue_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - """ - super(TaskQueueStatisticsContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskQueues/{task_queue_sid}/Statistics'.format(**self._solution) - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch a TaskQueueStatisticsInstance - - :param datetime end_date: The end_date - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - - :returns: Fetched TaskQueueStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsInstance - """ - params = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return TaskQueueStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.TaskQueueStatisticsContext {}>'.format(context) - - -class TaskQueueStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsInstance - """ - super(TaskQueueStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'cumulative': payload['cumulative'], - 'realtime': payload['realtime'], - 'task_queue_sid': payload['task_queue_sid'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskQueueStatisticsContext for this TaskQueueStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - """ - if self._context is None: - self._context = TaskQueueStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def cumulative(self): - """ - :returns: The cumulative - :rtype: dict - """ - return self._properties['cumulative'] - - @property - def realtime(self): - """ - :returns: The realtime - :rtype: dict - """ - return self._properties['realtime'] - - @property - def task_queue_sid(self): - """ - :returns: The task_queue_sid - :rtype: unicode - """ - return self._properties['task_queue_sid'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch a TaskQueueStatisticsInstance - - :param datetime end_date: The end_date - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - - :returns: Fetched TaskQueueStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsInstance - """ - return self._proxy.fetch( - end_date=end_date, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.TaskQueueStatisticsInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py deleted file mode 100644 index c01b50e..0000000 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py +++ /dev/null @@ -1,296 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TaskQueuesStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the TaskQueuesStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsList - """ - super(TaskQueuesStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskQueues/Statistics'.format(**self._solution) - - def stream(self, end_date=values.unset, friendly_name=values.unset, - minutes=values.unset, start_date=values.unset, - task_channel=values.unset, split_by_wait_time=values.unset, - limit=None, page_size=None): - """ - Streams TaskQueuesStatisticsInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param datetime end_date: The end_date - :param unicode friendly_name: The friendly_name - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - end_date=end_date, - friendly_name=friendly_name, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, end_date=values.unset, friendly_name=values.unset, - minutes=values.unset, start_date=values.unset, - task_channel=values.unset, split_by_wait_time=values.unset, limit=None, - page_size=None): - """ - Lists TaskQueuesStatisticsInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime end_date: The end_date - :param unicode friendly_name: The friendly_name - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsInstance] - """ - return list(self.stream( - end_date=end_date, - friendly_name=friendly_name, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - limit=limit, - page_size=page_size, - )) - - def page(self, end_date=values.unset, friendly_name=values.unset, - minutes=values.unset, start_date=values.unset, - task_channel=values.unset, split_by_wait_time=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TaskQueuesStatisticsInstance records from the API. - Request is executed immediately - - :param datetime end_date: The end_date - :param unicode friendly_name: The friendly_name - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TaskQueuesStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsPage - """ - params = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'FriendlyName': friendly_name, - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return TaskQueuesStatisticsPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TaskQueuesStatisticsInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TaskQueuesStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TaskQueuesStatisticsPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskQueuesStatisticsList>' - - -class TaskQueuesStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TaskQueuesStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsPage - """ - super(TaskQueuesStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskQueuesStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsInstance - """ - return TaskQueuesStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskQueuesStatisticsPage>' - - -class TaskQueuesStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid): - """ - Initialize the TaskQueuesStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsInstance - """ - super(TaskQueuesStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'cumulative': payload['cumulative'], - 'realtime': payload['realtime'], - 'task_queue_sid': payload['task_queue_sid'], - 'workspace_sid': payload['workspace_sid'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, } - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def cumulative(self): - """ - :returns: The cumulative - :rtype: dict - """ - return self._properties['cumulative'] - - @property - def realtime(self): - """ - :returns: The realtime - :rtype: dict - """ - return self._properties['realtime'] - - @property - def task_queue_sid(self): - """ - :returns: The task_queue_sid - :rtype: unicode - """ - return self._properties['task_queue_sid'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.TaskQueuesStatisticsInstance>' diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py deleted file mode 100644 index a41c1af..0000000 --- a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py +++ /dev/null @@ -1,725 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.taskrouter.v1.workspace.worker.reservation import ReservationList -from twilio.rest.taskrouter.v1.workspace.worker.worker_channel import WorkerChannelList -from twilio.rest.taskrouter.v1.workspace.worker.worker_statistics import WorkerStatisticsList -from twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics import WorkersCumulativeStatisticsList -from twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics import WorkersRealTimeStatisticsList -from twilio.rest.taskrouter.v1.workspace.worker.workers_statistics import WorkersStatisticsList - - -class WorkerList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkerList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerList - """ - super(WorkerList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers'.format(**self._solution) - - # Components - self._statistics = None - - def stream(self, activity_name=values.unset, activity_sid=values.unset, - available=values.unset, friendly_name=values.unset, - target_workers_expression=values.unset, task_queue_name=values.unset, - task_queue_sid=values.unset, limit=None, page_size=None): - """ - Streams WorkerInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode activity_name: The activity_name - :param unicode activity_sid: The activity_sid - :param unicode available: The available - :param unicode friendly_name: The friendly_name - :param unicode target_workers_expression: The target_workers_expression - :param unicode task_queue_name: The task_queue_name - :param unicode task_queue_sid: The task_queue_sid - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - activity_name=activity_name, - activity_sid=activity_sid, - available=available, - friendly_name=friendly_name, - target_workers_expression=target_workers_expression, - task_queue_name=task_queue_name, - task_queue_sid=task_queue_sid, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, activity_name=values.unset, activity_sid=values.unset, - available=values.unset, friendly_name=values.unset, - target_workers_expression=values.unset, task_queue_name=values.unset, - task_queue_sid=values.unset, limit=None, page_size=None): - """ - Lists WorkerInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode activity_name: The activity_name - :param unicode activity_sid: The activity_sid - :param unicode available: The available - :param unicode friendly_name: The friendly_name - :param unicode target_workers_expression: The target_workers_expression - :param unicode task_queue_name: The task_queue_name - :param unicode task_queue_sid: The task_queue_sid - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance] - """ - return list(self.stream( - activity_name=activity_name, - activity_sid=activity_sid, - available=available, - friendly_name=friendly_name, - target_workers_expression=target_workers_expression, - task_queue_name=task_queue_name, - task_queue_sid=task_queue_sid, - limit=limit, - page_size=page_size, - )) - - def page(self, activity_name=values.unset, activity_sid=values.unset, - available=values.unset, friendly_name=values.unset, - target_workers_expression=values.unset, task_queue_name=values.unset, - task_queue_sid=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of WorkerInstance records from the API. - Request is executed immediately - - :param unicode activity_name: The activity_name - :param unicode activity_sid: The activity_sid - :param unicode available: The available - :param unicode friendly_name: The friendly_name - :param unicode target_workers_expression: The target_workers_expression - :param unicode task_queue_name: The task_queue_name - :param unicode task_queue_sid: The task_queue_sid - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerPage - """ - params = values.of({ - 'ActivityName': activity_name, - 'ActivitySid': activity_sid, - 'Available': available, - 'FriendlyName': friendly_name, - 'TargetWorkersExpression': target_workers_expression, - 'TaskQueueName': task_queue_name, - 'TaskQueueSid': task_queue_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return WorkerPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of WorkerInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return WorkerPage(self._version, response, self._solution) - - def create(self, friendly_name, activity_sid=values.unset, - attributes=values.unset): - """ - Create a new WorkerInstance - - :param unicode friendly_name: The friendly_name - :param unicode activity_sid: The activity_sid - :param unicode attributes: The attributes - - :returns: Newly created WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'ActivitySid': activity_sid, - 'Attributes': attributes, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return WorkerInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsList - """ - if self._statistics is None: - self._statistics = WorkersStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._statistics - - def get(self, sid): - """ - Constructs a WorkerContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext - """ - return WorkerContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a WorkerContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext - """ - return WorkerContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkerList>' - - -class WorkerPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkerPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerPage - """ - super(WorkerPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkerInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - """ - return WorkerInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkerPage>' - - -class WorkerContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, sid): - """ - Initialize the WorkerContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext - """ - super(WorkerContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/{sid}'.format(**self._solution) - - # Dependents - self._real_time_statistics = None - self._cumulative_statistics = None - self._statistics = None - self._reservations = None - self._worker_channels = None - - def fetch(self): - """ - Fetch a WorkerInstance - - :returns: Fetched WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkerInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def update(self, activity_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Update the WorkerInstance - - :param unicode activity_sid: The activity_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Updated WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - """ - data = values.of({ - 'ActivitySid': activity_sid, - 'Attributes': attributes, - 'FriendlyName': friendly_name, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return WorkerInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the WorkerInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def real_time_statistics(self): - """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsList - """ - if self._real_time_statistics is None: - self._real_time_statistics = WorkersRealTimeStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._real_time_statistics - - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsList - """ - if self._cumulative_statistics is None: - self._cumulative_statistics = WorkersCumulativeStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._cumulative_statistics - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsList - """ - if self._statistics is None: - self._statistics = WorkerStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['sid'], - ) - return self._statistics - - @property - def reservations(self): - """ - Access the reservations - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationList - """ - if self._reservations is None: - self._reservations = ReservationList( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['sid'], - ) - return self._reservations - - @property - def worker_channels(self): - """ - Access the worker_channels - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelList - """ - if self._worker_channels is None: - self._worker_channels = WorkerChannelList( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['sid'], - ) - return self._worker_channels - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkerContext {}>'.format(context) - - -class WorkerInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the WorkerInstance - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - """ - super(WorkerInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'activity_name': payload['activity_name'], - 'activity_sid': payload['activity_sid'], - 'attributes': payload['attributes'], - 'available': payload['available'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_status_changed': deserialize.iso8601_datetime(payload['date_status_changed']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'sid': payload['sid'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkerContext for this WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext - """ - if self._context is None: - self._context = WorkerContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def activity_name(self): - """ - :returns: The activity_name - :rtype: unicode - """ - return self._properties['activity_name'] - - @property - def activity_sid(self): - """ - :returns: The activity_sid - :rtype: unicode - """ - return self._properties['activity_sid'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def available(self): - """ - :returns: The available - :rtype: bool - """ - return self._properties['available'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_status_changed(self): - """ - :returns: The date_status_changed - :rtype: datetime - """ - return self._properties['date_status_changed'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a WorkerInstance - - :returns: Fetched WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - """ - return self._proxy.fetch() - - def update(self, activity_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Update the WorkerInstance - - :param unicode activity_sid: The activity_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: Updated WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - """ - return self._proxy.update( - activity_sid=activity_sid, - attributes=attributes, - friendly_name=friendly_name, - ) - - def delete(self): - """ - Deletes the WorkerInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def real_time_statistics(self): - """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsList - """ - return self._proxy.real_time_statistics - - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsList - """ - return self._proxy.cumulative_statistics - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsList - """ - return self._proxy.statistics - - @property - def reservations(self): - """ - Access the reservations - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationList - """ - return self._proxy.reservations - - @property - def worker_channels(self): - """ - Access the worker_channels - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelList - """ - return self._proxy.worker_channels - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkerInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/__init__.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index c4815f9..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/reservation.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/reservation.cpython-36.pyc deleted file mode 100644 index e80d794..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/reservation.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/worker_channel.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/worker_channel.cpython-36.pyc deleted file mode 100644 index 53e7bcb..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/worker_channel.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/worker_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/worker_statistics.cpython-36.pyc deleted file mode 100644 index 8f908ae..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/worker_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/workers_cumulative_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/workers_cumulative_statistics.cpython-36.pyc deleted file mode 100644 index da644eb..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/workers_cumulative_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/workers_real_time_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/workers_real_time_statistics.cpython-36.pyc deleted file mode 100644 index 6501e6b..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/workers_real_time_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/workers_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/workers_statistics.cpython-36.pyc deleted file mode 100644 index 135fa1e..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/worker/__pycache__/workers_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py deleted file mode 100644 index d8c06ae..0000000 --- a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py +++ /dev/null @@ -1,743 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class ReservationList(ListResource): - """ """ - - def __init__(self, version, workspace_sid, worker_sid): - """ - Initialize the ReservationList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param worker_sid: The worker_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationList - """ - super(ReservationList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/{worker_sid}/Reservations'.format(**self._solution) - - def stream(self, reservation_status=values.unset, limit=None, page_size=None): - """ - Streams ReservationInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param ReservationInstance.Status reservation_status: The reservation_status - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(reservation_status=reservation_status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, reservation_status=values.unset, limit=None, page_size=None): - """ - Lists ReservationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param ReservationInstance.Status reservation_status: The reservation_status - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance] - """ - return list(self.stream(reservation_status=reservation_status, limit=limit, page_size=page_size, )) - - def page(self, reservation_status=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ReservationInstance records from the API. - Request is executed immediately - - :param ReservationInstance.Status reservation_status: The reservation_status - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationPage - """ - params = values.of({ - 'ReservationStatus': reservation_status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ReservationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ReservationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ReservationPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ReservationContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - """ - return ReservationContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a ReservationContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - """ - return ReservationContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.ReservationList>' - - -class ReservationPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ReservationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - :param worker_sid: The worker_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationPage - """ - super(ReservationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ReservationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - """ - return ReservationInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.ReservationPage>' - - -class ReservationContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, worker_sid, sid): - """ - Initialize the ReservationContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param worker_sid: The worker_sid - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - """ - super(ReservationContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/{worker_sid}/Reservations/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a ReservationInstance - - :returns: Fetched ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ReservationInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=self._solution['sid'], - ) - - def update(self, reservation_status=values.unset, - worker_activity_sid=values.unset, instruction=values.unset, - dequeue_post_work_activity_sid=values.unset, - dequeue_from=values.unset, dequeue_record=values.unset, - dequeue_timeout=values.unset, dequeue_to=values.unset, - dequeue_status_callback_url=values.unset, call_from=values.unset, - call_record=values.unset, call_timeout=values.unset, - call_to=values.unset, call_url=values.unset, - call_status_callback_url=values.unset, call_accept=values.unset, - redirect_call_sid=values.unset, redirect_accept=values.unset, - redirect_url=values.unset, to=values.unset, from_=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - status_callback_event=values.unset, timeout=values.unset, - record=values.unset, muted=values.unset, beep=values.unset, - start_conference_on_enter=values.unset, - end_conference_on_exit=values.unset, wait_url=values.unset, - wait_method=values.unset, early_media=values.unset, - max_participants=values.unset, - conference_status_callback=values.unset, - conference_status_callback_method=values.unset, - conference_status_callback_event=values.unset, - conference_record=values.unset, conference_trim=values.unset, - recording_channels=values.unset, - recording_status_callback=values.unset, - recording_status_callback_method=values.unset, - conference_recording_status_callback=values.unset, - conference_recording_status_callback_method=values.unset, - region=values.unset, sip_auth_username=values.unset, - sip_auth_password=values.unset, - dequeue_status_callback_event=values.unset, - post_work_activity_sid=values.unset): - """ - Update the ReservationInstance - - :param ReservationInstance.Status reservation_status: The reservation_status - :param unicode worker_activity_sid: The worker_activity_sid - :param unicode instruction: The instruction - :param unicode dequeue_post_work_activity_sid: The dequeue_post_work_activity_sid - :param unicode dequeue_from: The dequeue_from - :param unicode dequeue_record: The dequeue_record - :param unicode dequeue_timeout: The dequeue_timeout - :param unicode dequeue_to: The dequeue_to - :param unicode dequeue_status_callback_url: The dequeue_status_callback_url - :param unicode call_from: The call_from - :param unicode call_record: The call_record - :param unicode call_timeout: The call_timeout - :param unicode call_to: The call_to - :param unicode call_url: The call_url - :param unicode call_status_callback_url: The call_status_callback_url - :param bool call_accept: The call_accept - :param unicode redirect_call_sid: The redirect_call_sid - :param bool redirect_accept: The redirect_accept - :param unicode redirect_url: The redirect_url - :param unicode to: The to - :param unicode from_: The from - :param unicode status_callback: The status_callback - :param unicode status_callback_method: The status_callback_method - :param ReservationInstance.CallStatus status_callback_event: The status_callback_event - :param unicode timeout: The timeout - :param bool record: The record - :param bool muted: The muted - :param unicode beep: The beep - :param bool start_conference_on_enter: The start_conference_on_enter - :param bool end_conference_on_exit: The end_conference_on_exit - :param unicode wait_url: The wait_url - :param unicode wait_method: The wait_method - :param bool early_media: The early_media - :param unicode max_participants: The max_participants - :param unicode conference_status_callback: The conference_status_callback - :param unicode conference_status_callback_method: The conference_status_callback_method - :param ReservationInstance.ConferenceEvent conference_status_callback_event: The conference_status_callback_event - :param unicode conference_record: The conference_record - :param unicode conference_trim: The conference_trim - :param unicode recording_channels: The recording_channels - :param unicode recording_status_callback: The recording_status_callback - :param unicode recording_status_callback_method: The recording_status_callback_method - :param unicode conference_recording_status_callback: The conference_recording_status_callback - :param unicode conference_recording_status_callback_method: The conference_recording_status_callback_method - :param unicode region: The region - :param unicode sip_auth_username: The sip_auth_username - :param unicode sip_auth_password: The sip_auth_password - :param unicode dequeue_status_callback_event: The dequeue_status_callback_event - :param unicode post_work_activity_sid: The post_work_activity_sid - - :returns: Updated ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - """ - data = values.of({ - 'ReservationStatus': reservation_status, - 'WorkerActivitySid': worker_activity_sid, - 'Instruction': instruction, - 'DequeuePostWorkActivitySid': dequeue_post_work_activity_sid, - 'DequeueFrom': dequeue_from, - 'DequeueRecord': dequeue_record, - 'DequeueTimeout': dequeue_timeout, - 'DequeueTo': dequeue_to, - 'DequeueStatusCallbackUrl': dequeue_status_callback_url, - 'CallFrom': call_from, - 'CallRecord': call_record, - 'CallTimeout': call_timeout, - 'CallTo': call_to, - 'CallUrl': call_url, - 'CallStatusCallbackUrl': call_status_callback_url, - 'CallAccept': call_accept, - 'RedirectCallSid': redirect_call_sid, - 'RedirectAccept': redirect_accept, - 'RedirectUrl': redirect_url, - 'To': to, - 'From': from_, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'StatusCallbackEvent': serialize.map(status_callback_event, lambda e: e), - 'Timeout': timeout, - 'Record': record, - 'Muted': muted, - 'Beep': beep, - 'StartConferenceOnEnter': start_conference_on_enter, - 'EndConferenceOnExit': end_conference_on_exit, - 'WaitUrl': wait_url, - 'WaitMethod': wait_method, - 'EarlyMedia': early_media, - 'MaxParticipants': max_participants, - 'ConferenceStatusCallback': conference_status_callback, - 'ConferenceStatusCallbackMethod': conference_status_callback_method, - 'ConferenceStatusCallbackEvent': serialize.map(conference_status_callback_event, lambda e: e), - 'ConferenceRecord': conference_record, - 'ConferenceTrim': conference_trim, - 'RecordingChannels': recording_channels, - 'RecordingStatusCallback': recording_status_callback, - 'RecordingStatusCallbackMethod': recording_status_callback_method, - 'ConferenceRecordingStatusCallback': conference_recording_status_callback, - 'ConferenceRecordingStatusCallbackMethod': conference_recording_status_callback_method, - 'Region': region, - 'SipAuthUsername': sip_auth_username, - 'SipAuthPassword': sip_auth_password, - 'DequeueStatusCallbackEvent': serialize.map(dequeue_status_callback_event, lambda e: e), - 'PostWorkActivitySid': post_work_activity_sid, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ReservationInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.ReservationContext {}>'.format(context) - - -class ReservationInstance(InstanceResource): - """ """ - - class Status(object): - PENDING = "pending" - ACCEPTED = "accepted" - REJECTED = "rejected" - TIMEOUT = "timeout" - CANCELED = "canceled" - RESCINDED = "rescinded" - - class CallStatus(object): - INITIATED = "initiated" - RINGING = "ringing" - ANSWERED = "answered" - COMPLETED = "completed" - - class ConferenceEvent(object): - START = "start" - END = "end" - JOIN = "join" - LEAVE = "leave" - MUTE = "mute" - HOLD = "hold" - SPEAKER = "speaker" - - def __init__(self, version, payload, workspace_sid, worker_sid, sid=None): - """ - Initialize the ReservationInstance - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - """ - super(ReservationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'reservation_status': payload['reservation_status'], - 'sid': payload['sid'], - 'task_sid': payload['task_sid'], - 'worker_name': payload['worker_name'], - 'worker_sid': payload['worker_sid'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = { - 'workspace_sid': workspace_sid, - 'worker_sid': worker_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ReservationContext for this ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - """ - if self._context is None: - self._context = ReservationContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def reservation_status(self): - """ - :returns: The reservation_status - :rtype: ReservationInstance.Status - """ - return self._properties['reservation_status'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def task_sid(self): - """ - :returns: The task_sid - :rtype: unicode - """ - return self._properties['task_sid'] - - @property - def worker_name(self): - """ - :returns: The worker_name - :rtype: unicode - """ - return self._properties['worker_name'] - - @property - def worker_sid(self): - """ - :returns: The worker_sid - :rtype: unicode - """ - return self._properties['worker_sid'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ReservationInstance - - :returns: Fetched ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - """ - return self._proxy.fetch() - - def update(self, reservation_status=values.unset, - worker_activity_sid=values.unset, instruction=values.unset, - dequeue_post_work_activity_sid=values.unset, - dequeue_from=values.unset, dequeue_record=values.unset, - dequeue_timeout=values.unset, dequeue_to=values.unset, - dequeue_status_callback_url=values.unset, call_from=values.unset, - call_record=values.unset, call_timeout=values.unset, - call_to=values.unset, call_url=values.unset, - call_status_callback_url=values.unset, call_accept=values.unset, - redirect_call_sid=values.unset, redirect_accept=values.unset, - redirect_url=values.unset, to=values.unset, from_=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - status_callback_event=values.unset, timeout=values.unset, - record=values.unset, muted=values.unset, beep=values.unset, - start_conference_on_enter=values.unset, - end_conference_on_exit=values.unset, wait_url=values.unset, - wait_method=values.unset, early_media=values.unset, - max_participants=values.unset, - conference_status_callback=values.unset, - conference_status_callback_method=values.unset, - conference_status_callback_event=values.unset, - conference_record=values.unset, conference_trim=values.unset, - recording_channels=values.unset, - recording_status_callback=values.unset, - recording_status_callback_method=values.unset, - conference_recording_status_callback=values.unset, - conference_recording_status_callback_method=values.unset, - region=values.unset, sip_auth_username=values.unset, - sip_auth_password=values.unset, - dequeue_status_callback_event=values.unset, - post_work_activity_sid=values.unset): - """ - Update the ReservationInstance - - :param ReservationInstance.Status reservation_status: The reservation_status - :param unicode worker_activity_sid: The worker_activity_sid - :param unicode instruction: The instruction - :param unicode dequeue_post_work_activity_sid: The dequeue_post_work_activity_sid - :param unicode dequeue_from: The dequeue_from - :param unicode dequeue_record: The dequeue_record - :param unicode dequeue_timeout: The dequeue_timeout - :param unicode dequeue_to: The dequeue_to - :param unicode dequeue_status_callback_url: The dequeue_status_callback_url - :param unicode call_from: The call_from - :param unicode call_record: The call_record - :param unicode call_timeout: The call_timeout - :param unicode call_to: The call_to - :param unicode call_url: The call_url - :param unicode call_status_callback_url: The call_status_callback_url - :param bool call_accept: The call_accept - :param unicode redirect_call_sid: The redirect_call_sid - :param bool redirect_accept: The redirect_accept - :param unicode redirect_url: The redirect_url - :param unicode to: The to - :param unicode from_: The from - :param unicode status_callback: The status_callback - :param unicode status_callback_method: The status_callback_method - :param ReservationInstance.CallStatus status_callback_event: The status_callback_event - :param unicode timeout: The timeout - :param bool record: The record - :param bool muted: The muted - :param unicode beep: The beep - :param bool start_conference_on_enter: The start_conference_on_enter - :param bool end_conference_on_exit: The end_conference_on_exit - :param unicode wait_url: The wait_url - :param unicode wait_method: The wait_method - :param bool early_media: The early_media - :param unicode max_participants: The max_participants - :param unicode conference_status_callback: The conference_status_callback - :param unicode conference_status_callback_method: The conference_status_callback_method - :param ReservationInstance.ConferenceEvent conference_status_callback_event: The conference_status_callback_event - :param unicode conference_record: The conference_record - :param unicode conference_trim: The conference_trim - :param unicode recording_channels: The recording_channels - :param unicode recording_status_callback: The recording_status_callback - :param unicode recording_status_callback_method: The recording_status_callback_method - :param unicode conference_recording_status_callback: The conference_recording_status_callback - :param unicode conference_recording_status_callback_method: The conference_recording_status_callback_method - :param unicode region: The region - :param unicode sip_auth_username: The sip_auth_username - :param unicode sip_auth_password: The sip_auth_password - :param unicode dequeue_status_callback_event: The dequeue_status_callback_event - :param unicode post_work_activity_sid: The post_work_activity_sid - - :returns: Updated ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - """ - return self._proxy.update( - reservation_status=reservation_status, - worker_activity_sid=worker_activity_sid, - instruction=instruction, - dequeue_post_work_activity_sid=dequeue_post_work_activity_sid, - dequeue_from=dequeue_from, - dequeue_record=dequeue_record, - dequeue_timeout=dequeue_timeout, - dequeue_to=dequeue_to, - dequeue_status_callback_url=dequeue_status_callback_url, - call_from=call_from, - call_record=call_record, - call_timeout=call_timeout, - call_to=call_to, - call_url=call_url, - call_status_callback_url=call_status_callback_url, - call_accept=call_accept, - redirect_call_sid=redirect_call_sid, - redirect_accept=redirect_accept, - redirect_url=redirect_url, - to=to, - from_=from_, - status_callback=status_callback, - status_callback_method=status_callback_method, - status_callback_event=status_callback_event, - timeout=timeout, - record=record, - muted=muted, - beep=beep, - start_conference_on_enter=start_conference_on_enter, - end_conference_on_exit=end_conference_on_exit, - wait_url=wait_url, - wait_method=wait_method, - early_media=early_media, - max_participants=max_participants, - conference_status_callback=conference_status_callback, - conference_status_callback_method=conference_status_callback_method, - conference_status_callback_event=conference_status_callback_event, - conference_record=conference_record, - conference_trim=conference_trim, - recording_channels=recording_channels, - recording_status_callback=recording_status_callback, - recording_status_callback_method=recording_status_callback_method, - conference_recording_status_callback=conference_recording_status_callback, - conference_recording_status_callback_method=conference_recording_status_callback_method, - region=region, - sip_auth_username=sip_auth_username, - sip_auth_password=sip_auth_password, - dequeue_status_callback_event=dequeue_status_callback_event, - post_work_activity_sid=post_work_activity_sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.ReservationInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py deleted file mode 100644 index d8d3fdd..0000000 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py +++ /dev/null @@ -1,475 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class WorkerChannelList(ListResource): - """ """ - - def __init__(self, version, workspace_sid, worker_sid): - """ - Initialize the WorkerChannelList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param worker_sid: The worker_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelList - """ - super(WorkerChannelList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/{worker_sid}/Channels'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams WorkerChannelInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists WorkerChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of WorkerChannelInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return WorkerChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of WorkerChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return WorkerChannelPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a WorkerChannelContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - """ - return WorkerChannelContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a WorkerChannelContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - """ - return WorkerChannelContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkerChannelList>' - - -class WorkerChannelPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkerChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - :param worker_sid: The worker_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelPage - """ - super(WorkerChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkerChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - """ - return WorkerChannelInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkerChannelPage>' - - -class WorkerChannelContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, worker_sid, sid): - """ - Initialize the WorkerChannelContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param worker_sid: The worker_sid - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - """ - super(WorkerChannelContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/{worker_sid}/Channels/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a WorkerChannelInstance - - :returns: Fetched WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkerChannelInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=self._solution['sid'], - ) - - def update(self, capacity=values.unset, available=values.unset): - """ - Update the WorkerChannelInstance - - :param unicode capacity: The capacity - :param bool available: The available - - :returns: Updated WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - """ - data = values.of({'Capacity': capacity, 'Available': available, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return WorkerChannelInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkerChannelContext {}>'.format(context) - - -class WorkerChannelInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid, worker_sid, sid=None): - """ - Initialize the WorkerChannelInstance - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - """ - super(WorkerChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'assigned_tasks': deserialize.integer(payload['assigned_tasks']), - 'available': payload['available'], - 'available_capacity_percentage': deserialize.integer(payload['available_capacity_percentage']), - 'configured_capacity': deserialize.integer(payload['configured_capacity']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'sid': payload['sid'], - 'task_channel_sid': payload['task_channel_sid'], - 'task_channel_unique_name': payload['task_channel_unique_name'], - 'worker_sid': payload['worker_sid'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'workspace_sid': workspace_sid, - 'worker_sid': worker_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkerChannelContext for this WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - """ - if self._context is None: - self._context = WorkerChannelContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def assigned_tasks(self): - """ - :returns: The assigned_tasks - :rtype: unicode - """ - return self._properties['assigned_tasks'] - - @property - def available(self): - """ - :returns: The available - :rtype: bool - """ - return self._properties['available'] - - @property - def available_capacity_percentage(self): - """ - :returns: The available_capacity_percentage - :rtype: unicode - """ - return self._properties['available_capacity_percentage'] - - @property - def configured_capacity(self): - """ - :returns: The configured_capacity - :rtype: unicode - """ - return self._properties['configured_capacity'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def task_channel_sid(self): - """ - :returns: The task_channel_sid - :rtype: unicode - """ - return self._properties['task_channel_sid'] - - @property - def task_channel_unique_name(self): - """ - :returns: The task_channel_unique_name - :rtype: unicode - """ - return self._properties['task_channel_unique_name'] - - @property - def worker_sid(self): - """ - :returns: The worker_sid - :rtype: unicode - """ - return self._properties['worker_sid'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a WorkerChannelInstance - - :returns: Fetched WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - """ - return self._proxy.fetch() - - def update(self, capacity=values.unset, available=values.unset): - """ - Update the WorkerChannelInstance - - :param unicode capacity: The capacity - :param bool available: The available - - :returns: Updated WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - """ - return self._proxy.update(capacity=capacity, available=available, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkerChannelInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py deleted file mode 100644 index 65f3265..0000000 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py +++ /dev/null @@ -1,292 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class WorkerStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid, worker_sid): - """ - Initialize the WorkerStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param worker_sid: The worker_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsList - """ - super(WorkerStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, } - - def get(self): - """ - Constructs a WorkerStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsContext - """ - return WorkerStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - ) - - def __call__(self): - """ - Constructs a WorkerStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsContext - """ - return WorkerStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkerStatisticsList>' - - -class WorkerStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkerStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - :param worker_sid: The worker_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsPage - """ - super(WorkerStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkerStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsInstance - """ - return WorkerStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkerStatisticsPage>' - - -class WorkerStatisticsContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, worker_sid): - """ - Initialize the WorkerStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param worker_sid: The worker_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsContext - """ - super(WorkerStatisticsContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/{worker_sid}/Statistics'.format(**self._solution) - - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_channel=values.unset): - """ - Fetch a WorkerStatisticsInstance - - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param datetime end_date: The end_date - :param unicode task_channel: The task_channel - - :returns: Fetched WorkerStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsInstance - """ - params = values.of({ - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'EndDate': serialize.iso8601_datetime(end_date), - 'TaskChannel': task_channel, - }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkerStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkerStatisticsContext {}>'.format(context) - - -class WorkerStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid, worker_sid): - """ - Initialize the WorkerStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsInstance - """ - super(WorkerStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'cumulative': payload['cumulative'], - 'worker_sid': payload['worker_sid'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkerStatisticsContext for this WorkerStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsContext - """ - if self._context is None: - self._context = WorkerStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def cumulative(self): - """ - :returns: The cumulative - :rtype: dict - """ - return self._properties['cumulative'] - - @property - def worker_sid(self): - """ - :returns: The worker_sid - :rtype: unicode - """ - return self._properties['worker_sid'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_channel=values.unset): - """ - Fetch a WorkerStatisticsInstance - - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param datetime end_date: The end_date - :param unicode task_channel: The task_channel - - :returns: Fetched WorkerStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsInstance - """ - return self._proxy.fetch( - minutes=minutes, - start_date=start_date, - end_date=end_date, - task_channel=task_channel, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkerStatisticsInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py deleted file mode 100644 index f391cf7..0000000 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py +++ /dev/null @@ -1,348 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class WorkersCumulativeStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkersCumulativeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsList - """ - super(WorkersCumulativeStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - - def get(self): - """ - Constructs a WorkersCumulativeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - """ - return WorkersCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - - def __call__(self): - """ - Constructs a WorkersCumulativeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - """ - return WorkersCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkersCumulativeStatisticsList>' - - -class WorkersCumulativeStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkersCumulativeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsPage - """ - super(WorkersCumulativeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkersCumulativeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsInstance - """ - return WorkersCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkersCumulativeStatisticsPage>' - - -class WorkersCumulativeStatisticsContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkersCumulativeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - """ - super(WorkersCumulativeStatisticsContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/CumulativeStatistics'.format(**self._solution) - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset): - """ - Fetch a WorkersCumulativeStatisticsInstance - - :param datetime end_date: The end_date - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param unicode task_channel: The task_channel - - :returns: Fetched WorkersCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsInstance - """ - params = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskChannel': task_channel, - }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkersCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkersCumulativeStatisticsContext {}>'.format(context) - - -class WorkersCumulativeStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid): - """ - Initialize the WorkersCumulativeStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsInstance - """ - super(WorkersCumulativeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'start_time': deserialize.iso8601_datetime(payload['start_time']), - 'end_time': deserialize.iso8601_datetime(payload['end_time']), - 'activity_durations': payload['activity_durations'], - 'reservations_created': deserialize.integer(payload['reservations_created']), - 'reservations_accepted': deserialize.integer(payload['reservations_accepted']), - 'reservations_rejected': deserialize.integer(payload['reservations_rejected']), - 'reservations_timed_out': deserialize.integer(payload['reservations_timed_out']), - 'reservations_canceled': deserialize.integer(payload['reservations_canceled']), - 'reservations_rescinded': deserialize.integer(payload['reservations_rescinded']), - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkersCumulativeStatisticsContext for this WorkersCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - """ - if self._context is None: - self._context = WorkersCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def start_time(self): - """ - :returns: The start_time - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The end_time - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def activity_durations(self): - """ - :returns: The activity_durations - :rtype: dict - """ - return self._properties['activity_durations'] - - @property - def reservations_created(self): - """ - :returns: The reservations_created - :rtype: unicode - """ - return self._properties['reservations_created'] - - @property - def reservations_accepted(self): - """ - :returns: The reservations_accepted - :rtype: unicode - """ - return self._properties['reservations_accepted'] - - @property - def reservations_rejected(self): - """ - :returns: The reservations_rejected - :rtype: unicode - """ - return self._properties['reservations_rejected'] - - @property - def reservations_timed_out(self): - """ - :returns: The reservations_timed_out - :rtype: unicode - """ - return self._properties['reservations_timed_out'] - - @property - def reservations_canceled(self): - """ - :returns: The reservations_canceled - :rtype: unicode - """ - return self._properties['reservations_canceled'] - - @property - def reservations_rescinded(self): - """ - :returns: The reservations_rescinded - :rtype: unicode - """ - return self._properties['reservations_rescinded'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset): - """ - Fetch a WorkersCumulativeStatisticsInstance - - :param datetime end_date: The end_date - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param unicode task_channel: The task_channel - - :returns: Fetched WorkersCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsInstance - """ - return self._proxy.fetch( - end_date=end_date, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkersCumulativeStatisticsInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py deleted file mode 100644 index 9d6f36a..0000000 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py +++ /dev/null @@ -1,266 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class WorkersRealTimeStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkersRealTimeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsList - """ - super(WorkersRealTimeStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - - def get(self): - """ - Constructs a WorkersRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - """ - return WorkersRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - - def __call__(self): - """ - Constructs a WorkersRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - """ - return WorkersRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkersRealTimeStatisticsList>' - - -class WorkersRealTimeStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkersRealTimeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsPage - """ - super(WorkersRealTimeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkersRealTimeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance - """ - return WorkersRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkersRealTimeStatisticsPage>' - - -class WorkersRealTimeStatisticsContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkersRealTimeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - """ - super(WorkersRealTimeStatisticsContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/RealTimeStatistics'.format(**self._solution) - - def fetch(self, task_channel=values.unset): - """ - Fetch a WorkersRealTimeStatisticsInstance - - :param unicode task_channel: The task_channel - - :returns: Fetched WorkersRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance - """ - params = values.of({'TaskChannel': task_channel, }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkersRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkersRealTimeStatisticsContext {}>'.format(context) - - -class WorkersRealTimeStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid): - """ - Initialize the WorkersRealTimeStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance - """ - super(WorkersRealTimeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'activity_statistics': payload['activity_statistics'], - 'total_workers': deserialize.integer(payload['total_workers']), - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkersRealTimeStatisticsContext for this WorkersRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - """ - if self._context is None: - self._context = WorkersRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def activity_statistics(self): - """ - :returns: The activity_statistics - :rtype: dict - """ - return self._properties['activity_statistics'] - - @property - def total_workers(self): - """ - :returns: The total_workers - :rtype: unicode - """ - return self._properties['total_workers'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, task_channel=values.unset): - """ - Fetch a WorkersRealTimeStatisticsInstance - - :param unicode task_channel: The task_channel - - :returns: Fetched WorkersRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance - """ - return self._proxy.fetch(task_channel=task_channel, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkersRealTimeStatisticsInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py deleted file mode 100644 index bef1b08..0000000 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py +++ /dev/null @@ -1,294 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class WorkersStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkersStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsList - """ - super(WorkersStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - - def get(self): - """ - Constructs a WorkersStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - """ - return WorkersStatisticsContext(self._version, workspace_sid=self._solution['workspace_sid'], ) - - def __call__(self): - """ - Constructs a WorkersStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - """ - return WorkersStatisticsContext(self._version, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkersStatisticsList>' - - -class WorkersStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkersStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsPage - """ - super(WorkersStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkersStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsInstance - """ - return WorkersStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkersStatisticsPage>' - - -class WorkersStatisticsContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkersStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - """ - super(WorkersStatisticsContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/Statistics'.format(**self._solution) - - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_queue_sid=values.unset, - task_queue_name=values.unset, friendly_name=values.unset, - task_channel=values.unset): - """ - Fetch a WorkersStatisticsInstance - - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param datetime end_date: The end_date - :param unicode task_queue_sid: The task_queue_sid - :param unicode task_queue_name: The task_queue_name - :param unicode friendly_name: The friendly_name - :param unicode task_channel: The task_channel - - :returns: Fetched WorkersStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsInstance - """ - params = values.of({ - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'EndDate': serialize.iso8601_datetime(end_date), - 'TaskQueueSid': task_queue_sid, - 'TaskQueueName': task_queue_name, - 'FriendlyName': friendly_name, - 'TaskChannel': task_channel, - }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkersStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkersStatisticsContext {}>'.format(context) - - -class WorkersStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid): - """ - Initialize the WorkersStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsInstance - """ - super(WorkersStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'realtime': payload['realtime'], - 'cumulative': payload['cumulative'], - 'account_sid': payload['account_sid'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkersStatisticsContext for this WorkersStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - """ - if self._context is None: - self._context = WorkersStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._context - - @property - def realtime(self): - """ - :returns: The realtime - :rtype: dict - """ - return self._properties['realtime'] - - @property - def cumulative(self): - """ - :returns: The cumulative - :rtype: dict - """ - return self._properties['cumulative'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_queue_sid=values.unset, - task_queue_name=values.unset, friendly_name=values.unset, - task_channel=values.unset): - """ - Fetch a WorkersStatisticsInstance - - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param datetime end_date: The end_date - :param unicode task_queue_sid: The task_queue_sid - :param unicode task_queue_name: The task_queue_name - :param unicode friendly_name: The friendly_name - :param unicode task_channel: The task_channel - - :returns: Fetched WorkersStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsInstance - """ - return self._proxy.fetch( - minutes=minutes, - start_date=start_date, - end_date=end_date, - task_queue_sid=task_queue_sid, - task_queue_name=task_queue_name, - friendly_name=friendly_name, - task_channel=task_channel, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkersStatisticsInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py deleted file mode 100644 index cb78bbe..0000000 --- a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py +++ /dev/null @@ -1,618 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics import WorkflowCumulativeStatisticsList -from twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics import WorkflowRealTimeStatisticsList -from twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics import WorkflowStatisticsList - - -class WorkflowList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkflowList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowList - """ - super(WorkflowList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workflows'.format(**self._solution) - - def stream(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Streams WorkflowInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode friendly_name: The friendly_name - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Lists WorkflowInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: The friendly_name - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance] - """ - return list(self.stream(friendly_name=friendly_name, limit=limit, page_size=page_size, )) - - def page(self, friendly_name=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of WorkflowInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: The friendly_name - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowPage - """ - params = values.of({ - 'FriendlyName': friendly_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return WorkflowPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of WorkflowInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return WorkflowPage(self._version, response, self._solution) - - def create(self, friendly_name, configuration, - assignment_callback_url=values.unset, - fallback_assignment_callback_url=values.unset, - task_reservation_timeout=values.unset): - """ - Create a new WorkflowInstance - - :param unicode friendly_name: The friendly_name - :param unicode configuration: The configuration - :param unicode assignment_callback_url: The assignment_callback_url - :param unicode fallback_assignment_callback_url: The fallback_assignment_callback_url - :param unicode task_reservation_timeout: The task_reservation_timeout - - :returns: Newly created WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Configuration': configuration, - 'AssignmentCallbackUrl': assignment_callback_url, - 'FallbackAssignmentCallbackUrl': fallback_assignment_callback_url, - 'TaskReservationTimeout': task_reservation_timeout, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return WorkflowInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def get(self, sid): - """ - Constructs a WorkflowContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext - """ - return WorkflowContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a WorkflowContext - - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext - """ - return WorkflowContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkflowList>' - - -class WorkflowPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkflowPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowPage - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowPage - """ - super(WorkflowPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkflowInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - """ - return WorkflowInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkflowPage>' - - -class WorkflowContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, sid): - """ - Initialize the WorkflowContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param sid: The sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext - """ - super(WorkflowContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Workflows/{sid}'.format(**self._solution) - - # Dependents - self._statistics = None - self._real_time_statistics = None - self._cumulative_statistics = None - - def fetch(self): - """ - Fetch a WorkflowInstance - - :returns: Fetched WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkflowInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, - assignment_callback_url=values.unset, - fallback_assignment_callback_url=values.unset, - configuration=values.unset, task_reservation_timeout=values.unset): - """ - Update the WorkflowInstance - - :param unicode friendly_name: The friendly_name - :param unicode assignment_callback_url: The assignment_callback_url - :param unicode fallback_assignment_callback_url: The fallback_assignment_callback_url - :param unicode configuration: The configuration - :param unicode task_reservation_timeout: The task_reservation_timeout - - :returns: Updated WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'AssignmentCallbackUrl': assignment_callback_url, - 'FallbackAssignmentCallbackUrl': fallback_assignment_callback_url, - 'Configuration': configuration, - 'TaskReservationTimeout': task_reservation_timeout, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return WorkflowInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the WorkflowInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsList - """ - if self._statistics is None: - self._statistics = WorkflowStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['sid'], - ) - return self._statistics - - @property - def real_time_statistics(self): - """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsList - """ - if self._real_time_statistics is None: - self._real_time_statistics = WorkflowRealTimeStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['sid'], - ) - return self._real_time_statistics - - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsList - """ - if self._cumulative_statistics is None: - self._cumulative_statistics = WorkflowCumulativeStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['sid'], - ) - return self._cumulative_statistics - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkflowContext {}>'.format(context) - - -class WorkflowInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the WorkflowInstance - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - """ - super(WorkflowInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'assignment_callback_url': payload['assignment_callback_url'], - 'configuration': payload['configuration'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'document_content_type': payload['document_content_type'], - 'fallback_assignment_callback_url': payload['fallback_assignment_callback_url'], - 'friendly_name': payload['friendly_name'], - 'sid': payload['sid'], - 'task_reservation_timeout': deserialize.integer(payload['task_reservation_timeout']), - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkflowContext for this WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext - """ - if self._context is None: - self._context = WorkflowContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def assignment_callback_url(self): - """ - :returns: The assignment_callback_url - :rtype: unicode - """ - return self._properties['assignment_callback_url'] - - @property - def configuration(self): - """ - :returns: The configuration - :rtype: unicode - """ - return self._properties['configuration'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def document_content_type(self): - """ - :returns: The document_content_type - :rtype: unicode - """ - return self._properties['document_content_type'] - - @property - def fallback_assignment_callback_url(self): - """ - :returns: The fallback_assignment_callback_url - :rtype: unicode - """ - return self._properties['fallback_assignment_callback_url'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def task_reservation_timeout(self): - """ - :returns: The task_reservation_timeout - :rtype: unicode - """ - return self._properties['task_reservation_timeout'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a WorkflowInstance - - :returns: Fetched WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, - assignment_callback_url=values.unset, - fallback_assignment_callback_url=values.unset, - configuration=values.unset, task_reservation_timeout=values.unset): - """ - Update the WorkflowInstance - - :param unicode friendly_name: The friendly_name - :param unicode assignment_callback_url: The assignment_callback_url - :param unicode fallback_assignment_callback_url: The fallback_assignment_callback_url - :param unicode configuration: The configuration - :param unicode task_reservation_timeout: The task_reservation_timeout - - :returns: Updated WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - assignment_callback_url=assignment_callback_url, - fallback_assignment_callback_url=fallback_assignment_callback_url, - configuration=configuration, - task_reservation_timeout=task_reservation_timeout, - ) - - def delete(self): - """ - Deletes the WorkflowInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsList - """ - return self._proxy.statistics - - @property - def real_time_statistics(self): - """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsList - """ - return self._proxy.real_time_statistics - - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsList - """ - return self._proxy.cumulative_statistics - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkflowInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/__pycache__/__init__.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/workflow/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index cca4bd9..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/workflow/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/__pycache__/workflow_cumulative_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/workflow/__pycache__/workflow_cumulative_statistics.cpython-36.pyc deleted file mode 100644 index e72240f..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/workflow/__pycache__/workflow_cumulative_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/__pycache__/workflow_real_time_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/workflow/__pycache__/workflow_real_time_statistics.cpython-36.pyc deleted file mode 100644 index bd9f1b3..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/workflow/__pycache__/workflow_real_time_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/__pycache__/workflow_statistics.cpython-36.pyc b/twilio/rest/taskrouter/v1/workspace/workflow/__pycache__/workflow_statistics.cpython-36.pyc deleted file mode 100644 index f467a5f..0000000 Binary files a/twilio/rest/taskrouter/v1/workspace/workflow/__pycache__/workflow_statistics.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py deleted file mode 100644 index c8a7fda..0000000 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py +++ /dev/null @@ -1,452 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class WorkflowCumulativeStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid, workflow_sid): - """ - Initialize the WorkflowCumulativeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param workflow_sid: The workflow_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsList - """ - super(WorkflowCumulativeStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - - def get(self): - """ - Constructs a WorkflowCumulativeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - """ - return WorkflowCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __call__(self): - """ - Constructs a WorkflowCumulativeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - """ - return WorkflowCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkflowCumulativeStatisticsList>' - - -class WorkflowCumulativeStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkflowCumulativeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - :param workflow_sid: The workflow_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsPage - """ - super(WorkflowCumulativeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkflowCumulativeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsInstance - """ - return WorkflowCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkflowCumulativeStatisticsPage>' - - -class WorkflowCumulativeStatisticsContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, workflow_sid): - """ - Initialize the WorkflowCumulativeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param workflow_sid: The workflow_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - """ - super(WorkflowCumulativeStatisticsContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workflows/{workflow_sid}/CumulativeStatistics'.format(**self._solution) - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch a WorkflowCumulativeStatisticsInstance - - :param datetime end_date: The end_date - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - - :returns: Fetched WorkflowCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsInstance - """ - params = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkflowCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkflowCumulativeStatisticsContext {}>'.format(context) - - -class WorkflowCumulativeStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid, workflow_sid): - """ - Initialize the WorkflowCumulativeStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsInstance - """ - super(WorkflowCumulativeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'avg_task_acceptance_time': deserialize.integer(payload['avg_task_acceptance_time']), - 'start_time': deserialize.iso8601_datetime(payload['start_time']), - 'end_time': deserialize.iso8601_datetime(payload['end_time']), - 'reservations_created': deserialize.integer(payload['reservations_created']), - 'reservations_accepted': deserialize.integer(payload['reservations_accepted']), - 'reservations_rejected': deserialize.integer(payload['reservations_rejected']), - 'reservations_timed_out': deserialize.integer(payload['reservations_timed_out']), - 'reservations_canceled': deserialize.integer(payload['reservations_canceled']), - 'reservations_rescinded': deserialize.integer(payload['reservations_rescinded']), - 'split_by_wait_time': payload['split_by_wait_time'], - 'wait_duration_until_accepted': payload['wait_duration_until_accepted'], - 'wait_duration_until_canceled': payload['wait_duration_until_canceled'], - 'tasks_canceled': deserialize.integer(payload['tasks_canceled']), - 'tasks_completed': deserialize.integer(payload['tasks_completed']), - 'tasks_entered': deserialize.integer(payload['tasks_entered']), - 'tasks_deleted': deserialize.integer(payload['tasks_deleted']), - 'tasks_moved': deserialize.integer(payload['tasks_moved']), - 'tasks_timed_out_in_workflow': deserialize.integer(payload['tasks_timed_out_in_workflow']), - 'workflow_sid': payload['workflow_sid'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkflowCumulativeStatisticsContext for this WorkflowCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - """ - if self._context is None: - self._context = WorkflowCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def avg_task_acceptance_time(self): - """ - :returns: The avg_task_acceptance_time - :rtype: unicode - """ - return self._properties['avg_task_acceptance_time'] - - @property - def start_time(self): - """ - :returns: The start_time - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The end_time - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def reservations_created(self): - """ - :returns: The reservations_created - :rtype: unicode - """ - return self._properties['reservations_created'] - - @property - def reservations_accepted(self): - """ - :returns: The reservations_accepted - :rtype: unicode - """ - return self._properties['reservations_accepted'] - - @property - def reservations_rejected(self): - """ - :returns: The reservations_rejected - :rtype: unicode - """ - return self._properties['reservations_rejected'] - - @property - def reservations_timed_out(self): - """ - :returns: The reservations_timed_out - :rtype: unicode - """ - return self._properties['reservations_timed_out'] - - @property - def reservations_canceled(self): - """ - :returns: The reservations_canceled - :rtype: unicode - """ - return self._properties['reservations_canceled'] - - @property - def reservations_rescinded(self): - """ - :returns: The reservations_rescinded - :rtype: unicode - """ - return self._properties['reservations_rescinded'] - - @property - def split_by_wait_time(self): - """ - :returns: The split_by_wait_time - :rtype: dict - """ - return self._properties['split_by_wait_time'] - - @property - def wait_duration_until_accepted(self): - """ - :returns: The wait_duration_until_accepted - :rtype: dict - """ - return self._properties['wait_duration_until_accepted'] - - @property - def wait_duration_until_canceled(self): - """ - :returns: The wait_duration_until_canceled - :rtype: dict - """ - return self._properties['wait_duration_until_canceled'] - - @property - def tasks_canceled(self): - """ - :returns: The tasks_canceled - :rtype: unicode - """ - return self._properties['tasks_canceled'] - - @property - def tasks_completed(self): - """ - :returns: The tasks_completed - :rtype: unicode - """ - return self._properties['tasks_completed'] - - @property - def tasks_entered(self): - """ - :returns: The tasks_entered - :rtype: unicode - """ - return self._properties['tasks_entered'] - - @property - def tasks_deleted(self): - """ - :returns: The tasks_deleted - :rtype: unicode - """ - return self._properties['tasks_deleted'] - - @property - def tasks_moved(self): - """ - :returns: The tasks_moved - :rtype: unicode - """ - return self._properties['tasks_moved'] - - @property - def tasks_timed_out_in_workflow(self): - """ - :returns: The tasks_timed_out_in_workflow - :rtype: unicode - """ - return self._properties['tasks_timed_out_in_workflow'] - - @property - def workflow_sid(self): - """ - :returns: The workflow_sid - :rtype: unicode - """ - return self._properties['workflow_sid'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch a WorkflowCumulativeStatisticsInstance - - :param datetime end_date: The end_date - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - - :returns: Fetched WorkflowCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsInstance - """ - return self._proxy.fetch( - end_date=end_date, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkflowCumulativeStatisticsInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py deleted file mode 100644 index a83bc0e..0000000 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py +++ /dev/null @@ -1,301 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class WorkflowRealTimeStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid, workflow_sid): - """ - Initialize the WorkflowRealTimeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param workflow_sid: The workflow_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsList - """ - super(WorkflowRealTimeStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - - def get(self): - """ - Constructs a WorkflowRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsContext - """ - return WorkflowRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __call__(self): - """ - Constructs a WorkflowRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsContext - """ - return WorkflowRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkflowRealTimeStatisticsList>' - - -class WorkflowRealTimeStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkflowRealTimeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - :param workflow_sid: The workflow_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsPage - """ - super(WorkflowRealTimeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkflowRealTimeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsInstance - """ - return WorkflowRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkflowRealTimeStatisticsPage>' - - -class WorkflowRealTimeStatisticsContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, workflow_sid): - """ - Initialize the WorkflowRealTimeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param workflow_sid: The workflow_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsContext - """ - super(WorkflowRealTimeStatisticsContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workflows/{workflow_sid}/RealTimeStatistics'.format(**self._solution) - - def fetch(self, task_channel=values.unset): - """ - Fetch a WorkflowRealTimeStatisticsInstance - - :param unicode task_channel: The task_channel - - :returns: Fetched WorkflowRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsInstance - """ - params = values.of({'TaskChannel': task_channel, }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkflowRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkflowRealTimeStatisticsContext {}>'.format(context) - - -class WorkflowRealTimeStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid, workflow_sid): - """ - Initialize the WorkflowRealTimeStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsInstance - """ - super(WorkflowRealTimeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'longest_task_waiting_age': deserialize.integer(payload['longest_task_waiting_age']), - 'tasks_by_priority': payload['tasks_by_priority'], - 'tasks_by_status': payload['tasks_by_status'], - 'total_tasks': deserialize.integer(payload['total_tasks']), - 'workflow_sid': payload['workflow_sid'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkflowRealTimeStatisticsContext for this WorkflowRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsContext - """ - if self._context is None: - self._context = WorkflowRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def longest_task_waiting_age(self): - """ - :returns: The longest_task_waiting_age - :rtype: unicode - """ - return self._properties['longest_task_waiting_age'] - - @property - def tasks_by_priority(self): - """ - :returns: The tasks_by_priority - :rtype: dict - """ - return self._properties['tasks_by_priority'] - - @property - def tasks_by_status(self): - """ - :returns: The tasks_by_status - :rtype: dict - """ - return self._properties['tasks_by_status'] - - @property - def total_tasks(self): - """ - :returns: The total_tasks - :rtype: unicode - """ - return self._properties['total_tasks'] - - @property - def workflow_sid(self): - """ - :returns: The workflow_sid - :rtype: unicode - """ - return self._properties['workflow_sid'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, task_channel=values.unset): - """ - Fetch a WorkflowRealTimeStatisticsInstance - - :param unicode task_channel: The task_channel - - :returns: Fetched WorkflowRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsInstance - """ - return self._proxy.fetch(task_channel=task_channel, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkflowRealTimeStatisticsInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py deleted file mode 100644 index b52555d..0000000 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py +++ /dev/null @@ -1,307 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class WorkflowStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid, workflow_sid): - """ - Initialize the WorkflowStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param workflow_sid: The workflow_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsList - """ - super(WorkflowStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - - def get(self): - """ - Constructs a WorkflowStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - """ - return WorkflowStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __call__(self): - """ - Constructs a WorkflowStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - """ - return WorkflowStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkflowStatisticsList>' - - -class WorkflowStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkflowStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - :param workflow_sid: The workflow_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsPage - """ - super(WorkflowStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkflowStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance - """ - return WorkflowStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkflowStatisticsPage>' - - -class WorkflowStatisticsContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid, workflow_sid): - """ - Initialize the WorkflowStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - :param workflow_sid: The workflow_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - """ - super(WorkflowStatisticsContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workflows/{workflow_sid}/Statistics'.format(**self._solution) - - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch a WorkflowStatisticsInstance - - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param datetime end_date: The end_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - - :returns: Fetched WorkflowStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance - """ - params = values.of({ - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'EndDate': serialize.iso8601_datetime(end_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkflowStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkflowStatisticsContext {}>'.format(context) - - -class WorkflowStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid, workflow_sid): - """ - Initialize the WorkflowStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance - """ - super(WorkflowStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'cumulative': payload['cumulative'], - 'realtime': payload['realtime'], - 'workflow_sid': payload['workflow_sid'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkflowStatisticsContext for this WorkflowStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - """ - if self._context is None: - self._context = WorkflowStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def cumulative(self): - """ - :returns: The cumulative - :rtype: dict - """ - return self._properties['cumulative'] - - @property - def realtime(self): - """ - :returns: The realtime - :rtype: dict - """ - return self._properties['realtime'] - - @property - def workflow_sid(self): - """ - :returns: The workflow_sid - :rtype: unicode - """ - return self._properties['workflow_sid'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch a WorkflowStatisticsInstance - - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param datetime end_date: The end_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - - :returns: Fetched WorkflowStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance - """ - return self._proxy.fetch( - minutes=minutes, - start_date=start_date, - end_date=end_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkflowStatisticsInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py deleted file mode 100644 index 528b104..0000000 --- a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py +++ /dev/null @@ -1,435 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class WorkspaceCumulativeStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkspaceCumulativeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsList - """ - super(WorkspaceCumulativeStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - - def get(self): - """ - Constructs a WorkspaceCumulativeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - """ - return WorkspaceCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - - def __call__(self): - """ - Constructs a WorkspaceCumulativeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - """ - return WorkspaceCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkspaceCumulativeStatisticsList>' - - -class WorkspaceCumulativeStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkspaceCumulativeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsPage - """ - super(WorkspaceCumulativeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkspaceCumulativeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsInstance - """ - return WorkspaceCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkspaceCumulativeStatisticsPage>' - - -class WorkspaceCumulativeStatisticsContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkspaceCumulativeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - """ - super(WorkspaceCumulativeStatisticsContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/CumulativeStatistics'.format(**self._solution) - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch a WorkspaceCumulativeStatisticsInstance - - :param datetime end_date: The end_date - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - - :returns: Fetched WorkspaceCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsInstance - """ - params = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkspaceCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkspaceCumulativeStatisticsContext {}>'.format(context) - - -class WorkspaceCumulativeStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid): - """ - Initialize the WorkspaceCumulativeStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsInstance - """ - super(WorkspaceCumulativeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'avg_task_acceptance_time': deserialize.integer(payload['avg_task_acceptance_time']), - 'start_time': deserialize.iso8601_datetime(payload['start_time']), - 'end_time': deserialize.iso8601_datetime(payload['end_time']), - 'reservations_created': deserialize.integer(payload['reservations_created']), - 'reservations_accepted': deserialize.integer(payload['reservations_accepted']), - 'reservations_rejected': deserialize.integer(payload['reservations_rejected']), - 'reservations_timed_out': deserialize.integer(payload['reservations_timed_out']), - 'reservations_canceled': deserialize.integer(payload['reservations_canceled']), - 'reservations_rescinded': deserialize.integer(payload['reservations_rescinded']), - 'split_by_wait_time': payload['split_by_wait_time'], - 'wait_duration_until_accepted': payload['wait_duration_until_accepted'], - 'wait_duration_until_canceled': payload['wait_duration_until_canceled'], - 'tasks_canceled': deserialize.integer(payload['tasks_canceled']), - 'tasks_completed': deserialize.integer(payload['tasks_completed']), - 'tasks_created': deserialize.integer(payload['tasks_created']), - 'tasks_deleted': deserialize.integer(payload['tasks_deleted']), - 'tasks_moved': deserialize.integer(payload['tasks_moved']), - 'tasks_timed_out_in_workflow': deserialize.integer(payload['tasks_timed_out_in_workflow']), - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkspaceCumulativeStatisticsContext for this WorkspaceCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - """ - if self._context is None: - self._context = WorkspaceCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def avg_task_acceptance_time(self): - """ - :returns: The avg_task_acceptance_time - :rtype: unicode - """ - return self._properties['avg_task_acceptance_time'] - - @property - def start_time(self): - """ - :returns: The start_time - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The end_time - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def reservations_created(self): - """ - :returns: The reservations_created - :rtype: unicode - """ - return self._properties['reservations_created'] - - @property - def reservations_accepted(self): - """ - :returns: The reservations_accepted - :rtype: unicode - """ - return self._properties['reservations_accepted'] - - @property - def reservations_rejected(self): - """ - :returns: The reservations_rejected - :rtype: unicode - """ - return self._properties['reservations_rejected'] - - @property - def reservations_timed_out(self): - """ - :returns: The reservations_timed_out - :rtype: unicode - """ - return self._properties['reservations_timed_out'] - - @property - def reservations_canceled(self): - """ - :returns: The reservations_canceled - :rtype: unicode - """ - return self._properties['reservations_canceled'] - - @property - def reservations_rescinded(self): - """ - :returns: The reservations_rescinded - :rtype: unicode - """ - return self._properties['reservations_rescinded'] - - @property - def split_by_wait_time(self): - """ - :returns: The split_by_wait_time - :rtype: dict - """ - return self._properties['split_by_wait_time'] - - @property - def wait_duration_until_accepted(self): - """ - :returns: The wait_duration_until_accepted - :rtype: dict - """ - return self._properties['wait_duration_until_accepted'] - - @property - def wait_duration_until_canceled(self): - """ - :returns: The wait_duration_until_canceled - :rtype: dict - """ - return self._properties['wait_duration_until_canceled'] - - @property - def tasks_canceled(self): - """ - :returns: The tasks_canceled - :rtype: unicode - """ - return self._properties['tasks_canceled'] - - @property - def tasks_completed(self): - """ - :returns: The tasks_completed - :rtype: unicode - """ - return self._properties['tasks_completed'] - - @property - def tasks_created(self): - """ - :returns: The tasks_created - :rtype: unicode - """ - return self._properties['tasks_created'] - - @property - def tasks_deleted(self): - """ - :returns: The tasks_deleted - :rtype: unicode - """ - return self._properties['tasks_deleted'] - - @property - def tasks_moved(self): - """ - :returns: The tasks_moved - :rtype: unicode - """ - return self._properties['tasks_moved'] - - @property - def tasks_timed_out_in_workflow(self): - """ - :returns: The tasks_timed_out_in_workflow - :rtype: unicode - """ - return self._properties['tasks_timed_out_in_workflow'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch a WorkspaceCumulativeStatisticsInstance - - :param datetime end_date: The end_date - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - - :returns: Fetched WorkspaceCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsInstance - """ - return self._proxy.fetch( - end_date=end_date, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkspaceCumulativeStatisticsInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py deleted file mode 100644 index 9918df6..0000000 --- a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py +++ /dev/null @@ -1,302 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class WorkspaceRealTimeStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkspaceRealTimeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsList - """ - super(WorkspaceRealTimeStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - - def get(self): - """ - Constructs a WorkspaceRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - """ - return WorkspaceRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - - def __call__(self): - """ - Constructs a WorkspaceRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - """ - return WorkspaceRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkspaceRealTimeStatisticsList>' - - -class WorkspaceRealTimeStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkspaceRealTimeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsPage - """ - super(WorkspaceRealTimeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkspaceRealTimeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsInstance - """ - return WorkspaceRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkspaceRealTimeStatisticsPage>' - - -class WorkspaceRealTimeStatisticsContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkspaceRealTimeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - """ - super(WorkspaceRealTimeStatisticsContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/RealTimeStatistics'.format(**self._solution) - - def fetch(self, task_channel=values.unset): - """ - Fetch a WorkspaceRealTimeStatisticsInstance - - :param unicode task_channel: The task_channel - - :returns: Fetched WorkspaceRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsInstance - """ - params = values.of({'TaskChannel': task_channel, }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkspaceRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkspaceRealTimeStatisticsContext {}>'.format(context) - - -class WorkspaceRealTimeStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid): - """ - Initialize the WorkspaceRealTimeStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsInstance - """ - super(WorkspaceRealTimeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'activity_statistics': payload['activity_statistics'], - 'longest_task_waiting_age': deserialize.integer(payload['longest_task_waiting_age']), - 'tasks_by_priority': payload['tasks_by_priority'], - 'tasks_by_status': payload['tasks_by_status'], - 'total_tasks': deserialize.integer(payload['total_tasks']), - 'total_workers': deserialize.integer(payload['total_workers']), - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkspaceRealTimeStatisticsContext for this WorkspaceRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - """ - if self._context is None: - self._context = WorkspaceRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def activity_statistics(self): - """ - :returns: The activity_statistics - :rtype: dict - """ - return self._properties['activity_statistics'] - - @property - def longest_task_waiting_age(self): - """ - :returns: The longest_task_waiting_age - :rtype: unicode - """ - return self._properties['longest_task_waiting_age'] - - @property - def tasks_by_priority(self): - """ - :returns: The tasks_by_priority - :rtype: dict - """ - return self._properties['tasks_by_priority'] - - @property - def tasks_by_status(self): - """ - :returns: The tasks_by_status - :rtype: dict - """ - return self._properties['tasks_by_status'] - - @property - def total_tasks(self): - """ - :returns: The total_tasks - :rtype: unicode - """ - return self._properties['total_tasks'] - - @property - def total_workers(self): - """ - :returns: The total_workers - :rtype: unicode - """ - return self._properties['total_workers'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, task_channel=values.unset): - """ - Fetch a WorkspaceRealTimeStatisticsInstance - - :param unicode task_channel: The task_channel - - :returns: Fetched WorkspaceRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsInstance - """ - return self._proxy.fetch(task_channel=task_channel, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkspaceRealTimeStatisticsInstance {}>'.format(context) diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py deleted file mode 100644 index f5c511b..0000000 --- a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py +++ /dev/null @@ -1,284 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class WorkspaceStatisticsList(ListResource): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkspaceStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList - """ - super(WorkspaceStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - - def get(self): - """ - Constructs a WorkspaceStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - """ - return WorkspaceStatisticsContext(self._version, workspace_sid=self._solution['workspace_sid'], ) - - def __call__(self): - """ - Constructs a WorkspaceStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - """ - return WorkspaceStatisticsContext(self._version, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkspaceStatisticsList>' - - -class WorkspaceStatisticsPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the WorkspaceStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsPage - """ - super(WorkspaceStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkspaceStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsInstance - """ - return WorkspaceStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Taskrouter.V1.WorkspaceStatisticsPage>' - - -class WorkspaceStatisticsContext(InstanceContext): - """ """ - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkspaceStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The workspace_sid - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - """ - super(WorkspaceStatisticsContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Statistics'.format(**self._solution) - - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch a WorkspaceStatisticsInstance - - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param datetime end_date: The end_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - - :returns: Fetched WorkspaceStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsInstance - """ - params = values.of({ - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'EndDate': serialize.iso8601_datetime(end_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - }) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return WorkspaceStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkspaceStatisticsContext {}>'.format(context) - - -class WorkspaceStatisticsInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, workspace_sid): - """ - Initialize the WorkspaceStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsInstance - """ - super(WorkspaceStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'realtime': payload['realtime'], - 'cumulative': payload['cumulative'], - 'account_sid': payload['account_sid'], - 'workspace_sid': payload['workspace_sid'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkspaceStatisticsContext for this WorkspaceStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - """ - if self._context is None: - self._context = WorkspaceStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._context - - @property - def realtime(self): - """ - :returns: The realtime - :rtype: dict - """ - return self._properties['realtime'] - - @property - def cumulative(self): - """ - :returns: The cumulative - :rtype: dict - """ - return self._properties['cumulative'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def workspace_sid(self): - """ - :returns: The workspace_sid - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch a WorkspaceStatisticsInstance - - :param unicode minutes: The minutes - :param datetime start_date: The start_date - :param datetime end_date: The end_date - :param unicode task_channel: The task_channel - :param unicode split_by_wait_time: The split_by_wait_time - - :returns: Fetched WorkspaceStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsInstance - """ - return self._proxy.fetch( - minutes=minutes, - start_date=start_date, - end_date=end_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Taskrouter.V1.WorkspaceStatisticsInstance {}>'.format(context) diff --git a/twilio/rest/trunking/__init__.py b/twilio/rest/trunking/__init__.py deleted file mode 100644 index 9134532..0000000 --- a/twilio/rest/trunking/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.trunking.v1 import V1 - - -class Trunking(Domain): - - def __init__(self, twilio): - """ - Initialize the Trunking Domain - - :returns: Domain for Trunking - :rtype: twilio.rest.trunking.Trunking - """ - super(Trunking, self).__init__(twilio) - - self.base_url = 'https://trunking.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of trunking - :rtype: twilio.rest.trunking.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def trunks(self): - """ - :rtype: twilio.rest.trunking.v1.trunk.TrunkList - """ - return self.v1.trunks - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Trunking>' diff --git a/twilio/rest/trunking/__pycache__/__init__.cpython-36.pyc b/twilio/rest/trunking/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index e609ba7..0000000 Binary files a/twilio/rest/trunking/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/trunking/v1/__init__.py b/twilio/rest/trunking/v1/__init__.py deleted file mode 100644 index ca3694a..0000000 --- a/twilio/rest/trunking/v1/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.trunking.v1.trunk import TrunkList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Trunking - - :returns: V1 version of Trunking - :rtype: twilio.rest.trunking.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._trunks = None - - @property - def trunks(self): - """ - :rtype: twilio.rest.trunking.v1.trunk.TrunkList - """ - if self._trunks is None: - self._trunks = TrunkList(self) - return self._trunks - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Trunking.V1>' diff --git a/twilio/rest/trunking/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/trunking/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index c24fd91..0000000 Binary files a/twilio/rest/trunking/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/trunking/v1/trunk/__init__.py b/twilio/rest/trunking/v1/trunk/__init__.py deleted file mode 100644 index a4d09dc..0000000 --- a/twilio/rest/trunking/v1/trunk/__init__.py +++ /dev/null @@ -1,623 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.trunking.v1.trunk.credential_list import CredentialListList -from twilio.rest.trunking.v1.trunk.ip_access_control_list import IpAccessControlListList -from twilio.rest.trunking.v1.trunk.origination_url import OriginationUrlList -from twilio.rest.trunking.v1.trunk.phone_number import PhoneNumberList - - -class TrunkList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the TrunkList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.trunking.v1.trunk.TrunkList - :rtype: twilio.rest.trunking.v1.trunk.TrunkList - """ - super(TrunkList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Trunks'.format(**self._solution) - - def create(self, friendly_name=values.unset, domain_name=values.unset, - disaster_recovery_url=values.unset, - disaster_recovery_method=values.unset, recording=values.unset, - secure=values.unset): - """ - Create a new TrunkInstance - - :param unicode friendly_name: The friendly_name - :param unicode domain_name: The domain_name - :param unicode disaster_recovery_url: The disaster_recovery_url - :param unicode disaster_recovery_method: The disaster_recovery_method - :param unicode recording: The recording - :param bool secure: The secure - - :returns: Newly created TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'DomainName': domain_name, - 'DisasterRecoveryUrl': disaster_recovery_url, - 'DisasterRecoveryMethod': disaster_recovery_method, - 'Recording': recording, - 'Secure': secure, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return TrunkInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams TrunkInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.trunking.v1.trunk.TrunkInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists TrunkInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.trunking.v1.trunk.TrunkInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TrunkInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return TrunkPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TrunkInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TrunkPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a TrunkContext - - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.TrunkContext - :rtype: twilio.rest.trunking.v1.trunk.TrunkContext - """ - return TrunkContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TrunkContext - - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.TrunkContext - :rtype: twilio.rest.trunking.v1.trunk.TrunkContext - """ - return TrunkContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Trunking.V1.TrunkList>' - - -class TrunkPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the TrunkPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.trunking.v1.trunk.TrunkPage - :rtype: twilio.rest.trunking.v1.trunk.TrunkPage - """ - super(TrunkPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TrunkInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trunking.v1.trunk.TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance - """ - return TrunkInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Trunking.V1.TrunkPage>' - - -class TrunkContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the TrunkContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.TrunkContext - :rtype: twilio.rest.trunking.v1.trunk.TrunkContext - """ - super(TrunkContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Trunks/{sid}'.format(**self._solution) - - # Dependents - self._origination_urls = None - self._credentials_lists = None - self._ip_access_control_lists = None - self._phone_numbers = None - - def fetch(self): - """ - Fetch a TrunkInstance - - :returns: Fetched TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return TrunkInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the TrunkInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, friendly_name=values.unset, domain_name=values.unset, - disaster_recovery_url=values.unset, - disaster_recovery_method=values.unset, recording=values.unset, - secure=values.unset): - """ - Update the TrunkInstance - - :param unicode friendly_name: The friendly_name - :param unicode domain_name: The domain_name - :param unicode disaster_recovery_url: The disaster_recovery_url - :param unicode disaster_recovery_method: The disaster_recovery_method - :param unicode recording: The recording - :param bool secure: The secure - - :returns: Updated TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'DomainName': domain_name, - 'DisasterRecoveryUrl': disaster_recovery_url, - 'DisasterRecoveryMethod': disaster_recovery_method, - 'Recording': recording, - 'Secure': secure, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return TrunkInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def origination_urls(self): - """ - Access the origination_urls - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlList - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlList - """ - if self._origination_urls is None: - self._origination_urls = OriginationUrlList(self._version, trunk_sid=self._solution['sid'], ) - return self._origination_urls - - @property - def credentials_lists(self): - """ - Access the credentials_lists - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListList - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListList - """ - if self._credentials_lists is None: - self._credentials_lists = CredentialListList(self._version, trunk_sid=self._solution['sid'], ) - return self._credentials_lists - - @property - def ip_access_control_lists(self): - """ - Access the ip_access_control_lists - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListList - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListList - """ - if self._ip_access_control_lists is None: - self._ip_access_control_lists = IpAccessControlListList( - self._version, - trunk_sid=self._solution['sid'], - ) - return self._ip_access_control_lists - - @property - def phone_numbers(self): - """ - Access the phone_numbers - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberList - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberList - """ - if self._phone_numbers is None: - self._phone_numbers = PhoneNumberList(self._version, trunk_sid=self._solution['sid'], ) - return self._phone_numbers - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Trunking.V1.TrunkContext {}>'.format(context) - - -class TrunkInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the TrunkInstance - - :returns: twilio.rest.trunking.v1.trunk.TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance - """ - super(TrunkInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'domain_name': payload['domain_name'], - 'disaster_recovery_method': payload['disaster_recovery_method'], - 'disaster_recovery_url': payload['disaster_recovery_url'], - 'friendly_name': payload['friendly_name'], - 'secure': payload['secure'], - 'recording': payload['recording'], - 'auth_type': payload['auth_type'], - 'auth_type_set': payload['auth_type_set'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'sid': payload['sid'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TrunkContext for this TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkContext - """ - if self._context is None: - self._context = TrunkContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def domain_name(self): - """ - :returns: The domain_name - :rtype: unicode - """ - return self._properties['domain_name'] - - @property - def disaster_recovery_method(self): - """ - :returns: The disaster_recovery_method - :rtype: unicode - """ - return self._properties['disaster_recovery_method'] - - @property - def disaster_recovery_url(self): - """ - :returns: The disaster_recovery_url - :rtype: unicode - """ - return self._properties['disaster_recovery_url'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def secure(self): - """ - :returns: The secure - :rtype: bool - """ - return self._properties['secure'] - - @property - def recording(self): - """ - :returns: The recording - :rtype: dict - """ - return self._properties['recording'] - - @property - def auth_type(self): - """ - :returns: The auth_type - :rtype: unicode - """ - return self._properties['auth_type'] - - @property - def auth_type_set(self): - """ - :returns: The auth_type_set - :rtype: unicode - """ - return self._properties['auth_type_set'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a TrunkInstance - - :returns: Fetched TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the TrunkInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, domain_name=values.unset, - disaster_recovery_url=values.unset, - disaster_recovery_method=values.unset, recording=values.unset, - secure=values.unset): - """ - Update the TrunkInstance - - :param unicode friendly_name: The friendly_name - :param unicode domain_name: The domain_name - :param unicode disaster_recovery_url: The disaster_recovery_url - :param unicode disaster_recovery_method: The disaster_recovery_method - :param unicode recording: The recording - :param bool secure: The secure - - :returns: Updated TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - domain_name=domain_name, - disaster_recovery_url=disaster_recovery_url, - disaster_recovery_method=disaster_recovery_method, - recording=recording, - secure=secure, - ) - - @property - def origination_urls(self): - """ - Access the origination_urls - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlList - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlList - """ - return self._proxy.origination_urls - - @property - def credentials_lists(self): - """ - Access the credentials_lists - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListList - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListList - """ - return self._proxy.credentials_lists - - @property - def ip_access_control_lists(self): - """ - Access the ip_access_control_lists - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListList - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListList - """ - return self._proxy.ip_access_control_lists - - @property - def phone_numbers(self): - """ - Access the phone_numbers - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberList - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberList - """ - return self._proxy.phone_numbers - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Trunking.V1.TrunkInstance {}>'.format(context) diff --git a/twilio/rest/trunking/v1/trunk/__pycache__/__init__.cpython-36.pyc b/twilio/rest/trunking/v1/trunk/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 20bb9d9..0000000 Binary files a/twilio/rest/trunking/v1/trunk/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/trunking/v1/trunk/__pycache__/credential_list.cpython-36.pyc b/twilio/rest/trunking/v1/trunk/__pycache__/credential_list.cpython-36.pyc deleted file mode 100644 index 3e19b9a..0000000 Binary files a/twilio/rest/trunking/v1/trunk/__pycache__/credential_list.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/trunking/v1/trunk/__pycache__/ip_access_control_list.cpython-36.pyc b/twilio/rest/trunking/v1/trunk/__pycache__/ip_access_control_list.cpython-36.pyc deleted file mode 100644 index e6214f2..0000000 Binary files a/twilio/rest/trunking/v1/trunk/__pycache__/ip_access_control_list.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/trunking/v1/trunk/__pycache__/origination_url.cpython-36.pyc b/twilio/rest/trunking/v1/trunk/__pycache__/origination_url.cpython-36.pyc deleted file mode 100644 index 99c3872..0000000 Binary files a/twilio/rest/trunking/v1/trunk/__pycache__/origination_url.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/trunking/v1/trunk/__pycache__/phone_number.cpython-36.pyc b/twilio/rest/trunking/v1/trunk/__pycache__/phone_number.cpython-36.pyc deleted file mode 100644 index 38d7323..0000000 Binary files a/twilio/rest/trunking/v1/trunk/__pycache__/phone_number.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/trunking/v1/trunk/credential_list.py b/twilio/rest/trunking/v1/trunk/credential_list.py deleted file mode 100644 index 70d6b1a..0000000 --- a/twilio/rest/trunking/v1/trunk/credential_list.py +++ /dev/null @@ -1,396 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class CredentialListList(ListResource): - """ """ - - def __init__(self, version, trunk_sid): - """ - Initialize the CredentialListList - - :param Version version: Version that contains the resource - :param trunk_sid: The trunk_sid - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListList - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListList - """ - super(CredentialListList, self).__init__(version) - - # Path Solution - self._solution = {'trunk_sid': trunk_sid, } - self._uri = '/Trunks/{trunk_sid}/CredentialLists'.format(**self._solution) - - def create(self, credential_list_sid): - """ - Create a new CredentialListInstance - - :param unicode credential_list_sid: The credential_list_sid - - :returns: Newly created CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - """ - data = values.of({'CredentialListSid': credential_list_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CredentialListInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialListInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialListInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CredentialListPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialListInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialListPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a CredentialListContext - - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - """ - return CredentialListContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CredentialListContext - - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - """ - return CredentialListContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Trunking.V1.CredentialListList>' - - -class CredentialListPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the CredentialListPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param trunk_sid: The trunk_sid - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListPage - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListPage - """ - super(CredentialListPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialListInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - """ - return CredentialListInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Trunking.V1.CredentialListPage>' - - -class CredentialListContext(InstanceContext): - """ """ - - def __init__(self, version, trunk_sid, sid): - """ - Initialize the CredentialListContext - - :param Version version: Version that contains the resource - :param trunk_sid: The trunk_sid - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - """ - super(CredentialListContext, self).__init__(version) - - # Path Solution - self._solution = {'trunk_sid': trunk_sid, 'sid': sid, } - self._uri = '/Trunks/{trunk_sid}/CredentialLists/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a CredentialListInstance - - :returns: Fetched CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CredentialListInstance( - self._version, - payload, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the CredentialListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Trunking.V1.CredentialListContext {}>'.format(context) - - -class CredentialListInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, trunk_sid, sid=None): - """ - Initialize the CredentialListInstance - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - """ - super(CredentialListInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'sid': payload['sid'], - 'trunk_sid': payload['trunk_sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'trunk_sid': trunk_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialListContext for this CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - """ - if self._context is None: - self._context = CredentialListContext( - self._version, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def trunk_sid(self): - """ - :returns: The trunk_sid - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a CredentialListInstance - - :returns: Fetched CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the CredentialListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Trunking.V1.CredentialListInstance {}>'.format(context) diff --git a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py deleted file mode 100644 index e9ca55f..0000000 --- a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py +++ /dev/null @@ -1,396 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class IpAccessControlListList(ListResource): - """ """ - - def __init__(self, version, trunk_sid): - """ - Initialize the IpAccessControlListList - - :param Version version: Version that contains the resource - :param trunk_sid: The trunk_sid - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListList - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListList - """ - super(IpAccessControlListList, self).__init__(version) - - # Path Solution - self._solution = {'trunk_sid': trunk_sid, } - self._uri = '/Trunks/{trunk_sid}/IpAccessControlLists'.format(**self._solution) - - def create(self, ip_access_control_list_sid): - """ - Create a new IpAccessControlListInstance - - :param unicode ip_access_control_list_sid: The ip_access_control_list_sid - - :returns: Newly created IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - """ - data = values.of({'IpAccessControlListSid': ip_access_control_list_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return IpAccessControlListInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams IpAccessControlListInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists IpAccessControlListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of IpAccessControlListInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return IpAccessControlListPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of IpAccessControlListInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return IpAccessControlListPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a IpAccessControlListContext - - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - """ - return IpAccessControlListContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a IpAccessControlListContext - - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - """ - return IpAccessControlListContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Trunking.V1.IpAccessControlListList>' - - -class IpAccessControlListPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the IpAccessControlListPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param trunk_sid: The trunk_sid - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListPage - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListPage - """ - super(IpAccessControlListPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of IpAccessControlListInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - """ - return IpAccessControlListInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Trunking.V1.IpAccessControlListPage>' - - -class IpAccessControlListContext(InstanceContext): - """ """ - - def __init__(self, version, trunk_sid, sid): - """ - Initialize the IpAccessControlListContext - - :param Version version: Version that contains the resource - :param trunk_sid: The trunk_sid - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - """ - super(IpAccessControlListContext, self).__init__(version) - - # Path Solution - self._solution = {'trunk_sid': trunk_sid, 'sid': sid, } - self._uri = '/Trunks/{trunk_sid}/IpAccessControlLists/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a IpAccessControlListInstance - - :returns: Fetched IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return IpAccessControlListInstance( - self._version, - payload, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the IpAccessControlListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Trunking.V1.IpAccessControlListContext {}>'.format(context) - - -class IpAccessControlListInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, trunk_sid, sid=None): - """ - Initialize the IpAccessControlListInstance - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - """ - super(IpAccessControlListInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'sid': payload['sid'], - 'trunk_sid': payload['trunk_sid'], - 'friendly_name': payload['friendly_name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'trunk_sid': trunk_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: IpAccessControlListContext for this IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - """ - if self._context is None: - self._context = IpAccessControlListContext( - self._version, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def trunk_sid(self): - """ - :returns: The trunk_sid - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a IpAccessControlListInstance - - :returns: Fetched IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the IpAccessControlListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Trunking.V1.IpAccessControlListInstance {}>'.format(context) diff --git a/twilio/rest/trunking/v1/trunk/origination_url.py b/twilio/rest/trunking/v1/trunk/origination_url.py deleted file mode 100644 index d8fd2c7..0000000 --- a/twilio/rest/trunking/v1/trunk/origination_url.py +++ /dev/null @@ -1,501 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class OriginationUrlList(ListResource): - """ """ - - def __init__(self, version, trunk_sid): - """ - Initialize the OriginationUrlList - - :param Version version: Version that contains the resource - :param trunk_sid: The trunk_sid - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlList - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlList - """ - super(OriginationUrlList, self).__init__(version) - - # Path Solution - self._solution = {'trunk_sid': trunk_sid, } - self._uri = '/Trunks/{trunk_sid}/OriginationUrls'.format(**self._solution) - - def create(self, weight, priority, enabled, friendly_name, sip_url): - """ - Create a new OriginationUrlInstance - - :param unicode weight: The weight - :param unicode priority: The priority - :param bool enabled: The enabled - :param unicode friendly_name: The friendly_name - :param unicode sip_url: The sip_url - - :returns: Newly created OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - """ - data = values.of({ - 'Weight': weight, - 'Priority': priority, - 'Enabled': enabled, - 'FriendlyName': friendly_name, - 'SipUrl': sip_url, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return OriginationUrlInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams OriginationUrlInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists OriginationUrlInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of OriginationUrlInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return OriginationUrlPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of OriginationUrlInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return OriginationUrlPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a OriginationUrlContext - - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - """ - return OriginationUrlContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a OriginationUrlContext - - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - """ - return OriginationUrlContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Trunking.V1.OriginationUrlList>' - - -class OriginationUrlPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the OriginationUrlPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param trunk_sid: The trunk_sid - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlPage - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlPage - """ - super(OriginationUrlPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of OriginationUrlInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - """ - return OriginationUrlInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Trunking.V1.OriginationUrlPage>' - - -class OriginationUrlContext(InstanceContext): - """ """ - - def __init__(self, version, trunk_sid, sid): - """ - Initialize the OriginationUrlContext - - :param Version version: Version that contains the resource - :param trunk_sid: The trunk_sid - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - """ - super(OriginationUrlContext, self).__init__(version) - - # Path Solution - self._solution = {'trunk_sid': trunk_sid, 'sid': sid, } - self._uri = '/Trunks/{trunk_sid}/OriginationUrls/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a OriginationUrlInstance - - :returns: Fetched OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return OriginationUrlInstance( - self._version, - payload, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the OriginationUrlInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def update(self, weight=values.unset, priority=values.unset, - enabled=values.unset, friendly_name=values.unset, - sip_url=values.unset): - """ - Update the OriginationUrlInstance - - :param unicode weight: The weight - :param unicode priority: The priority - :param bool enabled: The enabled - :param unicode friendly_name: The friendly_name - :param unicode sip_url: The sip_url - - :returns: Updated OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - """ - data = values.of({ - 'Weight': weight, - 'Priority': priority, - 'Enabled': enabled, - 'FriendlyName': friendly_name, - 'SipUrl': sip_url, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return OriginationUrlInstance( - self._version, - payload, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Trunking.V1.OriginationUrlContext {}>'.format(context) - - -class OriginationUrlInstance(InstanceResource): - """ """ - - def __init__(self, version, payload, trunk_sid, sid=None): - """ - Initialize the OriginationUrlInstance - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - """ - super(OriginationUrlInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'sid': payload['sid'], - 'trunk_sid': payload['trunk_sid'], - 'weight': deserialize.integer(payload['weight']), - 'enabled': payload['enabled'], - 'sip_url': payload['sip_url'], - 'friendly_name': payload['friendly_name'], - 'priority': deserialize.integer(payload['priority']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'trunk_sid': trunk_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: OriginationUrlContext for this OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - """ - if self._context is None: - self._context = OriginationUrlContext( - self._version, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def trunk_sid(self): - """ - :returns: The trunk_sid - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def weight(self): - """ - :returns: The weight - :rtype: unicode - """ - return self._properties['weight'] - - @property - def enabled(self): - """ - :returns: The enabled - :rtype: bool - """ - return self._properties['enabled'] - - @property - def sip_url(self): - """ - :returns: The sip_url - :rtype: unicode - """ - return self._properties['sip_url'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def priority(self): - """ - :returns: The priority - :rtype: unicode - """ - return self._properties['priority'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a OriginationUrlInstance - - :returns: Fetched OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the OriginationUrlInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, weight=values.unset, priority=values.unset, - enabled=values.unset, friendly_name=values.unset, - sip_url=values.unset): - """ - Update the OriginationUrlInstance - - :param unicode weight: The weight - :param unicode priority: The priority - :param bool enabled: The enabled - :param unicode friendly_name: The friendly_name - :param unicode sip_url: The sip_url - - :returns: Updated OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - """ - return self._proxy.update( - weight=weight, - priority=priority, - enabled=enabled, - friendly_name=friendly_name, - sip_url=sip_url, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Trunking.V1.OriginationUrlInstance {}>'.format(context) diff --git a/twilio/rest/trunking/v1/trunk/phone_number.py b/twilio/rest/trunking/v1/trunk/phone_number.py deleted file mode 100644 index f71c319..0000000 --- a/twilio/rest/trunking/v1/trunk/phone_number.py +++ /dev/null @@ -1,573 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class PhoneNumberList(ListResource): - """ """ - - def __init__(self, version, trunk_sid): - """ - Initialize the PhoneNumberList - - :param Version version: Version that contains the resource - :param trunk_sid: The trunk_sid - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberList - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberList - """ - super(PhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {'trunk_sid': trunk_sid, } - self._uri = '/Trunks/{trunk_sid}/PhoneNumbers'.format(**self._solution) - - def create(self, phone_number_sid): - """ - Create a new PhoneNumberInstance - - :param unicode phone_number_sid: The phone_number_sid - - :returns: Newly created PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - """ - data = values.of({'PhoneNumberSid': phone_number_sid, }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return PhoneNumberInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams PhoneNumberInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PhoneNumberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PhoneNumberInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return PhoneNumberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PhoneNumberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PhoneNumberPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a PhoneNumberContext - - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a PhoneNumberContext - - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Trunking.V1.PhoneNumberList>' - - -class PhoneNumberPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the PhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param trunk_sid: The trunk_sid - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberPage - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberPage - """ - super(PhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - """ - return PhoneNumberInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Trunking.V1.PhoneNumberPage>' - - -class PhoneNumberContext(InstanceContext): - """ """ - - def __init__(self, version, trunk_sid, sid): - """ - Initialize the PhoneNumberContext - - :param Version version: Version that contains the resource - :param trunk_sid: The trunk_sid - :param sid: The sid - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - """ - super(PhoneNumberContext, self).__init__(version) - - # Path Solution - self._solution = {'trunk_sid': trunk_sid, 'sid': sid, } - self._uri = '/Trunks/{trunk_sid}/PhoneNumbers/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a PhoneNumberInstance - - :returns: Fetched PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return PhoneNumberInstance( - self._version, - payload, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the PhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Trunking.V1.PhoneNumberContext {}>'.format(context) - - -class PhoneNumberInstance(InstanceResource): - """ """ - - class AddressRequirement(object): - NONE = "none" - ANY = "any" - LOCAL = "local" - FOREIGN = "foreign" - - def __init__(self, version, payload, trunk_sid, sid=None): - """ - Initialize the PhoneNumberInstance - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - """ - super(PhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'address_requirements': payload['address_requirements'], - 'api_version': payload['api_version'], - 'beta': payload['beta'], - 'capabilities': payload['capabilities'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'friendly_name': payload['friendly_name'], - 'links': payload['links'], - 'phone_number': payload['phone_number'], - 'sid': payload['sid'], - 'sms_application_sid': payload['sms_application_sid'], - 'sms_fallback_method': payload['sms_fallback_method'], - 'sms_fallback_url': payload['sms_fallback_url'], - 'sms_method': payload['sms_method'], - 'sms_url': payload['sms_url'], - 'status_callback': payload['status_callback'], - 'status_callback_method': payload['status_callback_method'], - 'trunk_sid': payload['trunk_sid'], - 'url': payload['url'], - 'voice_application_sid': payload['voice_application_sid'], - 'voice_caller_id_lookup': payload['voice_caller_id_lookup'], - 'voice_fallback_method': payload['voice_fallback_method'], - 'voice_fallback_url': payload['voice_fallback_url'], - 'voice_method': payload['voice_method'], - 'voice_url': payload['voice_url'], - } - - # Context - self._context = None - self._solution = {'trunk_sid': trunk_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PhoneNumberContext for this PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - """ - if self._context is None: - self._context = PhoneNumberContext( - self._version, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def address_requirements(self): - """ - :returns: The address_requirements - :rtype: PhoneNumberInstance.AddressRequirement - """ - return self._properties['address_requirements'] - - @property - def api_version(self): - """ - :returns: The api_version - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def beta(self): - """ - :returns: The beta - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: The capabilities - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def phone_number(self): - """ - :returns: The phone_number - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_application_sid(self): - """ - :returns: The sms_application_sid - :rtype: unicode - """ - return self._properties['sms_application_sid'] - - @property - def sms_fallback_method(self): - """ - :returns: The sms_fallback_method - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The sms_method - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The sms_url - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def status_callback(self): - """ - :returns: The status_callback - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The status_callback_method - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def trunk_sid(self): - """ - :returns: The trunk_sid - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def voice_application_sid(self): - """ - :returns: The voice_application_sid - :rtype: unicode - """ - return self._properties['voice_application_sid'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: The voice_caller_id_lookup - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def voice_fallback_method(self): - """ - :returns: The voice_fallback_method - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The voice_method - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: The voice_url - :rtype: unicode - """ - return self._properties['voice_url'] - - def fetch(self): - """ - Fetch a PhoneNumberInstance - - :returns: Fetched PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the PhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Trunking.V1.PhoneNumberInstance {}>'.format(context) diff --git a/twilio/rest/video/__init__.py b/twilio/rest/video/__init__.py deleted file mode 100644 index 35a9261..0000000 --- a/twilio/rest/video/__init__.py +++ /dev/null @@ -1,67 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.video.v1 import V1 - - -class Video(Domain): - - def __init__(self, twilio): - """ - Initialize the Video Domain - - :returns: Domain for Video - :rtype: twilio.rest.video.Video - """ - super(Video, self).__init__(twilio) - - self.base_url = 'https://video.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of video - :rtype: twilio.rest.video.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def compositions(self): - """ - :rtype: twilio.rest.video.v1.composition.CompositionList - """ - return self.v1.compositions - - @property - def recordings(self): - """ - :rtype: twilio.rest.video.v1.recording.RecordingList - """ - return self.v1.recordings - - @property - def rooms(self): - """ - :rtype: twilio.rest.video.v1.room.RoomList - """ - return self.v1.rooms - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video>' diff --git a/twilio/rest/video/__pycache__/__init__.cpython-36.pyc b/twilio/rest/video/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 76f561f..0000000 Binary files a/twilio/rest/video/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/video/v1/__init__.py b/twilio/rest/video/v1/__init__.py deleted file mode 100644 index 0925ebf..0000000 --- a/twilio/rest/video/v1/__init__.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.video.v1.composition import CompositionList -from twilio.rest.video.v1.recording import RecordingList -from twilio.rest.video.v1.room import RoomList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Video - - :returns: V1 version of Video - :rtype: twilio.rest.video.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._compositions = None - self._recordings = None - self._rooms = None - - @property - def compositions(self): - """ - :rtype: twilio.rest.video.v1.composition.CompositionList - """ - if self._compositions is None: - self._compositions = CompositionList(self) - return self._compositions - - @property - def recordings(self): - """ - :rtype: twilio.rest.video.v1.recording.RecordingList - """ - if self._recordings is None: - self._recordings = RecordingList(self) - return self._recordings - - @property - def rooms(self): - """ - :rtype: twilio.rest.video.v1.room.RoomList - """ - if self._rooms is None: - self._rooms = RoomList(self) - return self._rooms - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1>' diff --git a/twilio/rest/video/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/video/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index f3469fa..0000000 Binary files a/twilio/rest/video/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/video/v1/composition/__init__.py b/twilio/rest/video/v1/composition/__init__.py deleted file mode 100644 index ff87d01..0000000 --- a/twilio/rest/video/v1/composition/__init__.py +++ /dev/null @@ -1,551 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class CompositionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the CompositionList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.video.v1.composition.CompositionList - :rtype: twilio.rest.video.v1.composition.CompositionList - """ - super(CompositionList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Compositions'.format(**self._solution) - - def stream(self, status=values.unset, date_created_after=values.unset, - date_created_before=values.unset, limit=None, page_size=None): - """ - Streams CompositionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param CompositionInstance.Status status: The status - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.composition.CompositionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - date_created_after=date_created_after, - date_created_before=date_created_before, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, status=values.unset, date_created_after=values.unset, - date_created_before=values.unset, limit=None, page_size=None): - """ - Lists CompositionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param CompositionInstance.Status status: The status - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.composition.CompositionInstance] - """ - return list(self.stream( - status=status, - date_created_after=date_created_after, - date_created_before=date_created_before, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, date_created_after=values.unset, - date_created_before=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of CompositionInstance records from the API. - Request is executed immediately - - :param CompositionInstance.Status status: The status - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionPage - """ - params = values.of({ - 'Status': status, - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CompositionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CompositionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CompositionPage(self._version, response, self._solution) - - def create(self, audio_sources=values.unset, video_sources=values.unset, - video_layout=values.unset, resolution=values.unset, - format=values.unset, desired_bitrate=values.unset, - desired_max_duration=values.unset, status_callback=values.unset, - status_callback_method=values.unset, trim=values.unset, - reuse=values.unset): - """ - Create a new CompositionInstance - - :param unicode audio_sources: The audio_sources - :param unicode video_sources: The video_sources - :param CompositionInstance.VideoLayout video_layout: The video_layout - :param unicode resolution: The resolution - :param CompositionInstance.Format format: The format - :param unicode desired_bitrate: The desired_bitrate - :param unicode desired_max_duration: The desired_max_duration - :param unicode status_callback: The status_callback - :param unicode status_callback_method: The status_callback_method - :param bool trim: The trim - :param bool reuse: The reuse - - :returns: Newly created CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionInstance - """ - data = values.of({ - 'AudioSources': serialize.map(audio_sources, lambda e: e), - 'VideoSources': serialize.map(video_sources, lambda e: e), - 'VideoLayout': video_layout, - 'Resolution': resolution, - 'Format': format, - 'DesiredBitrate': desired_bitrate, - 'DesiredMaxDuration': desired_max_duration, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'Trim': trim, - 'Reuse': reuse, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CompositionInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a CompositionContext - - :param sid: The sid - - :returns: twilio.rest.video.v1.composition.CompositionContext - :rtype: twilio.rest.video.v1.composition.CompositionContext - """ - return CompositionContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CompositionContext - - :param sid: The sid - - :returns: twilio.rest.video.v1.composition.CompositionContext - :rtype: twilio.rest.video.v1.composition.CompositionContext - """ - return CompositionContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.CompositionList>' - - -class CompositionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the CompositionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.video.v1.composition.CompositionPage - :rtype: twilio.rest.video.v1.composition.CompositionPage - """ - super(CompositionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CompositionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.composition.CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionInstance - """ - return CompositionInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.CompositionPage>' - - -class CompositionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the CompositionContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.video.v1.composition.CompositionContext - :rtype: twilio.rest.video.v1.composition.CompositionContext - """ - super(CompositionContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Compositions/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a CompositionInstance - - :returns: Fetched CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CompositionInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the CompositionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Video.V1.CompositionContext {}>'.format(context) - - -class CompositionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - PROCESSING = "processing" - COMPLETED = "completed" - DELETED = "deleted" - FAILED = "failed" - - class Format(object): - MKA = "mka" - MP3 = "mp3" - M4A = "m4a" - MKV = "mkv" - MP4 = "mp4" - WEBM = "webm" - - class VideoLayout(object): - GRID = "grid" - SINGLE = "single" - PIP = "pip" - SEQUENCE = "sequence" - - def __init__(self, version, payload, sid=None): - """ - Initialize the CompositionInstance - - :returns: twilio.rest.video.v1.composition.CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionInstance - """ - super(CompositionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'status': payload['status'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_completed': payload['date_completed'], - 'date_deleted': payload['date_deleted'], - 'sid': payload['sid'], - 'audio_sources': payload['audio_sources'], - 'video_sources': payload['video_sources'], - 'video_layout': payload['video_layout'], - 'resolution': payload['resolution'], - 'format': payload['format'], - 'bitrate': deserialize.integer(payload['bitrate']), - 'size': deserialize.integer(payload['size']), - 'duration': deserialize.integer(payload['duration']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CompositionContext for this CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionContext - """ - if self._context is None: - self._context = CompositionContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: CompositionInstance.Status - """ - return self._properties['status'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_completed(self): - """ - :returns: The date_completed - :rtype: unicode - """ - return self._properties['date_completed'] - - @property - def date_deleted(self): - """ - :returns: The date_deleted - :rtype: unicode - """ - return self._properties['date_deleted'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def audio_sources(self): - """ - :returns: The audio_sources - :rtype: unicode - """ - return self._properties['audio_sources'] - - @property - def video_sources(self): - """ - :returns: The video_sources - :rtype: unicode - """ - return self._properties['video_sources'] - - @property - def video_layout(self): - """ - :returns: The video_layout - :rtype: CompositionInstance.VideoLayout - """ - return self._properties['video_layout'] - - @property - def resolution(self): - """ - :returns: The resolution - :rtype: unicode - """ - return self._properties['resolution'] - - @property - def format(self): - """ - :returns: The format - :rtype: CompositionInstance.Format - """ - return self._properties['format'] - - @property - def bitrate(self): - """ - :returns: The bitrate - :rtype: unicode - """ - return self._properties['bitrate'] - - @property - def size(self): - """ - :returns: The size - :rtype: unicode - """ - return self._properties['size'] - - @property - def duration(self): - """ - :returns: The duration - :rtype: unicode - """ - return self._properties['duration'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a CompositionInstance - - :returns: Fetched CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the CompositionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Video.V1.CompositionInstance {}>'.format(context) diff --git a/twilio/rest/video/v1/composition/__pycache__/__init__.cpython-36.pyc b/twilio/rest/video/v1/composition/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index d19db7a..0000000 Binary files a/twilio/rest/video/v1/composition/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/video/v1/recording/__init__.py b/twilio/rest/video/v1/recording/__init__.py deleted file mode 100644 index fa67dcf..0000000 --- a/twilio/rest/video/v1/recording/__init__.py +++ /dev/null @@ -1,495 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class RecordingList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the RecordingList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.video.v1.recording.RecordingList - :rtype: twilio.rest.video.v1.recording.RecordingList - """ - super(RecordingList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Recordings'.format(**self._solution) - - def stream(self, status=values.unset, source_sid=values.unset, - grouping_sid=values.unset, date_created_after=values.unset, - date_created_before=values.unset, limit=None, page_size=None): - """ - Streams RecordingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param RecordingInstance.Status status: The status - :param unicode source_sid: The source_sid - :param unicode grouping_sid: The grouping_sid - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.recording.RecordingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - source_sid=source_sid, - grouping_sid=grouping_sid, - date_created_after=date_created_after, - date_created_before=date_created_before, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, status=values.unset, source_sid=values.unset, - grouping_sid=values.unset, date_created_after=values.unset, - date_created_before=values.unset, limit=None, page_size=None): - """ - Lists RecordingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param RecordingInstance.Status status: The status - :param unicode source_sid: The source_sid - :param unicode grouping_sid: The grouping_sid - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.recording.RecordingInstance] - """ - return list(self.stream( - status=status, - source_sid=source_sid, - grouping_sid=grouping_sid, - date_created_after=date_created_after, - date_created_before=date_created_before, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, source_sid=values.unset, - grouping_sid=values.unset, date_created_after=values.unset, - date_created_before=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of RecordingInstance records from the API. - Request is executed immediately - - :param RecordingInstance.Status status: The status - :param unicode source_sid: The source_sid - :param unicode grouping_sid: The grouping_sid - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingPage - """ - params = values.of({ - 'Status': status, - 'SourceSid': source_sid, - 'GroupingSid': serialize.map(grouping_sid, lambda e: e), - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return RecordingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RecordingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RecordingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RecordingContext - - :param sid: The sid - - :returns: twilio.rest.video.v1.recording.RecordingContext - :rtype: twilio.rest.video.v1.recording.RecordingContext - """ - return RecordingContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RecordingContext - - :param sid: The sid - - :returns: twilio.rest.video.v1.recording.RecordingContext - :rtype: twilio.rest.video.v1.recording.RecordingContext - """ - return RecordingContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.RecordingList>' - - -class RecordingPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the RecordingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.video.v1.recording.RecordingPage - :rtype: twilio.rest.video.v1.recording.RecordingPage - """ - super(RecordingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RecordingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.recording.RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingInstance - """ - return RecordingInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.RecordingPage>' - - -class RecordingContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the RecordingContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.video.v1.recording.RecordingContext - :rtype: twilio.rest.video.v1.recording.RecordingContext - """ - super(RecordingContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Recordings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a RecordingInstance - - :returns: Fetched RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return RecordingInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the RecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Video.V1.RecordingContext {}>'.format(context) - - -class RecordingInstance(InstanceResource): - """ """ - - class Status(object): - PROCESSING = "processing" - COMPLETED = "completed" - DELETED = "deleted" - FAILED = "failed" - - class Type(object): - AUDIO = "audio" - VIDEO = "video" - DATA = "data" - - class Format(object): - MKA = "mka" - MKV = "mkv" - - class Codec(object): - VP8 = "VP8" - H264 = "H264" - OPUS = "OPUS" - PCMU = "PCMU" - - def __init__(self, version, payload, sid=None): - """ - Initialize the RecordingInstance - - :returns: twilio.rest.video.v1.recording.RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingInstance - """ - super(RecordingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'status': payload['status'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'sid': payload['sid'], - 'source_sid': payload['source_sid'], - 'size': deserialize.integer(payload['size']), - 'url': payload['url'], - 'type': payload['type'], - 'duration': deserialize.integer(payload['duration']), - 'container_format': payload['container_format'], - 'codec': payload['codec'], - 'grouping_sids': payload['grouping_sids'], - 'track_name': payload['track_name'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RecordingContext for this RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingContext - """ - if self._context is None: - self._context = RecordingContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: RecordingInstance.Status - """ - return self._properties['status'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def source_sid(self): - """ - :returns: The source_sid - :rtype: unicode - """ - return self._properties['source_sid'] - - @property - def size(self): - """ - :returns: The size - :rtype: unicode - """ - return self._properties['size'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def type(self): - """ - :returns: The type - :rtype: RecordingInstance.Type - """ - return self._properties['type'] - - @property - def duration(self): - """ - :returns: The duration - :rtype: unicode - """ - return self._properties['duration'] - - @property - def container_format(self): - """ - :returns: The container_format - :rtype: RecordingInstance.Format - """ - return self._properties['container_format'] - - @property - def codec(self): - """ - :returns: The codec - :rtype: RecordingInstance.Codec - """ - return self._properties['codec'] - - @property - def grouping_sids(self): - """ - :returns: The grouping_sids - :rtype: dict - """ - return self._properties['grouping_sids'] - - @property - def track_name(self): - """ - :returns: The track_name - :rtype: unicode - """ - return self._properties['track_name'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a RecordingInstance - - :returns: Fetched RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the RecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Video.V1.RecordingInstance {}>'.format(context) diff --git a/twilio/rest/video/v1/recording/__pycache__/__init__.cpython-36.pyc b/twilio/rest/video/v1/recording/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 456c9bd..0000000 Binary files a/twilio/rest/video/v1/recording/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py deleted file mode 100644 index e695531..0000000 --- a/twilio/rest/video/v1/room/__init__.py +++ /dev/null @@ -1,620 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.video.v1.room.recording import RoomRecordingList -from twilio.rest.video.v1.room.room_participant import ParticipantList - - -class RoomList(ListResource): - """ """ - - def __init__(self, version): - """ - Initialize the RoomList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.video.v1.room.RoomList - :rtype: twilio.rest.video.v1.room.RoomList - """ - super(RoomList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Rooms'.format(**self._solution) - - def create(self, enable_turn=values.unset, type=values.unset, - unique_name=values.unset, status_callback=values.unset, - status_callback_method=values.unset, max_participants=values.unset, - record_participants_on_connect=values.unset, - video_codecs=values.unset, media_region=values.unset): - """ - Create a new RoomInstance - - :param bool enable_turn: The enable_turn - :param RoomInstance.RoomType type: The type - :param unicode unique_name: The unique_name - :param unicode status_callback: The status_callback - :param unicode status_callback_method: The status_callback_method - :param unicode max_participants: The max_participants - :param bool record_participants_on_connect: The record_participants_on_connect - :param RoomInstance.VideoCodec video_codecs: The video_codecs - :param unicode media_region: The media_region - - :returns: Newly created RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance - """ - data = values.of({ - 'EnableTurn': enable_turn, - 'Type': type, - 'UniqueName': unique_name, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'MaxParticipants': max_participants, - 'RecordParticipantsOnConnect': record_participants_on_connect, - 'VideoCodecs': serialize.map(video_codecs, lambda e: e), - 'MediaRegion': media_region, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return RoomInstance(self._version, payload, ) - - def stream(self, status=values.unset, unique_name=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - limit=None, page_size=None): - """ - Streams RoomInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param RoomInstance.RoomStatus status: The status - :param unicode unique_name: The unique_name - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.RoomInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - unique_name=unique_name, - date_created_after=date_created_after, - date_created_before=date_created_before, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, status=values.unset, unique_name=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - limit=None, page_size=None): - """ - Lists RoomInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param RoomInstance.RoomStatus status: The status - :param unicode unique_name: The unique_name - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.RoomInstance] - """ - return list(self.stream( - status=status, - unique_name=unique_name, - date_created_after=date_created_after, - date_created_before=date_created_before, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, unique_name=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RoomInstance records from the API. - Request is executed immediately - - :param RoomInstance.RoomStatus status: The status - :param unicode unique_name: The unique_name - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RoomInstance - :rtype: twilio.rest.video.v1.room.RoomPage - """ - params = values.of({ - 'Status': status, - 'UniqueName': unique_name, - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return RoomPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RoomInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RoomInstance - :rtype: twilio.rest.video.v1.room.RoomPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RoomPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RoomContext - - :param sid: The sid - - :returns: twilio.rest.video.v1.room.RoomContext - :rtype: twilio.rest.video.v1.room.RoomContext - """ - return RoomContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RoomContext - - :param sid: The sid - - :returns: twilio.rest.video.v1.room.RoomContext - :rtype: twilio.rest.video.v1.room.RoomContext - """ - return RoomContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.RoomList>' - - -class RoomPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the RoomPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.video.v1.room.RoomPage - :rtype: twilio.rest.video.v1.room.RoomPage - """ - super(RoomPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RoomInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.room.RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance - """ - return RoomInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.RoomPage>' - - -class RoomContext(InstanceContext): - """ """ - - def __init__(self, version, sid): - """ - Initialize the RoomContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.video.v1.room.RoomContext - :rtype: twilio.rest.video.v1.room.RoomContext - """ - super(RoomContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Rooms/{sid}'.format(**self._solution) - - # Dependents - self._recordings = None - self._participants = None - - def fetch(self): - """ - Fetch a RoomInstance - - :returns: Fetched RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return RoomInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, status): - """ - Update the RoomInstance - - :param RoomInstance.RoomStatus status: The status - - :returns: Updated RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance - """ - data = values.of({'Status': status, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return RoomInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def recordings(self): - """ - Access the recordings - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingList - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingList - """ - if self._recordings is None: - self._recordings = RoomRecordingList(self._version, room_sid=self._solution['sid'], ) - return self._recordings - - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantList - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantList - """ - if self._participants is None: - self._participants = ParticipantList(self._version, room_sid=self._solution['sid'], ) - return self._participants - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Video.V1.RoomContext {}>'.format(context) - - -class RoomInstance(InstanceResource): - """ """ - - class RoomStatus(object): - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - FAILED = "failed" - - class RoomType(object): - PEER_TO_PEER = "peer-to-peer" - GROUP = "group" - - class VideoCodec(object): - VP8 = "VP8" - H264 = "H264" - - def __init__(self, version, payload, sid=None): - """ - Initialize the RoomInstance - - :returns: twilio.rest.video.v1.room.RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance - """ - super(RoomInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'status': payload['status'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'account_sid': payload['account_sid'], - 'enable_turn': payload['enable_turn'], - 'unique_name': payload['unique_name'], - 'status_callback': payload['status_callback'], - 'status_callback_method': payload['status_callback_method'], - 'end_time': deserialize.iso8601_datetime(payload['end_time']), - 'duration': deserialize.integer(payload['duration']), - 'type': payload['type'], - 'max_participants': deserialize.integer(payload['max_participants']), - 'record_participants_on_connect': payload['record_participants_on_connect'], - 'video_codecs': payload['video_codecs'], - 'media_region': payload['media_region'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoomContext for this RoomInstance - :rtype: twilio.rest.video.v1.room.RoomContext - """ - if self._context is None: - self._context = RoomContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: RoomInstance.RoomStatus - """ - return self._properties['status'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def enable_turn(self): - """ - :returns: The enable_turn - :rtype: bool - """ - return self._properties['enable_turn'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def status_callback(self): - """ - :returns: The status_callback - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The status_callback_method - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def end_time(self): - """ - :returns: The end_time - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def duration(self): - """ - :returns: The duration - :rtype: unicode - """ - return self._properties['duration'] - - @property - def type(self): - """ - :returns: The type - :rtype: RoomInstance.RoomType - """ - return self._properties['type'] - - @property - def max_participants(self): - """ - :returns: The max_participants - :rtype: unicode - """ - return self._properties['max_participants'] - - @property - def record_participants_on_connect(self): - """ - :returns: The record_participants_on_connect - :rtype: bool - """ - return self._properties['record_participants_on_connect'] - - @property - def video_codecs(self): - """ - :returns: The video_codecs - :rtype: RoomInstance.VideoCodec - """ - return self._properties['video_codecs'] - - @property - def media_region(self): - """ - :returns: The media_region - :rtype: unicode - """ - return self._properties['media_region'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a RoomInstance - - :returns: Fetched RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance - """ - return self._proxy.fetch() - - def update(self, status): - """ - Update the RoomInstance - - :param RoomInstance.RoomStatus status: The status - - :returns: Updated RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance - """ - return self._proxy.update(status, ) - - @property - def recordings(self): - """ - Access the recordings - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingList - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingList - """ - return self._proxy.recordings - - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantList - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantList - """ - return self._proxy.participants - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Video.V1.RoomInstance {}>'.format(context) diff --git a/twilio/rest/video/v1/room/__pycache__/__init__.cpython-36.pyc b/twilio/rest/video/v1/room/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 236fe2f..0000000 Binary files a/twilio/rest/video/v1/room/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/video/v1/room/recording/__init__.py b/twilio/rest/video/v1/room/recording/__init__.py deleted file mode 100644 index d88879a..0000000 --- a/twilio/rest/video/v1/room/recording/__init__.py +++ /dev/null @@ -1,483 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class RoomRecordingList(ListResource): - """ """ - - def __init__(self, version, room_sid): - """ - Initialize the RoomRecordingList - - :param Version version: Version that contains the resource - :param room_sid: The room_sid - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingList - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingList - """ - super(RoomRecordingList, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, } - self._uri = '/Rooms/{room_sid}/Recordings'.format(**self._solution) - - def stream(self, status=values.unset, source_sid=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - limit=None, page_size=None): - """ - Streams RoomRecordingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param RoomRecordingInstance.Status status: The status - :param unicode source_sid: The source_sid - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.recording.RoomRecordingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - source_sid=source_sid, - date_created_after=date_created_after, - date_created_before=date_created_before, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, status=values.unset, source_sid=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - limit=None, page_size=None): - """ - Lists RoomRecordingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param RoomRecordingInstance.Status status: The status - :param unicode source_sid: The source_sid - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.recording.RoomRecordingInstance] - """ - return list(self.stream( - status=status, - source_sid=source_sid, - date_created_after=date_created_after, - date_created_before=date_created_before, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, source_sid=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RoomRecordingInstance records from the API. - Request is executed immediately - - :param RoomRecordingInstance.Status status: The status - :param unicode source_sid: The source_sid - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingPage - """ - params = values.of({ - 'Status': status, - 'SourceSid': source_sid, - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return RoomRecordingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RoomRecordingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RoomRecordingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RoomRecordingContext - - :param sid: The sid - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingContext - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingContext - """ - return RoomRecordingContext(self._version, room_sid=self._solution['room_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RoomRecordingContext - - :param sid: The sid - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingContext - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingContext - """ - return RoomRecordingContext(self._version, room_sid=self._solution['room_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.RoomRecordingList>' - - -class RoomRecordingPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the RoomRecordingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param room_sid: The room_sid - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingPage - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingPage - """ - super(RoomRecordingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RoomRecordingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingInstance - """ - return RoomRecordingInstance(self._version, payload, room_sid=self._solution['room_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.RoomRecordingPage>' - - -class RoomRecordingContext(InstanceContext): - """ """ - - def __init__(self, version, room_sid, sid): - """ - Initialize the RoomRecordingContext - - :param Version version: Version that contains the resource - :param room_sid: The room_sid - :param sid: The sid - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingContext - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingContext - """ - super(RoomRecordingContext, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'sid': sid, } - self._uri = '/Rooms/{room_sid}/Recordings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a RoomRecordingInstance - - :returns: Fetched RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return RoomRecordingInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Video.V1.RoomRecordingContext {}>'.format(context) - - -class RoomRecordingInstance(InstanceResource): - """ """ - - class Status(object): - PROCESSING = "processing" - COMPLETED = "completed" - DELETED = "deleted" - FAILED = "failed" - - class Type(object): - AUDIO = "audio" - VIDEO = "video" - DATA = "data" - - class Format(object): - MKA = "mka" - MKV = "mkv" - - class Codec(object): - VP8 = "VP8" - H264 = "H264" - OPUS = "OPUS" - PCMU = "PCMU" - - def __init__(self, version, payload, room_sid, sid=None): - """ - Initialize the RoomRecordingInstance - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingInstance - """ - super(RoomRecordingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload['account_sid'], - 'status': payload['status'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'sid': payload['sid'], - 'source_sid': payload['source_sid'], - 'size': deserialize.integer(payload['size']), - 'type': payload['type'], - 'duration': deserialize.integer(payload['duration']), - 'container_format': payload['container_format'], - 'codec': payload['codec'], - 'grouping_sids': payload['grouping_sids'], - 'room_sid': payload['room_sid'], - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'room_sid': room_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoomRecordingContext for this RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingContext - """ - if self._context is None: - self._context = RoomRecordingContext( - self._version, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: RoomRecordingInstance.Status - """ - return self._properties['status'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def source_sid(self): - """ - :returns: The source_sid - :rtype: unicode - """ - return self._properties['source_sid'] - - @property - def size(self): - """ - :returns: The size - :rtype: unicode - """ - return self._properties['size'] - - @property - def type(self): - """ - :returns: The type - :rtype: RoomRecordingInstance.Type - """ - return self._properties['type'] - - @property - def duration(self): - """ - :returns: The duration - :rtype: unicode - """ - return self._properties['duration'] - - @property - def container_format(self): - """ - :returns: The container_format - :rtype: RoomRecordingInstance.Format - """ - return self._properties['container_format'] - - @property - def codec(self): - """ - :returns: The codec - :rtype: RoomRecordingInstance.Codec - """ - return self._properties['codec'] - - @property - def grouping_sids(self): - """ - :returns: The grouping_sids - :rtype: dict - """ - return self._properties['grouping_sids'] - - @property - def room_sid(self): - """ - :returns: The room_sid - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a RoomRecordingInstance - - :returns: Fetched RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Video.V1.RoomRecordingInstance {}>'.format(context) diff --git a/twilio/rest/video/v1/room/recording/__pycache__/__init__.cpython-36.pyc b/twilio/rest/video/v1/room/recording/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 6da23e0..0000000 Binary files a/twilio/rest/video/v1/room/recording/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/video/v1/room/room_participant/__init__.py b/twilio/rest/video/v1/room/room_participant/__init__.py deleted file mode 100644 index aa61889..0000000 --- a/twilio/rest/video/v1/room/room_participant/__init__.py +++ /dev/null @@ -1,541 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page -from twilio.rest.video.v1.room.room_participant.room_participant_published_track import PublishedTrackList -from twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track import SubscribedTrackList - - -class ParticipantList(ListResource): - """ """ - - def __init__(self, version, room_sid): - """ - Initialize the ParticipantList - - :param Version version: Version that contains the resource - :param room_sid: The room_sid - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantList - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantList - """ - super(ParticipantList, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, } - self._uri = '/Rooms/{room_sid}/Participants'.format(**self._solution) - - def stream(self, status=values.unset, identity=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - limit=None, page_size=None): - """ - Streams ParticipantInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param ParticipantInstance.Status status: The status - :param unicode identity: The identity - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.room_participant.ParticipantInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - identity=identity, - date_created_after=date_created_after, - date_created_before=date_created_before, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, status=values.unset, identity=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - limit=None, page_size=None): - """ - Lists ParticipantInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param ParticipantInstance.Status status: The status - :param unicode identity: The identity - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.room_participant.ParticipantInstance] - """ - return list(self.stream( - status=status, - identity=identity, - date_created_after=date_created_after, - date_created_before=date_created_before, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, identity=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ParticipantInstance records from the API. - Request is executed immediately - - :param ParticipantInstance.Status status: The status - :param unicode identity: The identity - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantPage - """ - params = values.of({ - 'Status': status, - 'Identity': identity, - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return ParticipantPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ParticipantInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ParticipantPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ParticipantContext - - :param sid: The sid - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantContext - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantContext - """ - return ParticipantContext(self._version, room_sid=self._solution['room_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ParticipantContext - - :param sid: The sid - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantContext - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantContext - """ - return ParticipantContext(self._version, room_sid=self._solution['room_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.ParticipantList>' - - -class ParticipantPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the ParticipantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param room_sid: The room_sid - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantPage - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantPage - """ - super(ParticipantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ParticipantInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantInstance - """ - return ParticipantInstance(self._version, payload, room_sid=self._solution['room_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.ParticipantPage>' - - -class ParticipantContext(InstanceContext): - """ """ - - def __init__(self, version, room_sid, sid): - """ - Initialize the ParticipantContext - - :param Version version: Version that contains the resource - :param room_sid: The room_sid - :param sid: The sid - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantContext - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantContext - """ - super(ParticipantContext, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'sid': sid, } - self._uri = '/Rooms/{room_sid}/Participants/{sid}'.format(**self._solution) - - # Dependents - self._published_tracks = None - self._subscribed_tracks = None - - def fetch(self): - """ - Fetch a ParticipantInstance - - :returns: Fetched ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return ParticipantInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - - def update(self, status=values.unset): - """ - Update the ParticipantInstance - - :param ParticipantInstance.Status status: The status - - :returns: Updated ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantInstance - """ - data = values.of({'Status': status, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return ParticipantInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - - @property - def published_tracks(self): - """ - Access the published_tracks - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackList - """ - if self._published_tracks is None: - self._published_tracks = PublishedTrackList( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['sid'], - ) - return self._published_tracks - - @property - def subscribed_tracks(self): - """ - Access the subscribed_tracks - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackList - """ - if self._subscribed_tracks is None: - self._subscribed_tracks = SubscribedTrackList( - self._version, - room_sid=self._solution['room_sid'], - subscriber_sid=self._solution['sid'], - ) - return self._subscribed_tracks - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Video.V1.ParticipantContext {}>'.format(context) - - -class ParticipantInstance(InstanceResource): - """ """ - - class Status(object): - CONNECTED = "connected" - DISCONNECTED = "disconnected" - - def __init__(self, version, payload, room_sid, sid=None): - """ - Initialize the ParticipantInstance - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantInstance - """ - super(ParticipantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'room_sid': payload['room_sid'], - 'account_sid': payload['account_sid'], - 'status': payload['status'], - 'identity': payload['identity'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'start_time': deserialize.iso8601_datetime(payload['start_time']), - 'end_time': deserialize.iso8601_datetime(payload['end_time']), - 'duration': deserialize.integer(payload['duration']), - 'url': payload['url'], - 'links': payload['links'], - } - - # Context - self._context = None - self._solution = {'room_sid': room_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ParticipantContext for this ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantContext - """ - if self._context is None: - self._context = ParticipantContext( - self._version, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def room_sid(self): - """ - :returns: The room_sid - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: ParticipantInstance.Status - """ - return self._properties['status'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def start_time(self): - """ - :returns: The start_time - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The end_time - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def duration(self): - """ - :returns: The duration - :rtype: unicode - """ - return self._properties['duration'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch a ParticipantInstance - - :returns: Fetched ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantInstance - """ - return self._proxy.fetch() - - def update(self, status=values.unset): - """ - Update the ParticipantInstance - - :param ParticipantInstance.Status status: The status - - :returns: Updated ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantInstance - """ - return self._proxy.update(status=status, ) - - @property - def published_tracks(self): - """ - Access the published_tracks - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackList - """ - return self._proxy.published_tracks - - @property - def subscribed_tracks(self): - """ - Access the subscribed_tracks - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackList - """ - return self._proxy.subscribed_tracks - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Video.V1.ParticipantInstance {}>'.format(context) diff --git a/twilio/rest/video/v1/room/room_participant/__pycache__/__init__.cpython-36.pyc b/twilio/rest/video/v1/room/room_participant/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 4c18a01..0000000 Binary files a/twilio/rest/video/v1/room/room_participant/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/video/v1/room/room_participant/__pycache__/room_participant_published_track.cpython-36.pyc b/twilio/rest/video/v1/room/room_participant/__pycache__/room_participant_published_track.cpython-36.pyc deleted file mode 100644 index 9fa7fd4..0000000 Binary files a/twilio/rest/video/v1/room/room_participant/__pycache__/room_participant_published_track.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/video/v1/room/room_participant/__pycache__/room_participant_subscribed_track.cpython-36.pyc b/twilio/rest/video/v1/room/room_participant/__pycache__/room_participant_subscribed_track.cpython-36.pyc deleted file mode 100644 index 72838cf..0000000 Binary files a/twilio/rest/video/v1/room/room_participant/__pycache__/room_participant_subscribed_track.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/video/v1/room/room_participant/room_participant_published_track.py b/twilio/rest/video/v1/room/room_participant/room_participant_published_track.py deleted file mode 100644 index 2e07efd..0000000 --- a/twilio/rest/video/v1/room/room_participant/room_participant_published_track.py +++ /dev/null @@ -1,406 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class PublishedTrackList(ListResource): - """ """ - - def __init__(self, version, room_sid, participant_sid): - """ - Initialize the PublishedTrackList - - :param Version version: Version that contains the resource - :param room_sid: The room_sid - :param participant_sid: The participant_sid - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackList - """ - super(PublishedTrackList, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'participant_sid': participant_sid, } - self._uri = '/Rooms/{room_sid}/Participants/{participant_sid}/PublishedTracks'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams PublishedTrackInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PublishedTrackInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PublishedTrackInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return PublishedTrackPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PublishedTrackInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PublishedTrackPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a PublishedTrackContext - - :param sid: The sid - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - """ - return PublishedTrackContext( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a PublishedTrackContext - - :param sid: The sid - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - """ - return PublishedTrackContext( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.PublishedTrackList>' - - -class PublishedTrackPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the PublishedTrackPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param room_sid: The room_sid - :param participant_sid: The participant_sid - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackPage - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackPage - """ - super(PublishedTrackPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PublishedTrackInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance - """ - return PublishedTrackInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.PublishedTrackPage>' - - -class PublishedTrackContext(InstanceContext): - """ """ - - def __init__(self, version, room_sid, participant_sid, sid): - """ - Initialize the PublishedTrackContext - - :param Version version: Version that contains the resource - :param room_sid: The room_sid - :param participant_sid: The participant_sid - :param sid: The sid - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - """ - super(PublishedTrackContext, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'participant_sid': participant_sid, 'sid': sid, } - self._uri = '/Rooms/{room_sid}/Participants/{participant_sid}/PublishedTracks/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a PublishedTrackInstance - - :returns: Fetched PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return PublishedTrackInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Video.V1.PublishedTrackContext {}>'.format(context) - - -class PublishedTrackInstance(InstanceResource): - """ """ - - class Kind(object): - AUDIO = "audio" - VIDEO = "video" - DATA = "data" - - def __init__(self, version, payload, room_sid, participant_sid, sid=None): - """ - Initialize the PublishedTrackInstance - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance - """ - super(PublishedTrackInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'participant_sid': payload['participant_sid'], - 'room_sid': payload['room_sid'], - 'name': payload['name'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'enabled': payload['enabled'], - 'kind': payload['kind'], - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = { - 'room_sid': room_sid, - 'participant_sid': participant_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PublishedTrackContext for this PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - """ - if self._context is None: - self._context = PublishedTrackContext( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def participant_sid(self): - """ - :returns: The participant_sid - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def room_sid(self): - """ - :returns: The room_sid - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def name(self): - """ - :returns: The name - :rtype: unicode - """ - return self._properties['name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def enabled(self): - """ - :returns: The enabled - :rtype: bool - """ - return self._properties['enabled'] - - @property - def kind(self): - """ - :returns: The kind - :rtype: PublishedTrackInstance.Kind - """ - return self._properties['kind'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a PublishedTrackInstance - - :returns: Fetched PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Video.V1.PublishedTrackInstance {}>'.format(context) diff --git a/twilio/rest/video/v1/room/room_participant/room_participant_subscribed_track.py b/twilio/rest/video/v1/room/room_participant/room_participant_subscribed_track.py deleted file mode 100644 index 0f21fc2..0000000 --- a/twilio/rest/video/v1/room/room_participant/room_participant_subscribed_track.py +++ /dev/null @@ -1,365 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SubscribedTrackList(ListResource): - """ """ - - def __init__(self, version, room_sid, subscriber_sid): - """ - Initialize the SubscribedTrackList - - :param Version version: Version that contains the resource - :param room_sid: The room_sid - :param subscriber_sid: The subscriber_sid - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackList - """ - super(SubscribedTrackList, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'subscriber_sid': subscriber_sid, } - self._uri = '/Rooms/{room_sid}/Participants/{subscriber_sid}/SubscribedTracks'.format(**self._solution) - - def stream(self, date_created_after=values.unset, - date_created_before=values.unset, track=values.unset, - publisher=values.unset, kind=values.unset, limit=None, - page_size=None): - """ - Streams SubscribedTrackInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param unicode track: The track - :param unicode publisher: The publisher - :param SubscribedTrackInstance.Kind kind: The kind - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - date_created_after=date_created_after, - date_created_before=date_created_before, - track=track, - publisher=publisher, - kind=kind, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, date_created_after=values.unset, - date_created_before=values.unset, track=values.unset, - publisher=values.unset, kind=values.unset, limit=None, page_size=None): - """ - Lists SubscribedTrackInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param unicode track: The track - :param unicode publisher: The publisher - :param SubscribedTrackInstance.Kind kind: The kind - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance] - """ - return list(self.stream( - date_created_after=date_created_after, - date_created_before=date_created_before, - track=track, - publisher=publisher, - kind=kind, - limit=limit, - page_size=page_size, - )) - - def page(self, date_created_after=values.unset, - date_created_before=values.unset, track=values.unset, - publisher=values.unset, kind=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of SubscribedTrackInstance records from the API. - Request is executed immediately - - :param datetime date_created_after: The date_created_after - :param datetime date_created_before: The date_created_before - :param unicode track: The track - :param unicode publisher: The publisher - :param SubscribedTrackInstance.Kind kind: The kind - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SubscribedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackPage - """ - params = values.of({ - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'Track': track, - 'Publisher': publisher, - 'Kind': kind, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SubscribedTrackPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SubscribedTrackInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SubscribedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SubscribedTrackPage(self._version, response, self._solution) - - def update(self, track=values.unset, publisher=values.unset, kind=values.unset, - status=values.unset): - """ - Update the SubscribedTrackInstance - - :param unicode track: The track - :param unicode publisher: The publisher - :param SubscribedTrackInstance.Kind kind: The kind - :param SubscribedTrackInstance.Status status: The status - - :returns: Updated SubscribedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance - """ - data = values.of({'Track': track, 'Publisher': publisher, 'Kind': kind, 'Status': status, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SubscribedTrackInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - subscriber_sid=self._solution['subscriber_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.SubscribedTrackList>' - - -class SubscribedTrackPage(Page): - """ """ - - def __init__(self, version, response, solution): - """ - Initialize the SubscribedTrackPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param room_sid: The room_sid - :param subscriber_sid: The subscriber_sid - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackPage - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackPage - """ - super(SubscribedTrackPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SubscribedTrackInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance - """ - return SubscribedTrackInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - subscriber_sid=self._solution['subscriber_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.SubscribedTrackPage>' - - -class SubscribedTrackInstance(InstanceResource): - """ """ - - class Kind(object): - AUDIO = "audio" - VIDEO = "video" - DATA = "data" - - class Status(object): - SUBSCRIBE = "subscribe" - UNSUBSCRIBE = "unsubscribe" - - def __init__(self, version, payload, room_sid, subscriber_sid): - """ - Initialize the SubscribedTrackInstance - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance - """ - super(SubscribedTrackInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'room_sid': payload['room_sid'], - 'name': payload['name'], - 'publisher_sid': payload['publisher_sid'], - 'subscriber_sid': payload['subscriber_sid'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'enabled': payload['enabled'], - 'kind': payload['kind'], - } - - # Context - self._context = None - self._solution = {'room_sid': room_sid, 'subscriber_sid': subscriber_sid, } - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def room_sid(self): - """ - :returns: The room_sid - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def name(self): - """ - :returns: The name - :rtype: unicode - """ - return self._properties['name'] - - @property - def publisher_sid(self): - """ - :returns: The publisher_sid - :rtype: unicode - """ - return self._properties['publisher_sid'] - - @property - def subscriber_sid(self): - """ - :returns: The subscriber_sid - :rtype: unicode - """ - return self._properties['subscriber_sid'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def enabled(self): - """ - :returns: The enabled - :rtype: bool - """ - return self._properties['enabled'] - - @property - def kind(self): - """ - :returns: The kind - :rtype: SubscribedTrackInstance.Kind - """ - return self._properties['kind'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Video.V1.SubscribedTrackInstance>' diff --git a/twilio/rest/wireless/__init__.py b/twilio/rest/wireless/__init__.py deleted file mode 100644 index 36f1de3..0000000 --- a/twilio/rest/wireless/__init__.py +++ /dev/null @@ -1,67 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.domain import Domain -from twilio.rest.wireless.v1 import V1 - - -class Wireless(Domain): - - def __init__(self, twilio): - """ - Initialize the Wireless Domain - - :returns: Domain for Wireless - :rtype: twilio.rest.wireless.Wireless - """ - super(Wireless, self).__init__(twilio) - - self.base_url = 'https://wireless.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of wireless - :rtype: twilio.rest.wireless.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def commands(self): - """ - :rtype: twilio.rest.wireless.v1.command.CommandList - """ - return self.v1.commands - - @property - def rate_plans(self): - """ - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanList - """ - return self.v1.rate_plans - - @property - def sims(self): - """ - :rtype: twilio.rest.wireless.v1.sim.SimList - """ - return self.v1.sims - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless>' diff --git a/twilio/rest/wireless/__pycache__/__init__.cpython-36.pyc b/twilio/rest/wireless/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 00906d2..0000000 Binary files a/twilio/rest/wireless/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/wireless/v1/__init__.py b/twilio/rest/wireless/v1/__init__.py deleted file mode 100644 index 7ed77cd..0000000 --- a/twilio/rest/wireless/v1/__init__.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.wireless.v1.command import CommandList -from twilio.rest.wireless.v1.rate_plan import RatePlanList -from twilio.rest.wireless.v1.sim import SimList - - -class V1(Version): - - def __init__(self, domain): - """ - Initialize the V1 version of Wireless - - :returns: V1 version of Wireless - :rtype: twilio.rest.wireless.v1.V1.V1 - """ - super(V1, self).__init__(domain) - self.version = 'v1' - self._commands = None - self._rate_plans = None - self._sims = None - - @property - def commands(self): - """ - :rtype: twilio.rest.wireless.v1.command.CommandList - """ - if self._commands is None: - self._commands = CommandList(self) - return self._commands - - @property - def rate_plans(self): - """ - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanList - """ - if self._rate_plans is None: - self._rate_plans = RatePlanList(self) - return self._rate_plans - - @property - def sims(self): - """ - :rtype: twilio.rest.wireless.v1.sim.SimList - """ - if self._sims is None: - self._sims = SimList(self) - return self._sims - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless.V1>' diff --git a/twilio/rest/wireless/v1/__pycache__/__init__.cpython-36.pyc b/twilio/rest/wireless/v1/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index c12d8b0..0000000 Binary files a/twilio/rest/wireless/v1/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/wireless/v1/__pycache__/command.cpython-36.pyc b/twilio/rest/wireless/v1/__pycache__/command.cpython-36.pyc deleted file mode 100644 index 297518b..0000000 Binary files a/twilio/rest/wireless/v1/__pycache__/command.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/wireless/v1/__pycache__/rate_plan.cpython-36.pyc b/twilio/rest/wireless/v1/__pycache__/rate_plan.cpython-36.pyc deleted file mode 100644 index b2813a4..0000000 Binary files a/twilio/rest/wireless/v1/__pycache__/rate_plan.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/wireless/v1/command.py b/twilio/rest/wireless/v1/command.py deleted file mode 100644 index db1456c..0000000 --- a/twilio/rest/wireless/v1/command.py +++ /dev/null @@ -1,451 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page - - -class CommandList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the CommandList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.wireless.v1.command.CommandList - :rtype: twilio.rest.wireless.v1.command.CommandList - """ - super(CommandList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Commands'.format(**self._solution) - - def stream(self, sim=values.unset, status=values.unset, direction=values.unset, - limit=None, page_size=None): - """ - Streams CommandInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param unicode sim: The sim - :param CommandInstance.Status status: The status - :param CommandInstance.Direction direction: The direction - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.wireless.v1.command.CommandInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(sim=sim, status=status, direction=direction, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, sim=values.unset, status=values.unset, direction=values.unset, - limit=None, page_size=None): - """ - Lists CommandInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode sim: The sim - :param CommandInstance.Status status: The status - :param CommandInstance.Direction direction: The direction - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.wireless.v1.command.CommandInstance] - """ - return list(self.stream( - sim=sim, - status=status, - direction=direction, - limit=limit, - page_size=page_size, - )) - - def page(self, sim=values.unset, status=values.unset, direction=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CommandInstance records from the API. - Request is executed immediately - - :param unicode sim: The sim - :param CommandInstance.Status status: The status - :param CommandInstance.Direction direction: The direction - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandPage - """ - params = values.of({ - 'Sim': sim, - 'Status': status, - 'Direction': direction, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return CommandPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CommandInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CommandPage(self._version, response, self._solution) - - def create(self, command, sim=values.unset, callback_method=values.unset, - callback_url=values.unset, command_mode=values.unset, - include_sid=values.unset): - """ - Create a new CommandInstance - - :param unicode command: The command - :param unicode sim: The sim - :param unicode callback_method: The callback_method - :param unicode callback_url: The callback_url - :param CommandInstance.CommandMode command_mode: The command_mode - :param unicode include_sid: The include_sid - - :returns: Newly created CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandInstance - """ - data = values.of({ - 'Command': command, - 'Sim': sim, - 'CallbackMethod': callback_method, - 'CallbackUrl': callback_url, - 'CommandMode': command_mode, - 'IncludeSid': include_sid, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return CommandInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a CommandContext - - :param sid: The sid - - :returns: twilio.rest.wireless.v1.command.CommandContext - :rtype: twilio.rest.wireless.v1.command.CommandContext - """ - return CommandContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CommandContext - - :param sid: The sid - - :returns: twilio.rest.wireless.v1.command.CommandContext - :rtype: twilio.rest.wireless.v1.command.CommandContext - """ - return CommandContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless.V1.CommandList>' - - -class CommandPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the CommandPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.wireless.v1.command.CommandPage - :rtype: twilio.rest.wireless.v1.command.CommandPage - """ - super(CommandPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CommandInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.wireless.v1.command.CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandInstance - """ - return CommandInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless.V1.CommandPage>' - - -class CommandContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the CommandContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.wireless.v1.command.CommandContext - :rtype: twilio.rest.wireless.v1.command.CommandContext - """ - super(CommandContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Commands/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a CommandInstance - - :returns: Fetched CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return CommandInstance(self._version, payload, sid=self._solution['sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Wireless.V1.CommandContext {}>'.format(context) - - -class CommandInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Direction(object): - FROM_SIM = "from_sim" - TO_SIM = "to_sim" - - class Status(object): - QUEUED = "queued" - SENT = "sent" - DELIVERED = "delivered" - RECEIVED = "received" - FAILED = "failed" - - class CommandMode(object): - TEXT = "text" - BINARY = "binary" - - def __init__(self, version, payload, sid=None): - """ - Initialize the CommandInstance - - :returns: twilio.rest.wireless.v1.command.CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandInstance - """ - super(CommandInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'account_sid': payload['account_sid'], - 'sim_sid': payload['sim_sid'], - 'command': payload['command'], - 'command_mode': payload['command_mode'], - 'status': payload['status'], - 'direction': payload['direction'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CommandContext for this CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandContext - """ - if self._context is None: - self._context = CommandContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sim_sid(self): - """ - :returns: The sim_sid - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def command(self): - """ - :returns: The command - :rtype: unicode - """ - return self._properties['command'] - - @property - def command_mode(self): - """ - :returns: The command_mode - :rtype: CommandInstance.CommandMode - """ - return self._properties['command_mode'] - - @property - def status(self): - """ - :returns: The status - :rtype: CommandInstance.Status - """ - return self._properties['status'] - - @property - def direction(self): - """ - :returns: The direction - :rtype: CommandInstance.Direction - """ - return self._properties['direction'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a CommandInstance - - :returns: Fetched CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Wireless.V1.CommandInstance {}>'.format(context) diff --git a/twilio/rest/wireless/v1/rate_plan.py b/twilio/rest/wireless/v1/rate_plan.py deleted file mode 100644 index dafd1dc..0000000 --- a/twilio/rest/wireless/v1/rate_plan.py +++ /dev/null @@ -1,530 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import 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.page import Page - - -class RatePlanList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the RatePlanList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanList - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanList - """ - super(RatePlanList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/RatePlans'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams RatePlanInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.wireless.v1.rate_plan.RatePlanInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, limit=None, page_size=None): - """ - Lists RatePlanInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.wireless.v1.rate_plan.RatePlanInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RatePlanInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanPage - """ - params = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return RatePlanPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RatePlanInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RatePlanPage(self._version, response, self._solution) - - def create(self, unique_name=values.unset, friendly_name=values.unset, - data_enabled=values.unset, data_limit=values.unset, - data_metering=values.unset, messaging_enabled=values.unset, - voice_enabled=values.unset, national_roaming_enabled=values.unset, - international_roaming=values.unset, - national_roaming_data_limit=values.unset, - international_roaming_data_limit=values.unset): - """ - Create a new RatePlanInstance - - :param unicode unique_name: The unique_name - :param unicode friendly_name: The friendly_name - :param bool data_enabled: The data_enabled - :param unicode data_limit: The data_limit - :param unicode data_metering: The data_metering - :param bool messaging_enabled: The messaging_enabled - :param bool voice_enabled: The voice_enabled - :param bool national_roaming_enabled: The national_roaming_enabled - :param unicode international_roaming: The international_roaming - :param unicode national_roaming_data_limit: The national_roaming_data_limit - :param unicode international_roaming_data_limit: The international_roaming_data_limit - - :returns: Newly created RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'FriendlyName': friendly_name, - 'DataEnabled': data_enabled, - 'DataLimit': data_limit, - 'DataMetering': data_metering, - 'MessagingEnabled': messaging_enabled, - 'VoiceEnabled': voice_enabled, - 'NationalRoamingEnabled': national_roaming_enabled, - 'InternationalRoaming': serialize.map(international_roaming, lambda e: e), - 'NationalRoamingDataLimit': national_roaming_data_limit, - 'InternationalRoamingDataLimit': international_roaming_data_limit, - }) - - payload = self._version.create( - 'POST', - self._uri, - data=data, - ) - - return RatePlanInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a RatePlanContext - - :param sid: The sid - - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanContext - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanContext - """ - return RatePlanContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RatePlanContext - - :param sid: The sid - - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanContext - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanContext - """ - return RatePlanContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless.V1.RatePlanList>' - - -class RatePlanPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the RatePlanPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanPage - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanPage - """ - super(RatePlanPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RatePlanInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - """ - return RatePlanInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless.V1.RatePlanPage>' - - -class RatePlanContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the RatePlanContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanContext - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanContext - """ - super(RatePlanContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/RatePlans/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch a RatePlanInstance - - :returns: Fetched RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return RatePlanInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, unique_name=values.unset, friendly_name=values.unset): - """ - Update the RatePlanInstance - - :param unicode unique_name: The unique_name - :param unicode friendly_name: The friendly_name - - :returns: Updated RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - """ - data = values.of({'UniqueName': unique_name, 'FriendlyName': friendly_name, }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return RatePlanInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the RatePlanInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete('delete', self._uri) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Wireless.V1.RatePlanContext {}>'.format(context) - - -class RatePlanInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the RatePlanInstance - - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - """ - super(RatePlanInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'account_sid': payload['account_sid'], - 'friendly_name': payload['friendly_name'], - 'data_enabled': payload['data_enabled'], - 'data_metering': payload['data_metering'], - 'data_limit': deserialize.integer(payload['data_limit']), - 'messaging_enabled': payload['messaging_enabled'], - 'voice_enabled': payload['voice_enabled'], - 'national_roaming_enabled': payload['national_roaming_enabled'], - 'national_roaming_data_limit': deserialize.integer(payload['national_roaming_data_limit']), - 'international_roaming': payload['international_roaming'], - 'international_roaming_data_limit': deserialize.integer(payload['international_roaming_data_limit']), - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RatePlanContext for this RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanContext - """ - if self._context is None: - self._context = RatePlanContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def data_enabled(self): - """ - :returns: The data_enabled - :rtype: bool - """ - return self._properties['data_enabled'] - - @property - def data_metering(self): - """ - :returns: The data_metering - :rtype: unicode - """ - return self._properties['data_metering'] - - @property - def data_limit(self): - """ - :returns: The data_limit - :rtype: unicode - """ - return self._properties['data_limit'] - - @property - def messaging_enabled(self): - """ - :returns: The messaging_enabled - :rtype: bool - """ - return self._properties['messaging_enabled'] - - @property - def voice_enabled(self): - """ - :returns: The voice_enabled - :rtype: bool - """ - return self._properties['voice_enabled'] - - @property - def national_roaming_enabled(self): - """ - :returns: The national_roaming_enabled - :rtype: bool - """ - return self._properties['national_roaming_enabled'] - - @property - def national_roaming_data_limit(self): - """ - :returns: The national_roaming_data_limit - :rtype: unicode - """ - return self._properties['national_roaming_data_limit'] - - @property - def international_roaming(self): - """ - :returns: The international_roaming - :rtype: unicode - """ - return self._properties['international_roaming'] - - @property - def international_roaming_data_limit(self): - """ - :returns: The international_roaming_data_limit - :rtype: unicode - """ - return self._properties['international_roaming_data_limit'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch a RatePlanInstance - - :returns: Fetched RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - """ - return self._proxy.fetch() - - def update(self, unique_name=values.unset, friendly_name=values.unset): - """ - Update the RatePlanInstance - - :param unicode unique_name: The unique_name - :param unicode friendly_name: The friendly_name - - :returns: Updated RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - """ - return self._proxy.update(unique_name=unique_name, friendly_name=friendly_name, ) - - def delete(self): - """ - Deletes the RatePlanInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Wireless.V1.RatePlanInstance {}>'.format(context) diff --git a/twilio/rest/wireless/v1/sim/__init__.py b/twilio/rest/wireless/v1/sim/__init__.py deleted file mode 100644 index cf913db..0000000 --- a/twilio/rest/wireless/v1/sim/__init__.py +++ /dev/null @@ -1,710 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import 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.page import Page -from twilio.rest.wireless.v1.sim.data_session import DataSessionList -from twilio.rest.wireless.v1.sim.usage_record import UsageRecordList - - -class SimList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the SimList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.wireless.v1.sim.SimList - :rtype: twilio.rest.wireless.v1.sim.SimList - """ - super(SimList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Sims'.format(**self._solution) - - def stream(self, status=values.unset, iccid=values.unset, - rate_plan=values.unset, e_id=values.unset, - sim_registration_code=values.unset, limit=None, page_size=None): - """ - Streams SimInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param SimInstance.Status status: The status - :param unicode iccid: The iccid - :param unicode rate_plan: The rate_plan - :param unicode e_id: The e_id - :param unicode sim_registration_code: The sim_registration_code - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.wireless.v1.sim.SimInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - iccid=iccid, - rate_plan=rate_plan, - e_id=e_id, - sim_registration_code=sim_registration_code, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, status=values.unset, iccid=values.unset, rate_plan=values.unset, - e_id=values.unset, sim_registration_code=values.unset, limit=None, - page_size=None): - """ - Lists SimInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param SimInstance.Status status: The status - :param unicode iccid: The iccid - :param unicode rate_plan: The rate_plan - :param unicode e_id: The e_id - :param unicode sim_registration_code: The sim_registration_code - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.wireless.v1.sim.SimInstance] - """ - return list(self.stream( - status=status, - iccid=iccid, - rate_plan=rate_plan, - e_id=e_id, - sim_registration_code=sim_registration_code, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, iccid=values.unset, rate_plan=values.unset, - e_id=values.unset, sim_registration_code=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SimInstance records from the API. - Request is executed immediately - - :param SimInstance.Status status: The status - :param unicode iccid: The iccid - :param unicode rate_plan: The rate_plan - :param unicode e_id: The e_id - :param unicode sim_registration_code: The sim_registration_code - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimPage - """ - params = values.of({ - 'Status': status, - 'Iccid': iccid, - 'RatePlan': rate_plan, - 'EId': e_id, - 'SimRegistrationCode': sim_registration_code, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return SimPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SimInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SimPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SimContext - - :param sid: The sid - - :returns: twilio.rest.wireless.v1.sim.SimContext - :rtype: twilio.rest.wireless.v1.sim.SimContext - """ - return SimContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SimContext - - :param sid: The sid - - :returns: twilio.rest.wireless.v1.sim.SimContext - :rtype: twilio.rest.wireless.v1.sim.SimContext - """ - return SimContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless.V1.SimList>' - - -class SimPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SimPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.wireless.v1.sim.SimPage - :rtype: twilio.rest.wireless.v1.sim.SimPage - """ - super(SimPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SimInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.wireless.v1.sim.SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimInstance - """ - return SimInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless.V1.SimPage>' - - -class SimContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the SimContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.wireless.v1.sim.SimContext - :rtype: twilio.rest.wireless.v1.sim.SimContext - """ - super(SimContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Sims/{sid}'.format(**self._solution) - - # Dependents - self._usage_records = None - self._data_sessions = None - - def fetch(self): - """ - Fetch a SimInstance - - :returns: Fetched SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimInstance - """ - params = values.of({}) - - payload = self._version.fetch( - 'GET', - self._uri, - params=params, - ) - - return SimInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, unique_name=values.unset, callback_method=values.unset, - callback_url=values.unset, friendly_name=values.unset, - rate_plan=values.unset, status=values.unset, - commands_callback_method=values.unset, - commands_callback_url=values.unset, sms_fallback_method=values.unset, - sms_fallback_url=values.unset, sms_method=values.unset, - sms_url=values.unset, voice_fallback_method=values.unset, - voice_fallback_url=values.unset, voice_method=values.unset, - voice_url=values.unset): - """ - Update the SimInstance - - :param unicode unique_name: The unique_name - :param unicode callback_method: The callback_method - :param unicode callback_url: The callback_url - :param unicode friendly_name: The friendly_name - :param unicode rate_plan: The rate_plan - :param SimInstance.Status status: The status - :param unicode commands_callback_method: The commands_callback_method - :param unicode commands_callback_url: The commands_callback_url - :param unicode sms_fallback_method: The sms_fallback_method - :param unicode sms_fallback_url: The sms_fallback_url - :param unicode sms_method: The sms_method - :param unicode sms_url: The sms_url - :param unicode voice_fallback_method: The voice_fallback_method - :param unicode voice_fallback_url: The voice_fallback_url - :param unicode voice_method: The voice_method - :param unicode voice_url: The voice_url - - :returns: Updated SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'CallbackMethod': callback_method, - 'CallbackUrl': callback_url, - 'FriendlyName': friendly_name, - 'RatePlan': rate_plan, - 'Status': status, - 'CommandsCallbackMethod': commands_callback_method, - 'CommandsCallbackUrl': commands_callback_url, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, - }) - - payload = self._version.update( - 'POST', - self._uri, - data=data, - ) - - return SimInstance(self._version, payload, sid=self._solution['sid'], ) - - @property - def usage_records(self): - """ - Access the usage_records - - :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList - """ - if self._usage_records is None: - self._usage_records = UsageRecordList(self._version, sim_sid=self._solution['sid'], ) - return self._usage_records - - @property - def data_sessions(self): - """ - Access the data_sessions - - :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionList - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionList - """ - if self._data_sessions is None: - self._data_sessions = DataSessionList(self._version, sim_sid=self._solution['sid'], ) - return self._data_sessions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Wireless.V1.SimContext {}>'.format(context) - - -class SimInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Status(object): - NEW = "new" - READY = "ready" - ACTIVE = "active" - SUSPENDED = "suspended" - DEACTIVATED = "deactivated" - CANCELED = "canceled" - SCHEDULED = "scheduled" - UPDATING = "updating" - - def __init__(self, version, payload, sid=None): - """ - Initialize the SimInstance - - :returns: twilio.rest.wireless.v1.sim.SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimInstance - """ - super(SimInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'unique_name': payload['unique_name'], - 'account_sid': payload['account_sid'], - 'rate_plan_sid': payload['rate_plan_sid'], - 'friendly_name': payload['friendly_name'], - 'iccid': payload['iccid'], - 'e_id': payload['e_id'], - 'status': payload['status'], - 'commands_callback_url': payload['commands_callback_url'], - 'commands_callback_method': payload['commands_callback_method'], - 'sms_fallback_method': payload['sms_fallback_method'], - 'sms_fallback_url': payload['sms_fallback_url'], - 'sms_method': payload['sms_method'], - 'sms_url': payload['sms_url'], - 'voice_fallback_method': payload['voice_fallback_method'], - 'voice_fallback_url': payload['voice_fallback_url'], - 'voice_method': payload['voice_method'], - 'voice_url': payload['voice_url'], - 'date_created': deserialize.iso8601_datetime(payload['date_created']), - 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), - 'url': payload['url'], - 'links': payload['links'], - 'ip_address': payload['ip_address'], - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SimContext for this SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimContext - """ - if self._context is None: - self._context = SimContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def rate_plan_sid(self): - """ - :returns: The rate_plan_sid - :rtype: unicode - """ - return self._properties['rate_plan_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def iccid(self): - """ - :returns: The iccid - :rtype: unicode - """ - return self._properties['iccid'] - - @property - def e_id(self): - """ - :returns: The e_id - :rtype: unicode - """ - return self._properties['e_id'] - - @property - def status(self): - """ - :returns: The status - :rtype: SimInstance.Status - """ - return self._properties['status'] - - @property - def commands_callback_url(self): - """ - :returns: The commands_callback_url - :rtype: unicode - """ - return self._properties['commands_callback_url'] - - @property - def commands_callback_method(self): - """ - :returns: The commands_callback_method - :rtype: unicode - """ - return self._properties['commands_callback_method'] - - @property - def sms_fallback_method(self): - """ - :returns: The sms_fallback_method - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The sms_method - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The sms_url - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def voice_fallback_method(self): - """ - :returns: The voice_fallback_method - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The voice_method - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: The voice_url - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def ip_address(self): - """ - :returns: The ip_address - :rtype: unicode - """ - return self._properties['ip_address'] - - def fetch(self): - """ - Fetch a SimInstance - - :returns: Fetched SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimInstance - """ - return self._proxy.fetch() - - def update(self, unique_name=values.unset, callback_method=values.unset, - callback_url=values.unset, friendly_name=values.unset, - rate_plan=values.unset, status=values.unset, - commands_callback_method=values.unset, - commands_callback_url=values.unset, sms_fallback_method=values.unset, - sms_fallback_url=values.unset, sms_method=values.unset, - sms_url=values.unset, voice_fallback_method=values.unset, - voice_fallback_url=values.unset, voice_method=values.unset, - voice_url=values.unset): - """ - Update the SimInstance - - :param unicode unique_name: The unique_name - :param unicode callback_method: The callback_method - :param unicode callback_url: The callback_url - :param unicode friendly_name: The friendly_name - :param unicode rate_plan: The rate_plan - :param SimInstance.Status status: The status - :param unicode commands_callback_method: The commands_callback_method - :param unicode commands_callback_url: The commands_callback_url - :param unicode sms_fallback_method: The sms_fallback_method - :param unicode sms_fallback_url: The sms_fallback_url - :param unicode sms_method: The sms_method - :param unicode sms_url: The sms_url - :param unicode voice_fallback_method: The voice_fallback_method - :param unicode voice_fallback_url: The voice_fallback_url - :param unicode voice_method: The voice_method - :param unicode voice_url: The voice_url - - :returns: Updated SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimInstance - """ - return self._proxy.update( - unique_name=unique_name, - callback_method=callback_method, - callback_url=callback_url, - friendly_name=friendly_name, - rate_plan=rate_plan, - status=status, - commands_callback_method=commands_callback_method, - commands_callback_url=commands_callback_url, - sms_fallback_method=sms_fallback_method, - sms_fallback_url=sms_fallback_url, - sms_method=sms_method, - sms_url=sms_url, - voice_fallback_method=voice_fallback_method, - voice_fallback_url=voice_fallback_url, - voice_method=voice_method, - voice_url=voice_url, - ) - - @property - def usage_records(self): - """ - Access the usage_records - - :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList - """ - return self._proxy.usage_records - - @property - def data_sessions(self): - """ - Access the data_sessions - - :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionList - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionList - """ - return self._proxy.data_sessions - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return '<Twilio.Wireless.V1.SimInstance {}>'.format(context) diff --git a/twilio/rest/wireless/v1/sim/__pycache__/__init__.cpython-36.pyc b/twilio/rest/wireless/v1/sim/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index ecf9eb4..0000000 Binary files a/twilio/rest/wireless/v1/sim/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/wireless/v1/sim/__pycache__/data_session.cpython-36.pyc b/twilio/rest/wireless/v1/sim/__pycache__/data_session.cpython-36.pyc deleted file mode 100644 index 0064660..0000000 Binary files a/twilio/rest/wireless/v1/sim/__pycache__/data_session.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/wireless/v1/sim/__pycache__/usage_record.cpython-36.pyc b/twilio/rest/wireless/v1/sim/__pycache__/usage_record.cpython-36.pyc deleted file mode 100644 index 031f350..0000000 Binary files a/twilio/rest/wireless/v1/sim/__pycache__/usage_record.cpython-36.pyc and /dev/null differ diff --git a/twilio/rest/wireless/v1/sim/data_session.py b/twilio/rest/wireless/v1/sim/data_session.py deleted file mode 100644 index 26b1d14..0000000 --- a/twilio/rest/wireless/v1/sim/data_session.py +++ /dev/null @@ -1,346 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DataSessionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sim_sid): - """ - Initialize the DataSessionList - - :param Version version: Version that contains the resource - :param sim_sid: The sim_sid - - :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionList - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionList - """ - super(DataSessionList, self).__init__(version) - - # Path Solution - self._solution = {'sim_sid': sim_sid, } - self._uri = '/Sims/{sim_sid}/DataSessions'.format(**self._solution) - - def stream(self, end=values.unset, start=values.unset, limit=None, - page_size=None): - """ - Streams DataSessionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param datetime end: The end - :param datetime start: The start - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.wireless.v1.sim.data_session.DataSessionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(end=end, start=start, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, end=values.unset, start=values.unset, limit=None, - page_size=None): - """ - Lists DataSessionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime end: The end - :param datetime start: The start - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.wireless.v1.sim.data_session.DataSessionInstance] - """ - return list(self.stream(end=end, start=start, limit=limit, page_size=page_size, )) - - def page(self, end=values.unset, start=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of DataSessionInstance records from the API. - Request is executed immediately - - :param datetime end: The end - :param datetime start: The start - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DataSessionInstance - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionPage - """ - params = values.of({ - 'End': serialize.iso8601_datetime(end), - 'Start': serialize.iso8601_datetime(start), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return DataSessionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DataSessionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DataSessionInstance - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DataSessionPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless.V1.DataSessionList>' - - -class DataSessionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the DataSessionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sim_sid: The sim_sid - - :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionPage - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionPage - """ - super(DataSessionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DataSessionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionInstance - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionInstance - """ - return DataSessionInstance(self._version, payload, sim_sid=self._solution['sim_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless.V1.DataSessionPage>' - - -class DataSessionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, sim_sid): - """ - Initialize the DataSessionInstance - - :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionInstance - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionInstance - """ - super(DataSessionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload['sid'], - 'sim_sid': payload['sim_sid'], - 'account_sid': payload['account_sid'], - 'radio_link': payload['radio_link'], - 'operator_mcc': payload['operator_mcc'], - 'operator_mnc': payload['operator_mnc'], - 'operator_country': payload['operator_country'], - 'operator_name': payload['operator_name'], - 'cell_id': payload['cell_id'], - 'cell_location_estimate': payload['cell_location_estimate'], - 'packets_uploaded': deserialize.integer(payload['packets_uploaded']), - 'packets_downloaded': deserialize.integer(payload['packets_downloaded']), - 'last_updated': deserialize.iso8601_datetime(payload['last_updated']), - 'start': deserialize.iso8601_datetime(payload['start']), - 'end': deserialize.iso8601_datetime(payload['end']), - } - - # Context - self._context = None - self._solution = {'sim_sid': sim_sid, } - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sim_sid(self): - """ - :returns: The sim_sid - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def radio_link(self): - """ - :returns: The radio_link - :rtype: unicode - """ - return self._properties['radio_link'] - - @property - def operator_mcc(self): - """ - :returns: The operator_mcc - :rtype: unicode - """ - return self._properties['operator_mcc'] - - @property - def operator_mnc(self): - """ - :returns: The operator_mnc - :rtype: unicode - """ - return self._properties['operator_mnc'] - - @property - def operator_country(self): - """ - :returns: The operator_country - :rtype: unicode - """ - return self._properties['operator_country'] - - @property - def operator_name(self): - """ - :returns: The operator_name - :rtype: unicode - """ - return self._properties['operator_name'] - - @property - def cell_id(self): - """ - :returns: The cell_id - :rtype: unicode - """ - return self._properties['cell_id'] - - @property - def cell_location_estimate(self): - """ - :returns: The cell_location_estimate - :rtype: dict - """ - return self._properties['cell_location_estimate'] - - @property - def packets_uploaded(self): - """ - :returns: The packets_uploaded - :rtype: unicode - """ - return self._properties['packets_uploaded'] - - @property - def packets_downloaded(self): - """ - :returns: The packets_downloaded - :rtype: unicode - """ - return self._properties['packets_downloaded'] - - @property - def last_updated(self): - """ - :returns: The last_updated - :rtype: datetime - """ - return self._properties['last_updated'] - - @property - def start(self): - """ - :returns: The start - :rtype: datetime - """ - return self._properties['start'] - - @property - def end(self): - """ - :returns: The end - :rtype: datetime - """ - return self._properties['end'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless.V1.DataSessionInstance>' diff --git a/twilio/rest/wireless/v1/sim/usage_record.py b/twilio/rest/wireless/v1/sim/usage_record.py deleted file mode 100644 index 70b3418..0000000 --- a/twilio/rest/wireless/v1/sim/usage_record.py +++ /dev/null @@ -1,271 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UsageRecordList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sim_sid): - """ - Initialize the UsageRecordList - - :param Version version: Version that contains the resource - :param sim_sid: The sim_sid - - :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList - """ - super(UsageRecordList, self).__init__(version) - - # Path Solution - self._solution = {'sim_sid': sim_sid, } - self._uri = '/Sims/{sim_sid}/UsageRecords'.format(**self._solution) - - def stream(self, end=values.unset, start=values.unset, granularity=values.unset, - limit=None, page_size=None): - """ - Streams UsageRecordInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param datetime end: The end - :param datetime start: The start - :param UsageRecordInstance.Granularity granularity: The granularity - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.wireless.v1.sim.usage_record.UsageRecordInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(end=end, start=start, granularity=granularity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit'], limits['page_limit']) - - def list(self, end=values.unset, start=values.unset, granularity=values.unset, - limit=None, page_size=None): - """ - Lists UsageRecordInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime end: The end - :param datetime start: The start - :param UsageRecordInstance.Granularity granularity: The granularity - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int page_size: Number of records to fetch per request, when not set will use - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.wireless.v1.sim.usage_record.UsageRecordInstance] - """ - return list(self.stream( - end=end, - start=start, - granularity=granularity, - limit=limit, - page_size=page_size, - )) - - def page(self, end=values.unset, start=values.unset, granularity=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UsageRecordInstance records from the API. - Request is executed immediately - - :param datetime end: The end - :param datetime start: The start - :param UsageRecordInstance.Granularity granularity: The granularity - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UsageRecordInstance - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordPage - """ - params = values.of({ - 'End': serialize.iso8601_datetime(end), - 'Start': serialize.iso8601_datetime(start), - 'Granularity': granularity, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page( - 'GET', - self._uri, - params=params, - ) - - return UsageRecordPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UsageRecordInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UsageRecordInstance - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UsageRecordPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless.V1.UsageRecordList>' - - -class UsageRecordPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the UsageRecordPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sim_sid: The sim_sid - - :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordPage - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordPage - """ - super(UsageRecordPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UsageRecordInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordInstance - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordInstance - """ - return UsageRecordInstance(self._version, payload, sim_sid=self._solution['sim_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless.V1.UsageRecordPage>' - - -class UsageRecordInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Granularity(object): - HOURLY = "hourly" - DAILY = "daily" - ALL = "all" - - def __init__(self, version, payload, sim_sid): - """ - Initialize the UsageRecordInstance - - :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordInstance - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordInstance - """ - super(UsageRecordInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sim_sid': payload['sim_sid'], - 'account_sid': payload['account_sid'], - 'period': payload['period'], - 'commands': payload['commands'], - 'data': payload['data'], - } - - # Context - self._context = None - self._solution = {'sim_sid': sim_sid, } - - @property - def sim_sid(self): - """ - :returns: The sim_sid - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def period(self): - """ - :returns: The period - :rtype: dict - """ - return self._properties['period'] - - @property - def commands(self): - """ - :returns: The commands - :rtype: dict - """ - return self._properties['commands'] - - @property - def data(self): - """ - :returns: The data - :rtype: dict - """ - return self._properties['data'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '<Twilio.Wireless.V1.UsageRecordInstance>' diff --git a/twilio/twiml/__init__.py b/twilio/twiml/__init__.py deleted file mode 100644 index 97892de..0000000 --- a/twilio/twiml/__init__.py +++ /dev/null @@ -1,124 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -import json -import re -import xml.etree.ElementTree as ET - - -def lower_camel(string): - if not string or '_' not in string: - return string - - result = "".join([x.title() for x in string.split('_')]) - return result[0].lower() + result[1:] - - -def format_language(language): - """ - Attempt to format language parameter as 'ww-WW'. - - :param string language: language parameter - """ - if not language: - return language - - if not re.match('^[a-zA-Z]{2}[_-][a-zA-Z]{2}$', language): - raise TwiMLException('Invalid value for language parameter.') - - return language[0:2].lower() + '-' + language[3:5].upper() - - -class TwiMLException(Exception): - pass - - -class TwiML(object): - MAP = { - 'from_': 'from' - } - - def __init__(self, **kwargs): - self.name = self.__class__.__name__ - self.value = None - self.verbs = [] - self.attrs = {} - - for k, v in kwargs.items(): - if v is not None: - self.attrs[lower_camel(self.MAP.get(k, k))] = v - - def __str__(self): - return self.to_xml() - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, traceback): - return False - - def to_xml(self, xml_declaration=True): - """ - Return the contents of this verb as an XML string - - :param bool xml_declaration: Include the XML declaration. Defaults to True - """ - xml = ET.tostring(self.xml()).decode('utf-8') - return '<?xml version="1.0" encoding="UTF-8"?>{}'.format(xml) if xml_declaration else xml - - def append(self, verb): - """ - Add a TwiML doc - - :param verb: TwiML Document - - :returns: self - """ - if not isinstance(verb, TwiML): - raise TwiMLException('Only appending of TwiML is allowed') - - self.verbs.append(verb) - return self - - def nest(self, verb): - """ - Add a TwiML doc. Unlike `append()`, this returns the created verb. - - :param verb: TwiML Document - - :returns: the TwiML verb - """ - if not isinstance(verb, TwiML): - raise TwiMLException('Only nesting of TwiML is allowed') - - self.verbs.append(verb) - return verb - - def xml(self): - el = ET.Element(self.name) - - keys = self.attrs.keys() - keys = sorted(keys) - for a in keys: - value = self.attrs[a] - - if isinstance(value, bool): - el.set(a, str(value).lower()) - else: - el.set(a, str(value)) - - if self.value: - if isinstance(self.value, dict): - self.value = json.dumps(self.value) - - el.text = self.value - - for verb in self.verbs: - el.append(verb.xml()) - - return el diff --git a/twilio/twiml/__pycache__/__init__.cpython-36.pyc b/twilio/twiml/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 89c1eb4..0000000 Binary files a/twilio/twiml/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/twilio/twiml/__pycache__/fax_response.cpython-36.pyc b/twilio/twiml/__pycache__/fax_response.cpython-36.pyc deleted file mode 100644 index 078a567..0000000 Binary files a/twilio/twiml/__pycache__/fax_response.cpython-36.pyc and /dev/null differ diff --git a/twilio/twiml/__pycache__/messaging_response.cpython-36.pyc b/twilio/twiml/__pycache__/messaging_response.cpython-36.pyc deleted file mode 100644 index 396d5ca..0000000 Binary files a/twilio/twiml/__pycache__/messaging_response.cpython-36.pyc and /dev/null differ diff --git a/twilio/twiml/__pycache__/voice_response.cpython-36.pyc b/twilio/twiml/__pycache__/voice_response.cpython-36.pyc deleted file mode 100644 index fb20e7c..0000000 Binary files a/twilio/twiml/__pycache__/voice_response.cpython-36.pyc and /dev/null differ diff --git a/twilio/twiml/fax_response.py b/twilio/twiml/fax_response.py deleted file mode 100644 index 81d7ae3..0000000 --- a/twilio/twiml/fax_response.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -import json -from twilio.twiml import ( - TwiML, - format_language, -) - - -class FaxResponse(TwiML): - """ <Response> TwiML for Faxes """ - - def __init__(self, **kwargs): - super(FaxResponse, self).__init__(**kwargs) - self.name = 'Response' - - def receive(self, action=None, method=None, **kwargs): - """ - Create a <Receive> element - - :param action: Receive action URL - :param method: Receive action URL method - :param kwargs: additional attributes - - :returns: <Receive> element - """ - return self.nest(Receive(action=action, method=method, **kwargs)) - - -class Receive(TwiML): - """ <Receive> TwiML Verb """ - - def __init__(self, **kwargs): - super(Receive, self).__init__(**kwargs) - self.name = 'Receive' diff --git a/twilio/twiml/messaging_response.py b/twilio/twiml/messaging_response.py deleted file mode 100644 index 323ea28..0000000 --- a/twilio/twiml/messaging_response.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -import json -from twilio.twiml import ( - TwiML, - format_language, -) - - -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: Action URL - :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 diff --git a/twilio/twiml/voice_response.py b/twilio/twiml/voice_response.py deleted file mode 100644 index 7077b02..0000000 --- a/twilio/twiml/voice_response.py +++ /dev/null @@ -1,714 +0,0 @@ -# coding=utf-8 -""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -import json -from twilio.twiml import ( - TwiML, - format_language, -) - - -class VoiceResponse(TwiML): - """ <Response> TwiML for Voice """ - - def __init__(self, **kwargs): - super(VoiceResponse, self).__init__(**kwargs) - self.name = 'Response' - - def dial(self, number=None, action=None, method=None, timeout=None, - hangup_on_star=None, time_limit=None, caller_id=None, record=None, - trim=None, recording_status_callback=None, - recording_status_callback_method=None, - recording_status_callback_event=None, answer_on_bridge=None, - ring_tone=None, **kwargs): - """ - Create a <Dial> element - - :param number: Phone number to dial - :param action: Action URL - :param method: Action URL method - :param timeout: Time to wait for answer - :param hangup_on_star: Hangup call on star press - :param time_limit: Max time length - :param caller_id: Caller ID to display - :param record: Record the call - :param trim: Trim the recording - :param recording_status_callback: Recording status callback URL - :param recording_status_callback_method: Recording status callback URL method - :param recording_status_callback_event: Recording status callback events - :param answer_on_bridge: Preserve the ringing behavior of the inbound call until the Dialed call picks up - :param ring_tone: Ringtone allows you to override the ringback tone that Twilio will play back to the caller while executing the Dial - :param kwargs: additional attributes - - :returns: <Dial> element - """ - return self.nest(Dial( - number=number, - action=action, - method=method, - timeout=timeout, - hangup_on_star=hangup_on_star, - time_limit=time_limit, - caller_id=caller_id, - record=record, - trim=trim, - recording_status_callback=recording_status_callback, - recording_status_callback_method=recording_status_callback_method, - recording_status_callback_event=recording_status_callback_event, - answer_on_bridge=answer_on_bridge, - ring_tone=ring_tone, - **kwargs - )) - - def echo(self, **kwargs): - """ - Create a <Echo> element - - :param kwargs: additional attributes - - :returns: <Echo> element - """ - return self.nest(Echo(**kwargs)) - - def enqueue(self, name=None, action=None, method=None, wait_url=None, - wait_url_method=None, workflow_sid=None, **kwargs): - """ - Create a <Enqueue> element - - :param name: Friendly name - :param action: Action URL - :param method: Action URL method - :param wait_url: Wait URL - :param wait_url_method: Wait URL method - :param workflow_sid: TaskRouter Workflow SID - :param kwargs: additional attributes - - :returns: <Enqueue> element - """ - return self.nest(Enqueue( - name=name, - action=action, - method=method, - wait_url=wait_url, - wait_url_method=wait_url_method, - workflow_sid=workflow_sid, - **kwargs - )) - - def gather(self, input=None, action=None, method=None, timeout=None, - speech_timeout=None, max_speech_time=None, profanity_filter=None, - finish_on_key=None, num_digits=None, partial_result_callback=None, - partial_result_callback_method=None, language=None, hints=None, - barge_in=None, **kwargs): - """ - Create a <Gather> element - - :param input: Input type Twilio should accept - :param action: Action URL - :param method: Action URL method - :param timeout: Time to wait to gather input - :param speech_timeout: Time to wait to gather speech input and it should be either auto or a positive integer. - :param max_speech_time: Max allowed time for speech input - :param profanity_filter: Profanity Filter on speech - :param finish_on_key: Finish gather on key - :param num_digits: Number of digits to collect - :param partial_result_callback: Partial result callback URL - :param partial_result_callback_method: Partial result callback URL method - :param language: Language to use - :param hints: Speech recognition hints - :param barge_in: Stop playing media upon speech - :param kwargs: additional attributes - - :returns: <Gather> element - """ - return self.nest(Gather( - input=input, - action=action, - method=method, - timeout=timeout, - speech_timeout=speech_timeout, - max_speech_time=max_speech_time, - profanity_filter=profanity_filter, - finish_on_key=finish_on_key, - num_digits=num_digits, - partial_result_callback=partial_result_callback, - partial_result_callback_method=partial_result_callback_method, - language=language, - hints=hints, - barge_in=barge_in, - **kwargs - )) - - def hangup(self, **kwargs): - """ - Create a <Hangup> element - - :param kwargs: additional attributes - - :returns: <Hangup> element - """ - return self.nest(Hangup(**kwargs)) - - def leave(self, **kwargs): - """ - Create a <Leave> element - - :param kwargs: additional attributes - - :returns: <Leave> element - """ - return self.nest(Leave(**kwargs)) - - def pause(self, length=None, **kwargs): - """ - Create a <Pause> element - - :param length: Length in seconds to pause - :param kwargs: additional attributes - - :returns: <Pause> element - """ - return self.nest(Pause(length=length, **kwargs)) - - def play(self, url=None, loop=None, digits=None, **kwargs): - """ - Create a <Play> element - - :param url: Media URL - :param loop: Times to loop media - :param digits: Play DTMF tones for digits - :param kwargs: additional attributes - - :returns: <Play> element - """ - return self.nest(Play(url=url, loop=loop, digits=digits, **kwargs)) - - def queue(self, name, url=None, method=None, reservation_sid=None, - post_work_activity_sid=None, **kwargs): - """ - Create a <Queue> element - - :param name: Queue name - :param url: Action URL - :param method: Action URL method - :param reservation_sid: TaskRouter Reservation SID - :param post_work_activity_sid: TaskRouter Activity SID - :param kwargs: additional attributes - - :returns: <Queue> element - """ - return self.nest(Queue( - name, - url=url, - method=method, - reservation_sid=reservation_sid, - post_work_activity_sid=post_work_activity_sid, - **kwargs - )) - - def record(self, action=None, method=None, timeout=None, finish_on_key=None, - max_length=None, play_beep=None, trim=None, - recording_status_callback=None, - recording_status_callback_method=None, transcribe=None, - transcribe_callback=None, **kwargs): - """ - Create a <Record> element - - :param action: Action URL - :param method: Action URL method - :param timeout: Timeout to begin recording - :param finish_on_key: Finish recording on key - :param max_length: Max time to record in seconds - :param play_beep: Play beep - :param trim: Trim the recording - :param recording_status_callback: Status callback URL - :param recording_status_callback_method: Status callback URL method - :param transcribe: Transcribe the recording - :param transcribe_callback: Transcribe callback URL - :param kwargs: additional attributes - - :returns: <Record> element - """ - return self.nest(Record( - action=action, - method=method, - timeout=timeout, - finish_on_key=finish_on_key, - max_length=max_length, - play_beep=play_beep, - trim=trim, - recording_status_callback=recording_status_callback, - recording_status_callback_method=recording_status_callback_method, - transcribe=transcribe, - transcribe_callback=transcribe_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)) - - def reject(self, reason=None, **kwargs): - """ - Create a <Reject> element - - :param reason: Rejection reason - :param kwargs: additional attributes - - :returns: <Reject> element - """ - return self.nest(Reject(reason=reason, **kwargs)) - - def say(self, message, voice=None, loop=None, language=None, **kwargs): - """ - Create a <Say> element - - :param message: Message to say - :param voice: Voice to use - :param loop: Times to loop message - :param language: Message langauge - :param kwargs: additional attributes - - :returns: <Say> element - """ - return self.nest(Say(message, voice=voice, loop=loop, language=language, **kwargs)) - - def sms(self, message, to=None, from_=None, action=None, method=None, - status_callback=None, **kwargs): - """ - Create a <Sms> element - - :param message: Message body - :param to: Number to send message to - :param from: Number to send message from - :param action: Action URL - :param method: Action URL method - :param status_callback: Status callback URL - :param kwargs: additional attributes - - :returns: <Sms> element - """ - return self.nest(Sms( - message, - to=to, - from_=from_, - action=action, - method=method, - status_callback=status_callback, - **kwargs - )) - - -class Sms(TwiML): - """ <Sms> TwiML Noun """ - - def __init__(self, message, **kwargs): - super(Sms, self).__init__(**kwargs) - self.name = 'Sms' - self.value = message - - -class Say(TwiML): - """ <Say> TwiML Verb """ - - def __init__(self, message, **kwargs): - super(Say, self).__init__(**kwargs) - self.name = 'Say' - self.value = message - - -class Reject(TwiML): - """ <Reject> TwiML Verb """ - - def __init__(self, **kwargs): - super(Reject, self).__init__(**kwargs) - self.name = 'Reject' - - -class Redirect(TwiML): - """ <Redirect> TwiML Verb """ - - def __init__(self, url, **kwargs): - super(Redirect, self).__init__(**kwargs) - self.name = 'Redirect' - self.value = url - - -class Record(TwiML): - """ <Record> TwiML Verb """ - - def __init__(self, **kwargs): - super(Record, self).__init__(**kwargs) - self.name = 'Record' - - -class Queue(TwiML): - """ <Queue> TwiML Noun """ - - def __init__(self, name, **kwargs): - super(Queue, self).__init__(**kwargs) - self.name = 'Queue' - self.value = name - - -class Play(TwiML): - """ <Play> TwiML Verb """ - - def __init__(self, url=None, **kwargs): - super(Play, self).__init__(**kwargs) - self.name = 'Play' - if url: - self.value = url - - -class Pause(TwiML): - """ <Pause> TwiML Verb """ - - def __init__(self, **kwargs): - super(Pause, self).__init__(**kwargs) - self.name = 'Pause' - - -class Leave(TwiML): - """ <Leave> TwiML Verb """ - - def __init__(self, **kwargs): - super(Leave, self).__init__(**kwargs) - self.name = 'Leave' - - -class Hangup(TwiML): - """ <Hangup> TwiML Verb """ - - def __init__(self, **kwargs): - super(Hangup, self).__init__(**kwargs) - self.name = 'Hangup' - - -class Gather(TwiML): - """ <Gather> TwiML Verb """ - - def __init__(self, **kwargs): - super(Gather, self).__init__(**kwargs) - self.name = 'Gather' - - def say(self, message, voice=None, loop=None, language=None, **kwargs): - """ - Create a <Say> element - - :param message: Message to say - :param voice: Voice to use - :param loop: Times to loop message - :param language: Message langauge - :param kwargs: additional attributes - - :returns: <Say> element - """ - return self.nest(Say(message, voice=voice, loop=loop, language=language, **kwargs)) - - def pause(self, length=None, **kwargs): - """ - Create a <Pause> element - - :param length: Length in seconds to pause - :param kwargs: additional attributes - - :returns: <Pause> element - """ - return self.nest(Pause(length=length, **kwargs)) - - def play(self, url=None, loop=None, digits=None, **kwargs): - """ - Create a <Play> element - - :param url: Media URL - :param loop: Times to loop media - :param digits: Play DTMF tones for digits - :param kwargs: additional attributes - - :returns: <Play> element - """ - return self.nest(Play(url=url, loop=loop, digits=digits, **kwargs)) - - -class Enqueue(TwiML): - """ <Enqueue> TwiML Noun """ - - def __init__(self, name=None, **kwargs): - super(Enqueue, self).__init__(**kwargs) - self.name = 'Enqueue' - if name: - self.value = name - - def task(self, body, priority=None, timeout=None, **kwargs): - """ - Create a <Task> element - - :param body: TaskRouter task attributes - :param priority: Task priority - :param timeout: Timeout associated with task - :param kwargs: additional attributes - - :returns: <Task> element - """ - return self.nest(Task(body, priority=priority, timeout=timeout, **kwargs)) - - -class Task(TwiML): - """ <Task> TwiML Noun """ - - def __init__(self, body, **kwargs): - super(Task, self).__init__(**kwargs) - self.name = 'Task' - self.value = body - - -class Echo(TwiML): - """ <Echo> TwiML Verb """ - - def __init__(self, **kwargs): - super(Echo, self).__init__(**kwargs) - self.name = 'Echo' - - -class Dial(TwiML): - """ <Dial> TwiML Verb """ - - def __init__(self, number=None, **kwargs): - super(Dial, self).__init__(**kwargs) - self.name = 'Dial' - if number: - self.value = number - - def client(self, name, url=None, method=None, status_callback_event=None, - status_callback=None, status_callback_method=None, **kwargs): - """ - Create a <Client> element - - :param name: Client name - :param url: Client URL - :param method: Client URL Method - :param status_callback_event: Events to trigger status callback - :param status_callback: Status Callback URL - :param status_callback_method: Status Callback URL Method - :param kwargs: additional attributes - - :returns: <Client> element - """ - return self.nest(Client( - name, - url=url, - method=method, - status_callback_event=status_callback_event, - status_callback=status_callback, - status_callback_method=status_callback_method, - **kwargs - )) - - def conference(self, name, muted=None, beep=None, - start_conference_on_enter=None, end_conference_on_exit=None, - wait_url=None, wait_method=None, max_participants=None, - record=None, region=None, whisper=None, trim=None, - status_callback_event=None, status_callback=None, - status_callback_method=None, recording_status_callback=None, - recording_status_callback_method=None, - recording_status_callback_event=None, event_callback_url=None, - **kwargs): - """ - Create a <Conference> element - - :param name: Conference name - :param muted: Join the conference muted - :param beep: Play beep when joining - :param start_conference_on_enter: Start the conference on enter - :param end_conference_on_exit: End the conferenceon exit - :param wait_url: Wait URL - :param wait_method: Wait URL method - :param max_participants: Maximum number of participants - :param record: Record the conference - :param region: Conference region - :param whisper: Call whisper - :param trim: Trim the conference recording - :param status_callback_event: Events to call status callback URL - :param status_callback: Status callback URL - :param status_callback_method: Status callback URL method - :param recording_status_callback: Recording status callback URL - :param recording_status_callback_method: Recording status callback URL method - :param recording_status_callback_event: Recording status callback events - :param event_callback_url: Event callback URL - :param kwargs: additional attributes - - :returns: <Conference> element - """ - return self.nest(Conference( - name, - muted=muted, - beep=beep, - start_conference_on_enter=start_conference_on_enter, - end_conference_on_exit=end_conference_on_exit, - wait_url=wait_url, - wait_method=wait_method, - max_participants=max_participants, - record=record, - region=region, - whisper=whisper, - trim=trim, - status_callback_event=status_callback_event, - status_callback=status_callback, - status_callback_method=status_callback_method, - recording_status_callback=recording_status_callback, - recording_status_callback_method=recording_status_callback_method, - recording_status_callback_event=recording_status_callback_event, - event_callback_url=event_callback_url, - **kwargs - )) - - def number(self, phone_number, send_digits=None, url=None, method=None, - status_callback_event=None, status_callback=None, - status_callback_method=None, **kwargs): - """ - Create a <Number> element - - :param phone_number: Phone Number to dial - :param send_digits: DTMF tones to play when the call is answered - :param url: TwiML URL - :param method: TwiML URL method - :param status_callback_event: Events to call status callback - :param status_callback: Status callback URL - :param status_callback_method: Status callback URL method - :param kwargs: additional attributes - - :returns: <Number> element - """ - return self.nest(Number( - phone_number, - send_digits=send_digits, - url=url, - method=method, - status_callback_event=status_callback_event, - status_callback=status_callback, - status_callback_method=status_callback_method, - **kwargs - )) - - def queue(self, name, url=None, method=None, reservation_sid=None, - post_work_activity_sid=None, **kwargs): - """ - Create a <Queue> element - - :param name: Queue name - :param url: Action URL - :param method: Action URL method - :param reservation_sid: TaskRouter Reservation SID - :param post_work_activity_sid: TaskRouter Activity SID - :param kwargs: additional attributes - - :returns: <Queue> element - """ - return self.nest(Queue( - name, - url=url, - method=method, - reservation_sid=reservation_sid, - post_work_activity_sid=post_work_activity_sid, - **kwargs - )) - - def sim(self, sim_sid, **kwargs): - """ - Create a <Sim> element - - :param sim_sid: SIM SID - :param kwargs: additional attributes - - :returns: <Sim> element - """ - return self.nest(Sim(sim_sid, **kwargs)) - - def sip(self, sip_url, username=None, password=None, url=None, method=None, - status_callback_event=None, status_callback=None, - status_callback_method=None, **kwargs): - """ - Create a <Sip> element - - :param sip_url: SIP URL - :param username: SIP Username - :param password: SIP Password - :param url: Action URL - :param method: Action URL method - :param status_callback_event: Status callback events - :param status_callback: Status callback URL - :param status_callback_method: Status callback URL method - :param kwargs: additional attributes - - :returns: <Sip> element - """ - return self.nest(Sip( - sip_url, - username=username, - password=password, - url=url, - method=method, - status_callback_event=status_callback_event, - status_callback=status_callback, - status_callback_method=status_callback_method, - **kwargs - )) - - -class Sip(TwiML): - """ <Sip> TwiML Noun """ - - def __init__(self, sip_url, **kwargs): - super(Sip, self).__init__(**kwargs) - self.name = 'Sip' - self.value = sip_url - - -class Sim(TwiML): - """ <Sim> TwiML Noun """ - - def __init__(self, sim_sid, **kwargs): - super(Sim, self).__init__(**kwargs) - self.name = 'Sim' - self.value = sim_sid - - -class Number(TwiML): - """ <Number> TwiML Noun """ - - def __init__(self, phone_number, **kwargs): - super(Number, self).__init__(**kwargs) - self.name = 'Number' - self.value = phone_number - - -class Conference(TwiML): - """ <Conference> TwiML Noun """ - - def __init__(self, name, **kwargs): - super(Conference, self).__init__(**kwargs) - self.name = 'Conference' - self.value = name - - -class Client(TwiML): - """ <Client> TwiML Noun """ - - def __init__(self, name, **kwargs): - super(Client, self).__init__(**kwargs) - self.name = 'Client' - self.value = name