This commit is contained in:
“wp510429074” 2025-08-19 18:20:23 +08:00
parent 17756f5c54
commit 19422d883a
11240 changed files with 1563731 additions and 0 deletions

7
.idea/vcs.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/WeWorkFinanceSdk" vcs="Git" />
</component>
</project>

38
Dockerfile Normal file
View File

@ -0,0 +1,38 @@
# 基础镜像
FROM python:3.10-slim
# 设置工作目录
WORKDIR /app
# 复制并安装依赖
COPY requirements.txt .
RUN pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple/ && \
pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
# 复制项目
COPY WeWorkFinanceSdk/ /app/WeWorkFinanceSdk/
COPY dingdingSdk/ /app/dingdingSdk/
COPY oapiSdk/ /app/oapiSdk/
# 复制统一入口文件
COPY main_app.py /app/main_app.py
# 复制 .so 到 /usr/local/lib仅 WeWorkFinanceSdk 需要)
COPY WeWorkFinanceSdk/C_sdk/libWeWorkFinanceSdk_C.so /usr/local/lib/
RUN chmod 755 /usr/local/lib/libWeWorkFinanceSdk_C.so
# 确保 ld 可以找到
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
ENV PYTHONPATH=/app/WeWorkFinanceSdk:/app/dingdingSdk:/app/oapiSdk:$PYTHONPATH
# 暴露 Flask 端口
EXPOSE 5000
# 启动统一入口
ENV FLASK_APP=main_app.py
ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_ENV=development
ENV PYTHONUNBUFFERED=1
CMD ["flask", "run"]

1
WeWorkFinanceSdk Submodule

@ -0,0 +1 @@
Subproject commit 9470c48d89bd320c1b35d45ba5a3a4916ccf8cea

66
baiduSdk/.gitignore vendored Normal file
View File

@ -0,0 +1,66 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
venv/
.venv/
.python-version
.pytest_cache
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/
#Ipython Notebook
.ipynb_checkpoints

24
baiduSdk/.gitlab-ci.yml Normal file
View File

@ -0,0 +1,24 @@
# ref: https://docs.gitlab.com/ee/ci/README.html
stages:
- test
.tests:
stage: test
script:
- pip install -r requirements.txt
- pip install -r test-requirements.txt
- pytest --cov=openapi_client
test-3.6:
extends: .tests
image: python:3.6-alpine
test-3.7:
extends: .tests
image: python:3.7-alpine
test-3.8:
extends: .tests
image: python:3.8-alpine
test-3.9:
extends: .tests
image: python:3.9-alpine

View File

@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

13
baiduSdk/.travis.yml Normal file
View File

@ -0,0 +1,13 @@
# ref: https://docs.travis-ci.com/user/languages/python
language: python
python:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
# command to install dependencies
install:
- "pip install -r requirements.txt"
- "pip install -r test-requirements.txt"
# command to run tests
script: pytest --cov=openapi_client

15
baiduSdk/Dockerfile Normal file
View File

@ -0,0 +1,15 @@
# 使用轻量级 Python 镜像
FROM python:3.9-slim
# 设置工作目录
WORKDIR /app
# 安装依赖
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 拷贝应用代码
COPY . .
# 设置容器启动命令
CMD ["python", "main.py"]

18
baiduSdk/config.py Normal file
View File

@ -0,0 +1,18 @@
AppID=119808496
AppKey="ul3EtBgVxp9P0UO4LNwQk3e9W1Ofuepo"
Secretkey="Qd4QNZ1qsJOwMuOqttSrbKks0pv88wjt"
Signkey="zbElHt884iyYH3i~7wDjkFcG6G3loF7="
REDIRECT_URI = "oob" # 授权回调地址
CODE_SCOPE = "basic,netdisk" #权限
CATEGORY_MAP = {
1: "视频",
2: "音乐",
3: "图片",
4: "文档",
5: "应用",
6: "其他",
7: "种子"
}

2
baiduSdk/configToken.py Normal file
View File

@ -0,0 +1,2 @@
ACCESS_TOKEN = "121.5c5dd8c5f0f70dad0c180f80b808e8f0.YCfP62hOZCv2fEZbTTKc80Z2z5aLGoZCSQZerWe.v7IOJA"
REFRESH_TOKEN = "122.013df9f8b7be1b5a62f0141ead5881e8.YghTelESkSsWhgmgiFiMznMtTdnr5LTQJacyhwe.u72GPw"

113
baiduSdk/demo/auth.py Normal file
View File

@ -0,0 +1,113 @@
# !/usr/bin/env python3
"""
xpan auth
include:
authorization_code, just get token by code
refresh_token
device_code
"""
import os,sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
import openapi_client
from baiduSdk.openapi_client.api import auth_api
from baiduSdk.openapi_client.model.oauth_token_authorization_code_response import OauthTokenAuthorizationCodeResponse
from baiduSdk.openapi_client.model.oauth_token_refresh_token_response import OauthTokenRefreshTokenResponse
from baiduSdk.openapi_client.model.oauth_token_device_code_response import OauthTokenDeviceCodeResponse
from baiduSdk.openapi_client.model.oauth_token_device_token_response import OauthTokenDeviceTokenResponse
from pprint import pprint
from config import AppID,AppKey,Secretkey,Signkey
def oauthtoken_authorizationcode():
"""
authorizationcode
get token by authorization code
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = auth_api.AuthApi(api_client)
code = "3ce3370c960ce929306c419d32f92df1" # str |
client_id = "R2Ai3Qcsq2IYP2EXC3A8lmpkQ22iujVh" # str |
client_secret = "KMbyNtHpPkPq7KGGGKrQqunHRi2LMYjU" # str |
redirect_uri = "oob" # str |
# example passing only required values which don't have defaults set
try:
api_response = api_instance.oauth_token_code2token(code, client_id, client_secret, redirect_uri)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling AuthApi->oauth_token_code2token: %s\n" % e)
def oauthtoken_refreshtoken():
"""
refresh access token
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = auth_api.AuthApi(api_client)
refresh_token = "122.5d587a6620cf03ebd221374097d5342a.Y3l9RzmaC4A1xq2F4xQtCnhIb4Ecp0citCARk0T.Uk3m_w" # str |
client_id = "R2Ai3Qcsq2IYP2EXC3A8lmpkQ22iujVh" # str |
client_secret = "KMbyNtHpPkPq7KGGGKrQqunHRi2LMYjU" # str |
# example passing only required values which don't have defaults set
try:
api_response = api_instance.oauth_token_refresh_token(refresh_token, client_id, client_secret)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling AuthApi->oauth_token_refresh_token: %s\n" % e)
def oauthtoken_devicecode():
"""
devicecode
get device code
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = auth_api.AuthApi(api_client)
client_id = "R2Ai3Qcsq2IYP2EXC3A8lmpkQ22iujVh" # str |
scope = "basic,netdisk" # str |
# example passing only required values which don't have defaults set
try:
api_response = api_instance.oauth_token_device_code(client_id, scope)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling AuthApi->oauth_token_device_code: %s\n" % e)
def oauthtoken_devicetoken():
"""
get token by device code
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = auth_api.AuthApi(api_client)
code = "1dc8cf189c863f094d25843dbbd3f633" # str |
client_id = "R2Ai3Qcsq2IYP2EXC3A8lmpkQ22iujVh" # str |
client_secret = "KMbyNtHpPkPq7KGGGKrQqunHRi2LMYjU" # str |
# example passing only required values which don't have defaults set
try:
api_response = api_instance.oauth_token_device_token(code, client_id, client_secret)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling AuthApi->oauth_token_device_token: %s\n" % e)
if __name__ == '__main__':
"""
main
"""
oauthtoken_authorizationcode()
oauthtoken_refreshtoken()
oauthtoken_devicecode()
oauthtoken_devicetoken()

5
baiduSdk/demo/config.py Normal file
View File

@ -0,0 +1,5 @@
AppID=119808496
AppKey="ul3EtBgVxp9P0UO4LNwQk3e9W1Ofuepo"
Secretkey="Qd4QNZ1qsJOwMuOqttSrbKks0pv88wjt"
Signkey="zbElHt884iyYH3i~7wDjkFcG6G3loF7="
ACCESS_TOKEN= "121.a8b34472c7bcd34d09d208867e6c731e.YCAyzVMIm4UPOr4VBYq5ScZ8oFQNB0yt7OEHL85.Brah3Q"

131
baiduSdk/demo/fileinfo.py Normal file
View File

@ -0,0 +1,131 @@
# !/usr/bin/env python3
"""
xpan fileinfo
include:
search
doclist
imagelist
filelist
"""
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
from pprint import pprint
from baiduSdk.openapi_client.api import fileinfo_api
import openapi_client
def search():
"""
search
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fileinfo_api.FileinfoApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
key = "老友记" # str |
web = "1" # str | (optional)
num = "2" # str | (optional)
page = "1" # str | (optional)
dir = "/" # str | (optional)
recursion = "1" # str | (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.xpanfilesearch(
access_token, key, web=web, num=num, page=page, dir=dir, recursion=recursion)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling FileinfoApi->xpanfilesearch: %s\n" % e)
def doclist():
"""
doclist
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fileinfo_api.FileinfoApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
parent_path = "/" # str | (optional)
recursion = "1" # str | (optional)
page = 1 # int | (optional)
num = 2 # int | (optional)
order = "time" # str | (optional)
desc = "1" # str | (optional)
web = "1" # str | (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.xpanfiledoclist(
access_token, parent_path=parent_path, recursion=recursion, page=page, num=num, order=order, desc=desc, web=web)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling FileinfoApi->xpanfiledoclist: %s\n" % e)
def imagelist():
"""
imagelist
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fileinfo_api.FileinfoApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
parent_path = "/" # str | (optional)
recursion = "1" # str | (optional)
page = 1 # int | (optional)
num = 2 # int | (optional)
order = "time" # str | (optional)
desc = "1" # str | (optional)
web = "1" # str | (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.xpanfileimagelist(
access_token, parent_path=parent_path, recursion=recursion, page=page, num=num, order=order, desc=desc, web=web)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling FileinfoApi->xpanfileimagelist: %s\n" % e)
def filelist():
"""
filelist
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fileinfo_api.FileinfoApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
dir = "/" # str | (optional)
folder = "0" # str | (optional)
start = "0" # str | (optional)
limit = 2 # int | (optional)
order = "time" # str | (optional)
desc = 1 # int | (optional)
web = "web" # str | (optional)
showempty = 1 # int | (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.xpanfilelist(
access_token, dir=dir, folder=folder, start=start, limit=limit, order=order, desc=desc, web=web, showempty=showempty)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling FileinfoApi->xpanfilelist: %s\n" % e)
if __name__ == '__main__':
search()
doclist()
imagelist()
filelist()

View File

@ -0,0 +1,112 @@
# !/usr/bin/env python3
"""
xpan filemanager
include:
filemanager move
filemanager copy
filemanager remove
filemanager delete
"""
import os,sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
from pprint import pprint
import openapi_client
from baiduSdk.openapi_client.api import filemanager_api
def move():
"""
filemanager move
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = filemanager_api.FilemanagerApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
_async = 1 # int | async
# str | filelist
filelist = '[{"path":"/test/123456.docx","dest":"/test/abc","newname":"123456.docx","ondup":"overwrite"}]'
ondup = "overwrite" # str | ondup (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.filemanagermove(
access_token, _async, filelist, ondup=ondup)
print(api_response)
except openapi_client.ApiException as e:
print("Exception when calling FilemanagerApi->filemanagermove: %s\n" % e)
def copy():
"""
filemanager copy
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = filemanager_api.FilemanagerApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
_async = 1 # int | async
# str | filelist
filelist = '[{"path":"/test/123456.docx","dest":"/test/abc","newname":"123.docx","ondup":"overwrite"}]'
# example passing only required values which don't have defaults set
try:
api_response = api_instance.filemanagercopy(access_token, _async, filelist)
print(api_response)
except openapi_client.ApiException as e:
print("Exception when calling FilemanagerApi->filemanagercopy: %s\n" % e)
def rename():
"""
filemanager rename
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = filemanager_api.FilemanagerApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
_async = 1 # int | async
filelist = '[{"path":"/test/123456.docx","newname":"123.docx"}]' # str | filelist
ondup = "overwrite" # str | ondup (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.filemanagerrename(
access_token, _async, filelist, ondup=ondup)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling FilemanagerApi->filemanagerrename: %s\n" % e)
def delete():
"""
filemanager delete
"""
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = filemanager_api.FilemanagerApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
_async = 1 # int | async
filelist = '[{"path":"/test/123456.docx"}]' # str | filelist
ondup = "overwrite" # str | ondup (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.filemanagerdelete(
access_token, _async, filelist, ondup=ondup)
print(api_response)
except openapi_client.ApiException as e:
print("Exception when calling FilemanagerApi->filemanagerdelete: %s\n" % e)
if __name__ == '__main__':
copy()
move()
rename()
delete()

View File

@ -0,0 +1,72 @@
# !/usr/bin/env python3
"""
xpan multimedia file
include:
listall
filemetas
"""
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
from pprint import pprint
from baiduSdk.openapi_client.api import multimediafile_api
import openapi_client
import time
def listall():
"""
listall
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = multimediafile_api.MultimediafileApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
path = "/" # str |
recursion = 1 # int |
web = "1" # str | (optional)
start = 0 # int | (optional)
limit = 2 # int | (optional)
order = "time" # str | (optional)
desc = 1 # int | (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.xpanfilelistall(
access_token, path, recursion, web=web, start=start, limit=limit, order=order, desc=desc)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling MultimediafileApi->xpanfilelistall: %s\n" % e)
def filemetas():
"""
filemetas
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = multimediafile_api.MultimediafileApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
fsids = "[258813175385405]" # str |
thumb = "1" # str | (optional)
extra = "1" # str | (optional)
dlink = "1" # str | (optional)
needmedia = 1 # int | (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.xpanmultimediafilemetas(
access_token, fsids, thumb=thumb, extra=extra, dlink=dlink, needmedia=needmedia)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling MultimediafileApi->xpanmultimediafilemetas: %s\n" % e)
if __name__ == '__main__':
listall()
filemetas()

0
baiduSdk/demo/test.py Normal file
View File

101
baiduSdk/demo/upload.py Normal file
View File

@ -0,0 +1,101 @@
# !/usr/bin/env python3
"""
xpan upload
include:
precreate
upload
create
"""
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
from pprint import pprint
from baiduSdk.openapi_client.api import fileupload_api
import openapi_client
def precreate():
"""
precreate
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fileupload_api.FileuploadApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
path = "/apps/hhhkoo/a.txt" # str | 对于一般的第三方软件应用,路径以 "/apps/your-app-name/" 开头。对于小度等硬件应用,路径一般 "/来自:小度设备/" 开头。对于定制化配置的硬件应用,根据配置情况进行填写。
isdir = 0 # int | isdir
size = 271 # int | size
autoinit = 1 # int | autoinit
block_list = '["d05f84cf5340d1ef0c5f6d6eb8ce13b8"]' # str | 由MD5字符串组成的list
rtype = 3 # int | rtype (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.xpanfileprecreate(
access_token, path, isdir, size, autoinit, block_list, rtype=rtype)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling FileuploadApi->xpanfileprecreate: %s\n" % e)
def upload():
"""
upload
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fileupload_api.FileuploadApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
partseq = "0" # str |
path = "/apps/hhhkoo/a.txt" # str |
uploadid = "N1-MTA2LjEzLjc2LjI0MDoxNjU0NTAwMDE0OjE3NDEzNzMyMTUxNTY1MTA2MQ==" # str |
type = "tmpfile" # str |
try:
file = open('./uploadtestdata/a.txt', 'rb') # file_type | 要进行传送的本地文件分片
except Exception as e:
print("Exception when open file: %s\n" % e)
exit(-1)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.pcssuperfile2(
access_token, partseq, path, uploadid, type, file=file)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling FileuploadApi->pcssuperfile2: %s\n" % e)
def create():
"""
create
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fileupload_api.FileuploadApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
path = "/apps/hhhkoo/a.txt" # str | 与precreate的path值保持一致
isdir = 0 # int | isdir
size = 271 # int | 与precreate的size值保持一致
uploadid = "N1-MTA2LjEzLjc2LjI0MDoxNjU0NTAwMDE0OjE3NDEzNzMyMTUxNTY1MTA2MQ==" # str | precreate返回的uploadid
block_list = '["d05f84cf5340d1ef0c5f6d6eb8ce13b8"]' # str | 与precreate的block_list值保持一致
rtype = 3 # int | rtype (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.xpanfilecreate(
access_token, path, isdir, size, uploadid, block_list, rtype=rtype)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling FileuploadApi->xpanfilecreate: %s\n" % e)
if __name__ == '__main__':
precreate()
upload()
create()

View File

@ -0,0 +1,4 @@
那榆荫下的一潭, That pool under the shade of elm trees
不是清泉,是天上虹; Holds not water but the rainbow from the sky;
揉碎在浮藻间, Shattered to pieces among the duckweeds
沉淀着彩虹似的梦。 Is the sediment of a rainbow-like dream.

61
baiduSdk/demo/userinfo.py Normal file
View File

@ -0,0 +1,61 @@
# !/usr/bin/env python3
"""
xpan userinfo
include:
user_info
user_quota
"""
import os,sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
import openapi_client
from baiduSdk.openapi_client.api import userinfo_api
from baiduSdk.openapi_client.model.quotaresponse import Quotaresponse
from baiduSdk.openapi_client.model.uinforesponse import Uinforesponse
from pprint import pprint
def user_quota():
"""
user_quota demo
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = userinfo_api.UserinfoApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
checkexpire = 1 # int | (optional)
checkfree = 1 # int | (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.apiquota(access_token, checkexpire=checkexpire, checkfree=checkfree)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling UserinfoApi->apiquota: %s\n" % e)
def user_info():
"""
user_info demo
"""
# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
# Create an instance of the API class
api_instance = userinfo_api.UserinfoApi(api_client)
access_token = "123.56c5d1f8eedf1f9404c547282c5dbcf4.YmmjpAlsjUFbPly3mJizVYqdfGDLsBaY5pyg3qL.a9IIIQ" # str |
# example passing only required values which don't have defaults set
try:
api_response = api_instance.xpannasuinfo(access_token)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling UserinfoApi->xpannasuinfo: %s\n" % e)
if __name__ == '__main__':
"""
main
"""
user_quota()
user_info()

124
baiduSdk/main.py Normal file
View File

@ -0,0 +1,124 @@
from flask import Flask, request, jsonify, redirect, url_for
from config import AppID,AppKey,Secretkey,Signkey,CODE_SCOPE,REDIRECT_URI
from configToken import ACCESS_TOKEN,REFRESH_TOKEN
import requests
import urllib
app = Flask(__name__)
def update_config_token(access_token, refresh_token):
"""
更新 config.py 中的 ACCESS_TOKEN REFRESH_TOKEN
"""
with open("configToken.py", "w") as f:
f.write(f'ACCESS_TOKEN = "{access_token}"\n')
f.write(f'REFRESH_TOKEN = "{refresh_token}"\n')
@app.route('/oauth_url', methods=['GET'])
def get_baidu_oauth_url():
"""
返回百度 OAuth 2.0 授权 URL
"""
base_url = "https://openapi.baidu.com/oauth/2.0/authorize"
response_type = "code"
# 构建完整 URL
oauth_url = (
f"{base_url}?"
f"response_type={response_type}&"
f"client_id={AppKey}&"
f"redirect_uri={REDIRECT_URI}&"
f"scope={CODE_SCOPE}&"
f"device_id={AppID}"
)
return jsonify({"oauth_url": oauth_url})
@app.route('/get_token', methods=['GET'])
def get_baidu_token():
"""
使用用户授权码换取 access_token
GET 参数: code
"""
code = request.args.get('code')
if not code:
return jsonify({"error": "缺少 code 参数"}), 400
headers = {
'User-Agent': 'pan.baidu.com'
}
token_url = "https://openapi.baidu.com/oauth/2.0/token"
params = {
"grant_type": "authorization_code",
"code": code,
"client_id": AppKey,
"client_secret": Secretkey,
"redirect_uri": REDIRECT_URI
}
response = requests.get(token_url, params=params,headers=headers)
data = response.json()
# 如果返回了 access_token 和 refresh_token就更新 config.py
if "access_token" in data and "refresh_token" in data:
update_config_token(data["access_token"], data["refresh_token"])
return jsonify(data)
@app.route('/refresh_token', methods=['GET'])
def refresh_baidu_token():
"""
使用 refresh_token 刷新 access_token
GET 参数: refresh_token
"""
refresh_token = REFRESH_TOKEN
token_url = "https://openapi.baidu.com/oauth/2.0/token"
params = {
"grant_type": "refresh_token",
"refresh_token": refresh_token,
"client_id": AppKey,
"client_secret": Secretkey,
}
response = requests.get(token_url, params=params)
data = response.json()
# 如果返回了 access_token 和 refresh_token就更新 config.py
if "access_token" in data and "refresh_token" in data:
update_config_token(data["access_token"], data["refresh_token"])
return jsonify(data)
@app.route('/list_files', methods=['GET'])
def list_files():
"""
获取百度网盘指定目录下的文件列表
GET 参数:
- access_token: 必须
- path: 必须目录绝对路径中文需URL编码
- order: 可选排序字段time/name/size
"""
path = request.args.get('path')
order = request.args.get('order', 'type') # 默认按文件类型排序
if not path:
return jsonify({"error": "缺少 access_token 或 path 参数"}), 400
BAIDU_PAN_API = "https://pan.baidu.com/rest/2.0/xpan/multimedia"
# 中文路径 URL 编码
path_encoded = urllib.parse.quote(path)
params = {
"method": "listall",
"access_token": ACCESS_TOKEN,
"path": path_encoded,
"order": order
}
response = requests.get(BAIDU_PAN_API, params=params)
try:
data = response.json()
except Exception as e:
return jsonify({"error": "返回结果不是 JSON", "detail": str(e)}), 500
return jsonify(data)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)

View File

@ -0,0 +1,27 @@
# flake8: noqa
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
__version__ = "1.0.0"
# import ApiClient
from openapi_client.api_client import ApiClient
# import Configuration
from openapi_client.configuration import Configuration
# import exceptions
from openapi_client.exceptions import OpenApiException
from openapi_client.exceptions import ApiAttributeError
from openapi_client.exceptions import ApiTypeError
from openapi_client.exceptions import ApiValueError
from openapi_client.exceptions import ApiKeyError
from openapi_client.exceptions import ApiException

View File

@ -0,0 +1,6 @@
"""
__init__.py
"""
# do not import all apis into this module because that uses a lot of memory and stack frames
# if you need the ability to import all apis from one package, import them with
# from openapi_client.apis import AuthApi

View File

@ -0,0 +1,649 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from openapi_client.api_client import ApiClient, Endpoint as _Endpoint
from openapi_client.model_utils import ( # noqa: F401
check_allowed_values,
check_validations,
date,
datetime,
file_type,
none_type,
validate_and_convert_types
)
from baiduSdk.openapi_client.model.oauth_token_authorization_code_response import OauthTokenAuthorizationCodeResponse
from baiduSdk.openapi_client.model.oauth_token_device_code_response import OauthTokenDeviceCodeResponse
from baiduSdk.openapi_client.model.oauth_token_device_token_response import OauthTokenDeviceTokenResponse
from baiduSdk.openapi_client.model.oauth_token_refresh_token_response import OauthTokenRefreshTokenResponse
class AuthApi(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
self.oauth_token_code2token_endpoint = _Endpoint(
settings={
'response_type': (OauthTokenAuthorizationCodeResponse,),
'auth': [],
'endpoint_path': '/oauth/2.0/token?grant_type=authorization_code&openapi=xpansdk',
'operation_id': 'oauth_token_code2token',
'http_method': 'GET',
'servers': [
{
'url': "https://openapi.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'code',
'client_id',
'client_secret',
'redirect_uri',
],
'required': [
'code',
'client_id',
'client_secret',
'redirect_uri',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'code':
(str,),
'client_id':
(str,),
'client_secret':
(str,),
'redirect_uri':
(str,),
},
'attribute_map': {
'code': 'code',
'client_id': 'client_id',
'client_secret': 'client_secret',
'redirect_uri': 'redirect_uri',
},
'location_map': {
'code': 'query',
'client_id': 'query',
'client_secret': 'query',
'redirect_uri': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; charset=UTF-8'
],
'content_type': [],
},
api_client=api_client
)
self.oauth_token_device_code_endpoint = _Endpoint(
settings={
'response_type': (OauthTokenDeviceCodeResponse,),
'auth': [],
'endpoint_path': '/oauth/2.0/device/code?response_type=device_code&openapi=xpansdk',
'operation_id': 'oauth_token_device_code',
'http_method': 'GET',
'servers': [
{
'url': "https://openapi.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'client_id',
'scope',
],
'required': [
'client_id',
'scope',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'client_id':
(str,),
'scope':
(str,),
},
'attribute_map': {
'client_id': 'client_id',
'scope': 'scope',
},
'location_map': {
'client_id': 'query',
'scope': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; charset=UTF-8'
],
'content_type': [],
},
api_client=api_client
)
self.oauth_token_device_token_endpoint = _Endpoint(
settings={
'response_type': (OauthTokenDeviceTokenResponse,),
'auth': [],
'endpoint_path': '/oauth/2.0/token?grant_type=device_token&openapi=xpansdk',
'operation_id': 'oauth_token_device_token',
'http_method': 'GET',
'servers': [
{
'url': "https://openapi.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'code',
'client_id',
'client_secret',
],
'required': [
'code',
'client_id',
'client_secret',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'code':
(str,),
'client_id':
(str,),
'client_secret':
(str,),
},
'attribute_map': {
'code': 'code',
'client_id': 'client_id',
'client_secret': 'client_secret',
},
'location_map': {
'code': 'query',
'client_id': 'query',
'client_secret': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; charset=UTF-8'
],
'content_type': [],
},
api_client=api_client
)
self.oauth_token_refresh_token_endpoint = _Endpoint(
settings={
'response_type': (OauthTokenRefreshTokenResponse,),
'auth': [],
'endpoint_path': '/oauth/2.0/token?grant_type=refresh_token&openapi=xpansdk',
'operation_id': 'oauth_token_refresh_token',
'http_method': 'GET',
'servers': [
{
'url': "https://openapi.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'refresh_token',
'client_id',
'client_secret',
],
'required': [
'refresh_token',
'client_id',
'client_secret',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'refresh_token':
(str,),
'client_id':
(str,),
'client_secret':
(str,),
},
'attribute_map': {
'refresh_token': 'refresh_token',
'client_id': 'client_id',
'client_secret': 'client_secret',
},
'location_map': {
'refresh_token': 'query',
'client_id': 'query',
'client_secret': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; charset=UTF-8'
],
'content_type': [],
},
api_client=api_client
)
def oauth_token_code2token(
self,
code,
client_id,
client_secret,
redirect_uri,
**kwargs
):
"""oauth_token_code2token # noqa: E501
get accesstoken by authorization code # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.oauth_token_code2token(code, client_id, client_secret, redirect_uri, async_req=True)
>>> result = thread.get()
Args:
code (str):
client_id (str):
client_secret (str):
redirect_uri (str):
Keyword Args:
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
OauthTokenAuthorizationCodeResponse
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['code'] = \
code
kwargs['client_id'] = \
client_id
kwargs['client_secret'] = \
client_secret
kwargs['redirect_uri'] = \
redirect_uri
return self.oauth_token_code2token_endpoint.call_with_http_info(**kwargs)
def oauth_token_device_code(
self,
client_id,
scope,
**kwargs
):
"""oauth_token_device_code # noqa: E501
get device code and user code # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.oauth_token_device_code(client_id, scope, async_req=True)
>>> result = thread.get()
Args:
client_id (str):
scope (str):
Keyword Args:
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
OauthTokenDeviceCodeResponse
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['client_id'] = \
client_id
kwargs['scope'] = \
scope
return self.oauth_token_device_code_endpoint.call_with_http_info(**kwargs)
def oauth_token_device_token(
self,
code,
client_id,
client_secret,
**kwargs
):
"""oauth_token_device_token # noqa: E501
get access_token # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.oauth_token_device_token(code, client_id, client_secret, async_req=True)
>>> result = thread.get()
Args:
code (str):
client_id (str):
client_secret (str):
Keyword Args:
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
OauthTokenDeviceTokenResponse
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['code'] = \
code
kwargs['client_id'] = \
client_id
kwargs['client_secret'] = \
client_secret
return self.oauth_token_device_token_endpoint.call_with_http_info(**kwargs)
def oauth_token_refresh_token(
self,
refresh_token,
client_id,
client_secret,
**kwargs
):
"""oauth_token_refresh_token # noqa: E501
authorization code # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.oauth_token_refresh_token(refresh_token, client_id, client_secret, async_req=True)
>>> result = thread.get()
Args:
refresh_token (str):
client_id (str):
client_secret (str):
Keyword Args:
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
OauthTokenRefreshTokenResponse
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['refresh_token'] = \
refresh_token
kwargs['client_id'] = \
client_id
kwargs['client_secret'] = \
client_secret
return self.oauth_token_refresh_token_endpoint.call_with_http_info(**kwargs)

View File

@ -0,0 +1,737 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from openapi_client.api_client import ApiClient, Endpoint as _Endpoint
from openapi_client.model_utils import ( # noqa: F401
check_allowed_values,
check_validations,
date,
datetime,
file_type,
none_type,
validate_and_convert_types
)
class FileinfoApi(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
self.xpanfiledoclist_endpoint = _Endpoint(
settings={
'response_type': (dict,),
'auth': [],
'endpoint_path': '/rest/2.0/xpan/file?method=doclist&openapi=xpansdk',
'operation_id': 'xpanfiledoclist',
'http_method': 'GET',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'parent_path',
'recursion',
'page',
'num',
'order',
'desc',
'web',
],
'required': [
'access_token',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'parent_path':
(str,),
'recursion':
(str,),
'page':
(int,),
'num':
(int,),
'order':
(str,),
'desc':
(str,),
'web':
(str,),
},
'attribute_map': {
'access_token': 'access_token',
'parent_path': 'parent_path',
'recursion': 'recursion',
'page': 'page',
'num': 'num',
'order': 'order',
'desc': 'desc',
'web': 'web',
},
'location_map': {
'access_token': 'query',
'parent_path': 'query',
'recursion': 'query',
'page': 'query',
'num': 'query',
'order': 'query',
'desc': 'query',
'web': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; charset=UTF-8'
],
'content_type': [],
},
api_client=api_client
)
self.xpanfileimagelist_endpoint = _Endpoint(
settings={
'response_type': (dict,),
'auth': [],
'endpoint_path': '/rest/2.0/xpan/file?method=imagelist&openapi=xpansdk',
'operation_id': 'xpanfileimagelist',
'http_method': 'GET',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'parent_path',
'recursion',
'page',
'num',
'order',
'desc',
'web',
],
'required': [
'access_token',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'parent_path':
(str,),
'recursion':
(str,),
'page':
(int,),
'num':
(int,),
'order':
(str,),
'desc':
(str,),
'web':
(str,),
},
'attribute_map': {
'access_token': 'access_token',
'parent_path': 'parent_path',
'recursion': 'recursion',
'page': 'page',
'num': 'num',
'order': 'order',
'desc': 'desc',
'web': 'web',
},
'location_map': {
'access_token': 'query',
'parent_path': 'query',
'recursion': 'query',
'page': 'query',
'num': 'query',
'order': 'query',
'desc': 'query',
'web': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; charset=UTF-8'
],
'content_type': [],
},
api_client=api_client
)
self.xpanfilelist_endpoint = _Endpoint(
settings={
'response_type': (dict,),
'auth': [],
'endpoint_path': '/rest/2.0/xpan/file?method=list&openapi=xpansdk',
'operation_id': 'xpanfilelist',
'http_method': 'GET',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'dir',
'folder',
'start',
'limit',
'order',
'desc',
'web',
'showempty',
],
'required': [
'access_token',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'dir':
(str,),
'folder':
(str,),
'start':
(str,),
'limit':
(int,),
'order':
(str,),
'desc':
(int,),
'web':
(str,),
'showempty':
(int,),
},
'attribute_map': {
'access_token': 'access_token',
'dir': 'dir',
'folder': 'folder',
'start': 'start',
'limit': 'limit',
'order': 'order',
'desc': 'desc',
'web': 'web',
'showempty': 'showempty',
},
'location_map': {
'access_token': 'query',
'dir': 'query',
'folder': 'query',
'start': 'query',
'limit': 'query',
'order': 'query',
'desc': 'query',
'web': 'query',
'showempty': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; charset=UTF-8'
],
'content_type': [],
},
api_client=api_client
)
self.xpanfilesearch_endpoint = _Endpoint(
settings={
'response_type': (dict,),
'auth': [],
'endpoint_path': '/rest/2.0/xpan/file?method=search&openapi=xpansdk',
'operation_id': 'xpanfilesearch',
'http_method': 'GET',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'key',
'web',
'num',
'page',
'dir',
'recursion',
],
'required': [
'access_token',
'key',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'key':
(str,),
'web':
(str,),
'num':
(str,),
'page':
(str,),
'dir':
(str,),
'recursion':
(str,),
},
'attribute_map': {
'access_token': 'access_token',
'key': 'key',
'web': 'web',
'num': 'num',
'page': 'page',
'dir': 'dir',
'recursion': 'recursion',
},
'location_map': {
'access_token': 'query',
'key': 'query',
'web': 'query',
'num': 'query',
'page': 'query',
'dir': 'query',
'recursion': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; charset=UTF-8'
],
'content_type': [],
},
api_client=api_client
)
def xpanfiledoclist(
self,
access_token,
**kwargs
):
"""xpanfiledoclist # noqa: E501
file doclist # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.xpanfiledoclist(access_token, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
Keyword Args:
parent_path (str): [optional]
recursion (str): [optional]
page (int): [optional]
num (int): [optional]
order (str): [optional]
desc (str): [optional]
web (str): [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
str
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
return self.xpanfiledoclist_endpoint.call_with_http_info(**kwargs)
def xpanfileimagelist(
self,
access_token,
**kwargs
):
"""xpanfileimagelist # noqa: E501
file imagelist # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.xpanfileimagelist(access_token, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
Keyword Args:
parent_path (str): [optional]
recursion (str): [optional]
page (int): [optional]
num (int): [optional]
order (str): [optional]
desc (str): [optional]
web (str): [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
str
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
return self.xpanfileimagelist_endpoint.call_with_http_info(**kwargs)
def xpanfilelist(
self,
access_token,
**kwargs
):
"""xpanfilelist # noqa: E501
file list # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.xpanfilelist(access_token, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
Keyword Args:
dir (str): [optional]
folder (str): [optional]
start (str): [optional]
limit (int): [optional]
order (str): [optional]
desc (int): [optional]
web (str): [optional]
showempty (int): [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
str
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
return self.xpanfilelist_endpoint.call_with_http_info(**kwargs)
def xpanfilesearch(
self,
access_token,
key,
**kwargs
):
"""xpanfilesearch # noqa: E501
file search # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.xpanfilesearch(access_token, key, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
key (str):
Keyword Args:
web (str): [optional]
num (str): [optional]
page (str): [optional]
dir (str): [optional]
recursion (str): [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
str
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
kwargs['key'] = \
key
return self.xpanfilesearch_endpoint.call_with_http_info(**kwargs)

View File

@ -0,0 +1,669 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from openapi_client.api_client import ApiClient, Endpoint as _Endpoint
from openapi_client.model_utils import ( # noqa: F401
check_allowed_values,
check_validations,
date,
datetime,
file_type,
none_type,
validate_and_convert_types
)
class FilemanagerApi(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
self.filemanagercopy_endpoint = _Endpoint(
settings={
'response_type': (dict,),
'auth': [],
'endpoint_path': '/rest/2.0/xpan/file?method=filemanager&opera=copy&openapi=xpansdk',
'operation_id': 'filemanagercopy',
'http_method': 'POST',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'_async',
'filelist',
'ondup',
],
'required': [
'access_token',
'_async',
'filelist',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'_async':
(int,),
'filelist':
(str,),
'ondup':
(str,),
},
'attribute_map': {
'access_token': 'access_token',
'_async': 'async',
'filelist': 'filelist',
'ondup': 'ondup',
},
'location_map': {
'access_token': 'query',
'_async': 'form',
'filelist': 'form',
'ondup': 'form',
},
'collection_format_map': {
}
},
headers_map={
'accept': [],
'content_type': [
'application/x-www-form-urlencoded'
]
},
api_client=api_client
)
self.filemanagerdelete_endpoint = _Endpoint(
settings={
'response_type': (dict,),
'auth': [],
'endpoint_path': '/rest/2.0/xpan/file?method=filemanager&opera=delete&openapi=xpansdk',
'operation_id': 'filemanagerdelete',
'http_method': 'POST',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'_async',
'filelist',
'ondup',
],
'required': [
'access_token',
'_async',
'filelist',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'_async':
(int,),
'filelist':
(str,),
'ondup':
(str,),
},
'attribute_map': {
'access_token': 'access_token',
'_async': 'async',
'filelist': 'filelist',
'ondup': 'ondup',
},
'location_map': {
'access_token': 'query',
'_async': 'form',
'filelist': 'form',
'ondup': 'form',
},
'collection_format_map': {
}
},
headers_map={
'accept': [],
'content_type': [
'application/x-www-form-urlencoded'
]
},
api_client=api_client
)
self.filemanagermove_endpoint = _Endpoint(
settings={
'response_type': (dict,),
'auth': [],
'endpoint_path': '/rest/2.0/xpan/file?method=filemanager&opera=move&openapi=xpansdk',
'operation_id': 'filemanagermove',
'http_method': 'POST',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'_async',
'filelist',
'ondup',
],
'required': [
'access_token',
'_async',
'filelist',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'_async':
(int,),
'filelist':
(str,),
'ondup':
(str,),
},
'attribute_map': {
'access_token': 'access_token',
'_async': 'async',
'filelist': 'filelist',
'ondup': 'ondup',
},
'location_map': {
'access_token': 'query',
'_async': 'form',
'filelist': 'form',
'ondup': 'form',
},
'collection_format_map': {
}
},
headers_map={
'accept': [],
'content_type': [
'application/x-www-form-urlencoded'
]
},
api_client=api_client
)
self.filemanagerrename_endpoint = _Endpoint(
settings={
'response_type': (dict,),
'auth': [],
'endpoint_path': '/rest/2.0/xpan/file?method=filemanager&opera=rename&openapi=xpansdk',
'operation_id': 'filemanagerrename',
'http_method': 'POST',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'_async',
'filelist',
'ondup',
],
'required': [
'access_token',
'_async',
'filelist',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'_async':
(int,),
'filelist':
(str,),
'ondup':
(str,),
},
'attribute_map': {
'access_token': 'access_token',
'_async': 'async',
'filelist': 'filelist',
'ondup': 'ondup',
},
'location_map': {
'access_token': 'query',
'_async': 'form',
'filelist': 'form',
'ondup': 'form',
},
'collection_format_map': {
}
},
headers_map={
'accept': [],
'content_type': [
'application/x-www-form-urlencoded'
]
},
api_client=api_client
)
def filemanagercopy(
self,
access_token,
_async,
filelist,
**kwargs
):
"""filemanagercopy # noqa: E501
filemanager copy # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.filemanagercopy(access_token, _async, filelist, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
_async (int): async
filelist (str): filelist
Keyword Args:
ondup (str): ondup. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
None
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
kwargs['_async'] = \
_async
kwargs['filelist'] = \
filelist
return self.filemanagercopy_endpoint.call_with_http_info(**kwargs)
def filemanagerdelete(
self,
access_token,
_async,
filelist,
**kwargs
):
"""filemanagerdelete # noqa: E501
filemanager delete # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.filemanagerdelete(access_token, _async, filelist, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
_async (int): async
filelist (str): filelist
Keyword Args:
ondup (str): ondup. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
None
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
kwargs['_async'] = \
_async
kwargs['filelist'] = \
filelist
return self.filemanagerdelete_endpoint.call_with_http_info(**kwargs)
def filemanagermove(
self,
access_token,
_async,
filelist,
**kwargs
):
"""filemanagermove # noqa: E501
filemanager move # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.filemanagermove(access_token, _async, filelist, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
_async (int): async
filelist (str): filelist
Keyword Args:
ondup (str): ondup. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
None
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
kwargs['_async'] = \
_async
kwargs['filelist'] = \
filelist
return self.filemanagermove_endpoint.call_with_http_info(**kwargs)
def filemanagerrename(
self,
access_token,
_async,
filelist,
**kwargs
):
"""filemanagerrename # noqa: E501
filemanager rename # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.filemanagerrename(access_token, _async, filelist, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
_async (int): async
filelist (str): filelist
Keyword Args:
ondup (str): ondup. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
None
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
kwargs['_async'] = \
_async
kwargs['filelist'] = \
filelist
return self.filemanagerrename_endpoint.call_with_http_info(**kwargs)

View File

@ -0,0 +1,599 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from openapi_client.api_client import ApiClient, Endpoint as _Endpoint
from openapi_client.model_utils import ( # noqa: F401
check_allowed_values,
check_validations,
date,
datetime,
file_type,
none_type,
validate_and_convert_types
)
# from openapi_client.model.filecreateresponse import Filecreateresponse
# from openapi_client.model.fileprecreateresponse import Fileprecreateresponse
class FileuploadApi(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
self.pcssuperfile2_endpoint = _Endpoint(
settings={
'response_type': (dict,),
'auth': [],
'endpoint_path': '/rest/2.0/pcs/superfile2?method=upload&openapi=xpansdk',
'operation_id': 'pcssuperfile2',
'http_method': 'POST',
'servers': [
{
'url': "https://d.pcs.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'partseq',
'path',
'uploadid',
'type',
'file',
],
'required': [
'access_token',
'partseq',
'path',
'uploadid',
'type',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'partseq':
(str,),
'path':
(str,),
'uploadid':
(str,),
'type':
(str,),
'file':
(file_type,),
},
'attribute_map': {
'access_token': 'access_token',
'partseq': 'partseq',
'path': 'path',
'uploadid': 'uploadid',
'type': 'type',
'file': 'file',
},
'location_map': {
'access_token': 'query',
'partseq': 'query',
'path': 'query',
'uploadid': 'query',
'type': 'query',
'file': 'form',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'text/html;charset=utf8'
],
'content_type': [
'multipart/form-data'
]
},
api_client=api_client
)
self.xpanfilecreate_endpoint = _Endpoint(
settings={
'response_type': (dict,),
'auth': [],
'endpoint_path': '/rest/2.0/xpan/file?method=create&openapi=xpansdk',
'operation_id': 'xpanfilecreate',
'http_method': 'POST',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'path',
'isdir',
'size',
'uploadid',
'block_list',
'rtype',
],
'required': [
'access_token',
'path',
'isdir',
'size',
'uploadid',
'block_list',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'path':
(str,),
'isdir':
(int,),
'size':
(int,),
'uploadid':
(str,),
'block_list':
(str,),
'rtype':
(int,),
},
'attribute_map': {
'access_token': 'access_token',
'path': 'path',
'isdir': 'isdir',
'size': 'size',
'uploadid': 'uploadid',
'block_list': 'block_list',
'rtype': 'rtype',
},
'location_map': {
'access_token': 'query',
'path': 'form',
'isdir': 'form',
'size': 'form',
'uploadid': 'form',
'block_list': 'form',
'rtype': 'form',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; charset=UTF-8'
],
'content_type': [
'application/x-www-form-urlencoded'
]
},
api_client=api_client
)
self.xpanfileprecreate_endpoint = _Endpoint(
settings={
'response_type': (dict,),
'auth': [],
'endpoint_path': '/rest/2.0/xpan/file?method=precreate&openapi=xpansdk',
'operation_id': 'xpanfileprecreate',
'http_method': 'POST',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'path',
'isdir',
'size',
'autoinit',
'block_list',
'rtype',
],
'required': [
'access_token',
'path',
'isdir',
'size',
'autoinit',
'block_list',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'path':
(str,),
'isdir':
(int,),
'size':
(int,),
'autoinit':
(int,),
'block_list':
(str,),
'rtype':
(int,),
},
'attribute_map': {
'access_token': 'access_token',
'path': 'path',
'isdir': 'isdir',
'size': 'size',
'autoinit': 'autoinit',
'block_list': 'block_list',
'rtype': 'rtype',
},
'location_map': {
'access_token': 'query',
'path': 'form',
'isdir': 'form',
'size': 'form',
'autoinit': 'form',
'block_list': 'form',
'rtype': 'form',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; charset=UTF-8'
],
'content_type': [
'application/x-www-form-urlencoded'
]
},
api_client=api_client
)
def pcssuperfile2(
self,
access_token,
partseq,
path,
uploadid,
type,
**kwargs
):
"""pcssuperfile2 # noqa: E501
分片上传这里是实际的文件内容传送部分一般多为大于4MB的文件需将文件以4MB为单位切分对切分后得到的n个分片一一调用该接口进行传送以实现对原文件的传送当然若不大于4MB则直接该对文件进行传送即可 # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.pcssuperfile2(access_token, partseq, path, uploadid, type, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
partseq (str):
path (str):
uploadid (str):
type (str):
Keyword Args:
file (file_type): 要进行传送的本地文件分片. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
str
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
kwargs['partseq'] = \
partseq
kwargs['path'] = \
path
kwargs['uploadid'] = \
uploadid
kwargs['type'] = \
type
return self.pcssuperfile2_endpoint.call_with_http_info(**kwargs)
def xpanfilecreate(
self,
access_token,
path,
isdir,
size,
uploadid,
block_list,
**kwargs
):
"""xpanfilecreate # noqa: E501
将多个文件分片合并成一个文件生成文件基本信息完成文件的上传最后一步 # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.xpanfilecreate(access_token, path, isdir, size, uploadid, block_list, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
path (str): 与precreate的path值保持一致
isdir (int): isdir
size (int): 与precreate的size值保持一致
uploadid (str): precreate返回的uploadid
block_list (str): 与precreate的block_list值保持一致
Keyword Args:
rtype (int): rtype. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Filecreateresponse
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
kwargs['path'] = \
path
kwargs['isdir'] = \
isdir
kwargs['size'] = \
size
kwargs['uploadid'] = \
uploadid
kwargs['block_list'] = \
block_list
return self.xpanfilecreate_endpoint.call_with_http_info(**kwargs)
def xpanfileprecreate(
self,
access_token,
path,
isdir,
size,
autoinit,
block_list,
**kwargs
):
"""xpanfileprecreate # noqa: E501
文件预上传用于获取上传任务id既uploadid # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.xpanfileprecreate(access_token, path, isdir, size, autoinit, block_list, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
path (str): 对于一般的第三方软件应用路径以 \\\"/apps/your-app-name/\\\" 开头。对于小度等硬件应用,路径一般 \\\"/来自:小度设备/\\\" 开头。对于定制化配置的硬件应用,根据配置情况进行填写。
isdir (int): isdir
size (int): size
autoinit (int): autoinit
block_list (str): 由MD5字符串组成的list
Keyword Args:
rtype (int): rtype. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Fileprecreateresponse
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
kwargs['path'] = \
path
kwargs['isdir'] = \
isdir
kwargs['size'] = \
size
kwargs['autoinit'] = \
autoinit
kwargs['block_list'] = \
block_list
return self.xpanfileprecreate_endpoint.call_with_http_info(**kwargs)

View File

@ -0,0 +1,391 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from openapi_client.api_client import ApiClient, Endpoint as _Endpoint
from openapi_client.model_utils import ( # noqa: F401
check_allowed_values,
check_validations,
date,
datetime,
file_type,
none_type,
validate_and_convert_types
)
class MultimediafileApi(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
self.xpanfilelistall_endpoint = _Endpoint(
settings={
'response_type': (dict,),
'auth': [],
'endpoint_path': '/rest/2.0/xpan/multimedia?method=listall&openapi=xpansdk',
'operation_id': 'xpanfilelistall',
'http_method': 'GET',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'path',
'recursion',
'web',
'start',
'limit',
'order',
'desc',
],
'required': [
'access_token',
'path',
'recursion',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'path':
(str,),
'recursion':
(int,),
'web':
(str,),
'start':
(int,),
'limit':
(int,),
'order':
(str,),
'desc':
(int,),
},
'attribute_map': {
'access_token': 'access_token',
'path': 'path',
'recursion': 'recursion',
'web': 'web',
'start': 'start',
'limit': 'limit',
'order': 'order',
'desc': 'desc',
},
'location_map': {
'access_token': 'query',
'path': 'query',
'recursion': 'query',
'web': 'query',
'start': 'query',
'limit': 'query',
'order': 'query',
'desc': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; charset=UTF-8'
],
'content_type': [],
},
api_client=api_client
)
self.xpanmultimediafilemetas_endpoint = _Endpoint(
settings={
'response_type': (dict,),
'auth': [],
'endpoint_path': '/rest/2.0/xpan/multimedia?method=filemetas&openapi=xpansdk',
'operation_id': 'xpanmultimediafilemetas',
'http_method': 'GET',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'fsids',
'thumb',
'extra',
'dlink',
'path',
'needmedia',
],
'required': [
'access_token',
'fsids',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'fsids':
(str,),
'thumb':
(str,),
'extra':
(str,),
'dlink':
(str,),
'path':
(str,),
'needmedia':
(int,),
},
'attribute_map': {
'access_token': 'access_token',
'fsids': 'fsids',
'thumb': 'thumb',
'extra': 'extra',
'dlink': 'dlink',
'path': 'path',
'needmedia': 'needmedia',
},
'location_map': {
'access_token': 'query',
'fsids': 'query',
'thumb': 'query',
'extra': 'query',
'dlink': 'query',
'path': 'query',
'needmedia': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; UTF-8'
],
'content_type': [],
},
api_client=api_client
)
def xpanfilelistall(
self,
access_token,
path,
recursion,
**kwargs
):
"""xpanfilelistall # noqa: E501
listall # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.xpanfilelistall(access_token, path, recursion, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
path (str):
recursion (int):
Keyword Args:
web (str): [optional]
start (int): [optional]
limit (int): [optional]
order (str): [optional]
desc (int): [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
str
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
kwargs['path'] = \
path
kwargs['recursion'] = \
recursion
return self.xpanfilelistall_endpoint.call_with_http_info(**kwargs)
def xpanmultimediafilemetas(
self,
access_token,
fsids,
**kwargs
):
"""xpanmultimediafilemetas # noqa: E501
multimedia filemetas # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.xpanmultimediafilemetas(access_token, fsids, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
fsids (str):
Keyword Args:
thumb (str): [optional]
extra (str): [optional]
dlink (str): 下载地址下载接口需要用到dlink. [optional]
path (str): 查询共享目录或专属空间内文件时需要共享目录格式 /uk-fsid其中uk为共享目录创建者id fsid对应共享目录的fsid专属空间格式/_pcs_.appdata/xpan/. [optional]
needmedia (int): [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
str
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
kwargs['fsids'] = \
fsids
return self.xpanmultimediafilemetas_endpoint.call_with_http_info(**kwargs)

View File

@ -0,0 +1,315 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from openapi_client.api_client import ApiClient, Endpoint as _Endpoint
from openapi_client.model_utils import ( # noqa: F401
check_allowed_values,
check_validations,
date,
datetime,
file_type,
none_type,
validate_and_convert_types
)
from openapi_client.model.quotaresponse import Quotaresponse
from openapi_client.model.uinforesponse import Uinforesponse
class UserinfoApi(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
self.apiquota_endpoint = _Endpoint(
settings={
'response_type': (Quotaresponse,),
'auth': [],
'endpoint_path': '/api/quota?openapi=xpansdk',
'operation_id': 'apiquota',
'http_method': 'GET',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
'checkexpire',
'checkfree',
],
'required': [
'access_token',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
'checkexpire':
(int,),
'checkfree':
(int,),
},
'attribute_map': {
'access_token': 'access_token',
'checkexpire': 'checkexpire',
'checkfree': 'checkfree',
},
'location_map': {
'access_token': 'query',
'checkexpire': 'query',
'checkfree': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; charset=UTF-8'
],
'content_type': [],
},
api_client=api_client
)
self.xpannasuinfo_endpoint = _Endpoint(
settings={
'response_type': (Uinforesponse,),
'auth': [],
'endpoint_path': '/rest/2.0/xpan/nas?method=uinfo&openapi=xpansdk',
'operation_id': 'xpannasuinfo',
'http_method': 'GET',
'servers': [
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
]
},
params_map={
'all': [
'access_token',
],
'required': [
'access_token',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'access_token':
(str,),
},
'attribute_map': {
'access_token': 'access_token',
},
'location_map': {
'access_token': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json; charset=UTF-8'
],
'content_type': [],
},
api_client=api_client
)
def apiquota(
self,
access_token,
**kwargs
):
"""apiquota # noqa: E501
api quota # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.apiquota(access_token, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
Keyword Args:
checkexpire (int): [optional]
checkfree (int): [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Quotaresponse
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
return self.apiquota_endpoint.call_with_http_info(**kwargs)
def xpannasuinfo(
self,
access_token,
**kwargs
):
"""xpannasuinfo # noqa: E501
user info # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.xpannasuinfo(access_token, async_req=True)
>>> result = thread.get()
Args:
access_token (str):
Keyword Args:
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Uinforesponse
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['access_token'] = \
access_token
return self.xpannasuinfo_endpoint.call_with_http_info(**kwargs)

View File

@ -0,0 +1,864 @@
# !/usr/bin/env python3
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import json
import atexit
import mimetypes
from multiprocessing.pool import ThreadPool
import io
import os
import re
import typing
from urllib.parse import quote
from urllib3.fields import RequestField
from openapi_client import rest
from openapi_client.configuration import Configuration
from openapi_client.exceptions import ApiTypeError, ApiValueError, ApiException
from openapi_client.model_utils import (
ModelNormal,
ModelSimple,
ModelComposed,
check_allowed_values,
check_validations,
date,
datetime,
deserialize_file,
file_type,
model_to_dict,
none_type,
validate_and_convert_types
)
class ApiClient(object):
"""Generic API client for OpenAPI client library builds.
OpenAPI generic API client. This client handles the client-
server communication, and is invariant across implementations. Specifics of
the methods and models for each application are generated from the OpenAPI
templates.
NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
:param configuration: .Configuration object for this client
:param header_name: a header to pass when making calls to the API.
:param header_value: a header value to pass when making calls to
the API.
:param cookie: a cookie to include in the header when making calls
to the API
:param pool_threads: The number of threads to use for async requests
to the API. More threads means more concurrent API requests.
"""
_pool = None
def __init__(self, configuration=None, header_name=None, header_value=None,
cookie=None, pool_threads=1):
if configuration is None:
configuration = Configuration.get_default_copy()
self.configuration = configuration
self.pool_threads = pool_threads
self.rest_client = rest.RESTClientObject(configuration)
self.default_headers = {}
if header_name is not None:
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
self.close()
def close(self):
if self._pool:
self._pool.close()
self._pool.join()
self._pool = None
if hasattr(atexit, 'unregister'):
atexit.unregister(self.close)
@property
def pool(self):
"""Create thread pool on first request
avoids instantiating unused threadpool for blocking clients.
"""
if self._pool is None:
atexit.register(self.close)
self._pool = ThreadPool(self.pool_threads)
return self._pool
@property
def user_agent(self):
"""User agent for this API client"""
return self.default_headers['User-Agent']
@user_agent.setter
def user_agent(self, value):
self.default_headers['User-Agent'] = value
def set_default_header(self, header_name, header_value):
self.default_headers[header_name] = header_value
def __call_api(
self,
resource_path: str,
method: str,
path_params: typing.Optional[typing.Dict[str, typing.Any]] = None,
query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None,
header_params: typing.Optional[typing.Dict[str, typing.Any]] = None,
body: typing.Optional[typing.Any] = None,
post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None,
files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None,
response_type: typing.Optional[typing.Tuple[typing.Any]] = None,
auth_settings: typing.Optional[typing.List[str]] = None,
_return_http_data_only: typing.Optional[bool] = None,
collection_formats: typing.Optional[typing.Dict[str, str]] = None,
_preload_content: bool = True,
_request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
_host: typing.Optional[str] = None,
_check_type: typing.Optional[bool] = None,
_content_type: typing.Optional[str] = None
):
config = self.configuration
# header parameters
header_params = header_params or {}
header_params.update(self.default_headers)
if self.cookie:
header_params['Cookie'] = self.cookie
if header_params:
header_params = self.sanitize_for_serialization(header_params)
header_params = dict(self.parameters_to_tuples(header_params,
collection_formats))
# path parameters
if path_params:
path_params = self.sanitize_for_serialization(path_params)
path_params = self.parameters_to_tuples(path_params,
collection_formats)
for k, v in path_params:
# specified safe chars, encode everything
resource_path = resource_path.replace(
'{%s}' % k,
quote(str(v), safe=config.safe_chars_for_path_param)
)
# query parameters
if query_params:
query_params = self.sanitize_for_serialization(query_params)
query_params = self.parameters_to_tuples(query_params,
collection_formats)
# post parameters
if post_params or files:
post_params = post_params if post_params else []
post_params = self.sanitize_for_serialization(post_params)
post_params = self.parameters_to_tuples(post_params,
collection_formats)
post_params.extend(self.files_parameters(files))
if header_params['Content-Type'].startswith("multipart"):
post_params = self.parameters_to_multipart(post_params,
(dict) )
# body
if body:
body = self.sanitize_for_serialization(body)
# auth setting
self.update_params_for_auth(header_params, query_params,
auth_settings, resource_path, method, body)
# request url
if _host is None:
url = self.configuration.host + resource_path
else:
# use server/host defined in path or operation instead
url = _host + resource_path
try:
# perform request and return response
response_data = self.request(
method, url, query_params=query_params, headers=header_params,
post_params=post_params, body=body,
_preload_content=_preload_content,
_request_timeout=_request_timeout)
except ApiException as e:
e.body = e.body.decode('utf-8')
raise e
self.last_response = response_data
return_data = response_data
if not _preload_content:
return return_data
# deserialize response data
if response_type:
if response_type != (file_type,):
encoding = "utf-8"
content_type = response_data.getheader('content-type')
if content_type is not None:
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type)
if match:
encoding = match.group(1)
response_data.data = response_data.data.decode(encoding)
return_data = self.deserialize(
response_data,
response_type,
_check_type
)
else:
return_data = None
if _return_http_data_only:
return (return_data)
else:
return (return_data, response_data.status,
response_data.getheaders())
def parameters_to_multipart(self, params, collection_types):
"""Get parameters as list of tuples, formatting as json if value is collection_types
:param params: Parameters as list of two-tuples
:param dict collection_types: Parameter collection types
:return: Parameters as list of tuple or urllib3.fields.RequestField
"""
new_params = []
if collection_types is None:
collection_types = (dict)
for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501
if isinstance(v, collection_types): # v is instance of collection_type, formatting as application/json
v = json.dumps(v, ensure_ascii=False).encode("utf-8")
field = RequestField(k, v)
field.make_multipart(content_type="application/json; charset=utf-8")
new_params.append(field)
else:
new_params.append((k, v))
return new_params
@classmethod
def sanitize_for_serialization(cls, obj):
"""Prepares data for transmission before it is sent with the rest client
If obj is None, return None.
If obj is str, int, long, float, bool, return directly.
If obj is datetime.datetime, datetime.date
convert to string in iso8601 format.
If obj is list, sanitize each element in the list.
If obj is dict, return the dict.
If obj is OpenAPI model, return the properties dict.
If obj is io.IOBase, return the bytes
:param obj: The data to serialize.
:return: The serialized form of data.
"""
if isinstance(obj, (ModelNormal, ModelComposed)):
return {
key: cls.sanitize_for_serialization(val) for key, val in model_to_dict(obj, serialize=True).items()
}
elif isinstance(obj, io.IOBase):
return cls.get_file_data_and_close_file(obj)
elif isinstance(obj, (str, int, float, none_type, bool)):
return obj
elif isinstance(obj, (datetime, date)):
return obj.isoformat()
elif isinstance(obj, ModelSimple):
return cls.sanitize_for_serialization(obj.value)
elif isinstance(obj, (list, tuple)):
return [cls.sanitize_for_serialization(item) for item in obj]
if isinstance(obj, dict):
return {key: cls.sanitize_for_serialization(val) for key, val in obj.items()}
raise ApiValueError('Unable to prepare type {} for serialization'.format(obj.__class__.__name__))
def deserialize(self, response, response_type, _check_type):
"""Deserializes response into an object.
:param response: RESTResponse object to be deserialized.
:param response_type: For the response, a tuple containing:
valid classes
a list containing valid classes (for list schemas)
a dict containing a tuple of valid classes as the value
Example values:
(str,)
(Pet,)
(float, none_type)
([int, none_type],)
({str: (bool, str, int, float, date, datetime, str, none_type)},)
:param _check_type: boolean, whether to check the types of the data
received from the server
:type _check_type: bool
:return: deserialized object.
"""
# handle file downloading
# save response body into a tmp file and return the instance
if response_type == (file_type,):
content_disposition = response.getheader("Content-Disposition")
return deserialize_file(response.data, self.configuration,
content_disposition=content_disposition)
# fetch data from response object
try:
received_data = json.loads(response.data)
except ValueError:
received_data = response.data
# store our data under the key of 'received_data' so users have some
# context if they are deserializing a string and the data type is wrong
deserialized_data = validate_and_convert_types(
received_data,
response_type,
['received_data'],
True,
_check_type,
configuration=self.configuration
)
return deserialized_data
def call_api(
self,
resource_path: str,
method: str,
path_params: typing.Optional[typing.Dict[str, typing.Any]] = None,
query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None,
header_params: typing.Optional[typing.Dict[str, typing.Any]] = None,
body: typing.Optional[typing.Any] = None,
post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None,
files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None,
response_type: typing.Optional[typing.Tuple[typing.Any]] = None,
auth_settings: typing.Optional[typing.List[str]] = None,
async_req: typing.Optional[bool] = None,
_return_http_data_only: typing.Optional[bool] = None,
collection_formats: typing.Optional[typing.Dict[str, str]] = None,
_preload_content: bool = True,
_request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
_host: typing.Optional[str] = None,
_check_type: typing.Optional[bool] = None
):
"""Makes the HTTP request (synchronous) and returns deserialized data.
To make an async_req request, set the async_req parameter.
:param resource_path: Path to method endpoint.
:param method: Method to call.
:param path_params: Path parameters in the url.
:param query_params: Query parameters in the url.
:param header_params: Header parameters to be
placed in the request header.
:param body: Request body.
:param post_params dict: Request post form parameters,
for `application/x-www-form-urlencoded`, `multipart/form-data`.
:param auth_settings list: Auth Settings names for the request.
:param response_type: For the response, a tuple containing:
valid classes
a list containing valid classes (for list schemas)
a dict containing a tuple of valid classes as the value
Example values:
(str,)
(Pet,)
(float, none_type)
([int, none_type],)
({str: (bool, str, int, float, date, datetime, str, none_type)},)
:param files: key -> field name, value -> a list of open file
objects for `multipart/form-data`.
:type files: dict
:param async_req bool: execute request asynchronously
:type async_req: bool, optional
:param _return_http_data_only: response data without head status code
and headers
:type _return_http_data_only: bool, optional
:param collection_formats: dict of collection formats for path, query,
header, and post parameters.
:type collection_formats: dict, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _check_type: boolean describing if the data back from the server
should have its type checked.
:type _check_type: bool, optional
:return:
If async_req parameter is True,
the request will be called asynchronously.
The method will return the request thread.
If parameter async_req is False or missing,
then the method will return the response directly.
"""
if not async_req:
return self.__call_api(resource_path, method,
path_params, query_params, header_params,
body, post_params, files,
response_type, auth_settings,
_return_http_data_only, collection_formats,
_preload_content, _request_timeout, _host,
_check_type)
return self.pool.apply_async(self.__call_api, (resource_path,
method, path_params,
query_params,
header_params, body,
post_params, files,
response_type,
auth_settings,
_return_http_data_only,
collection_formats,
_preload_content,
_request_timeout,
_host, _check_type))
def request(self, method, url, query_params=None, headers=None,
post_params=None, body=None, _preload_content=True,
_request_timeout=None):
"""Makes the HTTP request using RESTClient."""
if method == "GET":
return self.rest_client.GET(url,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
headers=headers)
elif method == "HEAD":
return self.rest_client.HEAD(url,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
headers=headers)
elif method == "OPTIONS":
return self.rest_client.OPTIONS(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "POST":
return self.rest_client.POST(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "PUT":
return self.rest_client.PUT(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "PATCH":
return self.rest_client.PATCH(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "DELETE":
return self.rest_client.DELETE(url,
query_params=query_params,
headers=headers,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
else:
raise ApiValueError(
"http method must be `GET`, `HEAD`, `OPTIONS`,"
" `POST`, `PATCH`, `PUT` or `DELETE`."
)
def parameters_to_tuples(self, params, collection_formats):
"""Get parameters as list of tuples, formatting collections.
:param params: Parameters as dict or list of two-tuples
:param dict collection_formats: Parameter collection formats
:return: Parameters as list of tuples, collections formatted
"""
new_params = []
if collection_formats is None:
collection_formats = {}
for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501
if k in collection_formats:
collection_format = collection_formats[k]
if collection_format == 'multi':
new_params.extend((k, value) for value in v)
else:
if collection_format == 'ssv':
delimiter = ' '
elif collection_format == 'tsv':
delimiter = '\t'
elif collection_format == 'pipes':
delimiter = '|'
else: # csv is the default
delimiter = ','
new_params.append(
(k, delimiter.join(str(value) for value in v)))
else:
new_params.append((k, v))
return new_params
@staticmethod
def get_file_data_and_close_file(file_instance: io.IOBase) -> bytes:
file_data = file_instance.read()
file_instance.close()
return file_data
def files_parameters(self, files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None):
"""Builds form parameters.
:param files: None or a dict with key=param_name and
value is a list of open file objects
:return: List of tuples of form parameters with file data
"""
if files is None:
return []
params = []
for param_name, file_instances in files.items():
if file_instances is None:
# if the file field is nullable, skip None values
continue
for file_instance in file_instances:
if file_instance is None:
# if the file field is nullable, skip None values
continue
if file_instance.closed is True:
raise ApiValueError(
"Cannot read a closed file. The passed in file_type "
"for %s must be open." % param_name
)
filename = os.path.basename(file_instance.name)
filedata = self.get_file_data_and_close_file(file_instance)
mimetype = (mimetypes.guess_type(filename)[0] or
'application/octet-stream')
params.append(
tuple([param_name, tuple([filename, filedata, mimetype])]))
return params
def select_header_accept(self, accepts):
"""Returns `Accept` based on an array of accepts provided.
:param accepts: List of headers.
:return: Accept (e.g. application/json).
"""
if not accepts:
return
accepts = [x.lower() for x in accepts]
if 'application/json' in accepts:
return 'application/json'
else:
return ', '.join(accepts)
def select_header_content_type(self, content_types, method=None, body=None):
"""Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types.
:param method: http method (e.g. POST, PATCH).
:param body: http body to send.
:return: Content-Type (e.g. application/json).
"""
if not content_types:
return 'application/json'
content_types = [x.lower() for x in content_types]
if (method == 'PATCH' and
'application/json-patch+json' in content_types and
isinstance(body, list)):
return 'application/json-patch+json'
if 'application/json' in content_types or '*/*' in content_types:
return 'application/json'
else:
return content_types[0]
def update_params_for_auth(self, headers, queries, auth_settings,
resource_path, method, body):
"""Updates header and query params based on authentication setting.
:param headers: Header parameters dict to be updated.
:param queries: Query parameters tuple list to be updated.
:param auth_settings: Authentication setting identifiers list.
:param resource_path: A string representation of the HTTP request resource path.
:param method: A string representation of the HTTP request method.
:param body: A object representing the body of the HTTP request.
The object type is the return value of _encoder.default().
"""
if not auth_settings:
return
for auth in auth_settings:
auth_setting = self.configuration.auth_settings().get(auth)
if auth_setting:
if auth_setting['in'] == 'cookie':
headers['Cookie'] = auth_setting['value']
elif auth_setting['in'] == 'header':
if auth_setting['type'] != 'http-signature':
headers[auth_setting['key']] = auth_setting['value']
elif auth_setting['in'] == 'query':
queries.append((auth_setting['key'], auth_setting['value']))
else:
raise ApiValueError(
'Authentication token must be in `query` or `header`'
)
class Endpoint(object):
def __init__(self, settings=None, params_map=None, root_map=None,
headers_map=None, api_client=None, callable=None):
"""Creates an endpoint
Args:
settings (dict): see below key value pairs
'response_type' (tuple/None): response type
'auth' (list): a list of auth type keys
'endpoint_path' (str): the endpoint path
'operation_id' (str): endpoint string identifier
'http_method' (str): POST/PUT/PATCH/GET etc
'servers' (list): list of str servers that this endpoint is at
params_map (dict): see below key value pairs
'all' (list): list of str endpoint parameter names
'required' (list): list of required parameter names
'nullable' (list): list of nullable parameter names
'enum' (list): list of parameters with enum values
'validation' (list): list of parameters with validations
root_map
'validations' (dict): the dict mapping endpoint parameter tuple
paths to their validation dictionaries
'allowed_values' (dict): the dict mapping endpoint parameter
tuple paths to their allowed_values (enum) dictionaries
'openapi_types' (dict): param_name to openapi type
'attribute_map' (dict): param_name to camelCase name
'location_map' (dict): param_name to 'body', 'file', 'form',
'header', 'path', 'query'
collection_format_map (dict): param_name to `csv` etc.
headers_map (dict): see below key value pairs
'accept' (list): list of Accept header strings
'content_type' (list): list of Content-Type header strings
api_client (ApiClient) api client instance
callable (function): the function which is invoked when the
Endpoint is called
"""
self.settings = settings
self.params_map = params_map
self.params_map['all'].extend([
'async_req',
'_host_index',
'_preload_content',
'_request_timeout',
'_return_http_data_only',
'_check_input_type',
'_check_return_type',
'_content_type',
'_spec_property_naming'
])
self.params_map['nullable'].extend(['_request_timeout'])
self.validations = root_map['validations']
self.allowed_values = root_map['allowed_values']
self.openapi_types = root_map['openapi_types']
extra_types = {
'async_req': (bool,),
'_host_index': (none_type, int),
'_preload_content': (bool,),
'_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]),
'_return_http_data_only': (bool,),
'_check_input_type': (bool,),
'_check_return_type': (bool,),
'_spec_property_naming': (bool,),
'_content_type': (none_type, str)
}
self.openapi_types.update(extra_types)
self.attribute_map = root_map['attribute_map']
self.location_map = root_map['location_map']
self.collection_format_map = root_map['collection_format_map']
self.headers_map = headers_map
self.api_client = api_client
self.callable = callable
def __validate_inputs(self, kwargs):
for param in self.params_map['enum']:
if param in kwargs:
check_allowed_values(
self.allowed_values,
(param,),
kwargs[param]
)
for param in self.params_map['validation']:
if param in kwargs:
check_validations(
self.validations,
(param,),
kwargs[param],
configuration=self.api_client.configuration
)
if kwargs['_check_input_type'] is False:
return
for key, value in kwargs.items():
fixed_val = validate_and_convert_types(
value,
self.openapi_types[key],
[key],
kwargs['_spec_property_naming'],
kwargs['_check_input_type'],
configuration=self.api_client.configuration
)
kwargs[key] = fixed_val
def __gather_params(self, kwargs):
params = {
'body': None,
'collection_format': {},
'file': {},
'form': [],
'header': {},
'path': {},
'query': []
}
for param_name, param_value in kwargs.items():
param_location = self.location_map.get(param_name)
if param_location is None:
continue
if param_location:
if param_location == 'body':
params['body'] = param_value
continue
base_name = self.attribute_map[param_name]
if (param_location == 'form' and
self.openapi_types[param_name] == (file_type,)):
params['file'][param_name] = [param_value]
elif (param_location == 'form' and
self.openapi_types[param_name] == ([file_type],)):
# param_value is already a list
params['file'][param_name] = param_value
elif param_location in {'form', 'query'}:
param_value_full = (base_name, param_value)
params[param_location].append(param_value_full)
if param_location not in {'form', 'query'}:
params[param_location][base_name] = param_value
collection_format = self.collection_format_map.get(param_name)
if collection_format:
params['collection_format'][base_name] = collection_format
return params
def __call__(self, *args, **kwargs):
""" This method is invoked when endpoints are called
Example:
api_instance = AuthApi()
api_instance.oauth_token_code2token # this is an instance of the class Endpoint
api_instance.oauth_token_code2token() # this invokes api_instance.oauth_token_code2token.__call__()
which then invokes the callable functions stored in that endpoint at
api_instance.oauth_token_code2token.callable or self.callable in this class
"""
return self.callable(self, *args, **kwargs)
def call_with_http_info(self, **kwargs):
try:
index = self.api_client.configuration.server_operation_index.get(
self.settings['operation_id'], self.api_client.configuration.server_index
) if kwargs['_host_index'] is None else kwargs['_host_index']
server_variables = self.api_client.configuration.server_operation_variables.get(
self.settings['operation_id'], self.api_client.configuration.server_variables
)
_host = self.api_client.configuration.get_host_from_settings(
index, variables=server_variables, servers=self.settings['servers']
)
except IndexError:
if self.settings['servers']:
raise ApiValueError(
"Invalid host index. Must be 0 <= index < %s" %
len(self.settings['servers'])
)
_host = None
for key, value in kwargs.items():
if key not in self.params_map['all']:
raise ApiTypeError(
"Got an unexpected parameter '%s'"
" to method `%s`" %
(key, self.settings['operation_id'])
)
# only throw this nullable ApiValueError if _check_input_type
# is False, if _check_input_type==True we catch this case
# in self.__validate_inputs
if (key not in self.params_map['nullable'] and value is None
and kwargs['_check_input_type'] is False):
raise ApiValueError(
"Value may not be None for non-nullable parameter `%s`"
" when calling `%s`" %
(key, self.settings['operation_id'])
)
for key in self.params_map['required']:
if key not in kwargs.keys():
raise ApiValueError(
"Missing the required parameter `%s` when calling "
"`%s`" % (key, self.settings['operation_id'])
)
self.__validate_inputs(kwargs)
params = self.__gather_params(kwargs)
accept_headers_list = self.headers_map['accept']
if accept_headers_list:
params['header']['Accept'] = self.api_client.select_header_accept(
accept_headers_list)
if kwargs.get('_content_type'):
params['header']['Content-Type'] = kwargs['_content_type']
else:
content_type_headers_list = self.headers_map['content_type']
if content_type_headers_list:
if params['body'] != "":
header_list = self.api_client.select_header_content_type(
content_type_headers_list, self.settings['http_method'],
params['body'])
params['header']['Content-Type'] = header_list
return self.api_client.call_api(
self.settings['endpoint_path'], self.settings['http_method'],
params['path'],
params['query'],
params['header'],
body=params['body'],
post_params=params['form'],
files=params['file'],
response_type=self.settings['response_type'],
auth_settings=self.settings['auth'],
async_req=kwargs['async_req'],
_check_type=kwargs['_check_return_type'],
_return_http_data_only=kwargs['_return_http_data_only'],
_preload_content=kwargs['_preload_content'],
_request_timeout=kwargs['_request_timeout'],
_host=_host,
collection_formats=params['collection_format'])

View File

@ -0,0 +1,454 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import copy
import logging
import multiprocessing
import sys
import urllib3
from http import client as http_client
from openapi_client.exceptions import ApiValueError
JSON_SCHEMA_VALIDATION_KEYWORDS = {
'multipleOf', 'maximum', 'exclusiveMaximum',
'minimum', 'exclusiveMinimum', 'maxLength',
'minLength', 'pattern', 'maxItems', 'minItems'
}
class Configuration(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
:param host: Base url
:param api_key: Dict to store API key(s).
Each entry in the dict specifies an API key.
The dict key is the name of the security scheme in the OAS specification.
The dict value is the API key secret.
:param api_key_prefix: Dict to store API prefix (e.g. Bearer)
The dict key is the name of the security scheme in the OAS specification.
The dict value is an API key prefix when generating the auth data.
:param username: Username for HTTP basic authentication
:param password: Password for HTTP basic authentication
:param discard_unknown_keys: Boolean value indicating whether to discard
unknown properties. A server may send a response that includes additional
properties that are not known by the client in the following scenarios:
1. The OpenAPI document is incomplete, i.e. it does not match the server
implementation.
2. The client was generated using an older version of the OpenAPI document
and the server has been upgraded since then.
If a schema in the OpenAPI document defines the additionalProperties attribute,
then all undeclared properties received by the server are injected into the
additional properties map. In that case, there are undeclared properties, and
nothing to discard.
:param disabled_client_side_validations (string): Comma-separated list of
JSON schema validation keywords to disable JSON schema structural validation
rules. The following keywords may be specified: multipleOf, maximum,
exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, pattern,
maxItems, minItems.
By default, the validation is performed for data generated locally by the client
and data received from the server, independent of any validation performed by
the server side. If the input data does not satisfy the JSON schema validation
rules specified in the OpenAPI document, an exception is raised.
If disabled_client_side_validations is set, structural validation is
disabled. This can be useful to troubleshoot data validation problem, such as
when the OpenAPI document validation rules do not match the actual API data
received by the server.
:param server_index: Index to servers configuration.
:param server_variables: Mapping with string values to replace variables in
templated server configuration. The validation of enums is performed for
variables with defined enum values before.
:param server_operation_index: Mapping from operation ID to an index to server
configuration.
:param server_operation_variables: Mapping from operation ID to a mapping with
string values to replace variables in templated server configuration.
The validation of enums is performed for variables with defined enum values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format
"""
_default = None
def __init__(self, host=None,
api_key=None, api_key_prefix=None,
access_token=None,
username=None, password=None,
discard_unknown_keys=False,
disabled_client_side_validations="",
server_index=None, server_variables=None,
server_operation_index=None, server_operation_variables=None,
ssl_ca_cert=None,
):
"""Constructor
"""
self._base_path = "https://d.pcs.baidu.com" if host is None else host
"""Default Base url
"""
self.server_index = 0 if server_index is None and host is None else server_index
self.server_operation_index = server_operation_index or {}
"""Default server index
"""
self.server_variables = server_variables or {}
self.server_operation_variables = server_operation_variables or {}
"""Default server variables
"""
self.temp_folder_path = None
"""Temp file folder for downloading files
"""
# Authentication Settings
self.access_token = access_token
self.api_key = {}
if api_key:
self.api_key = api_key
"""dict to store API key(s)
"""
self.api_key_prefix = {}
if api_key_prefix:
self.api_key_prefix = api_key_prefix
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
"""function hook to refresh API key if expired
"""
self.username = username
"""Username for HTTP basic authentication
"""
self.password = password
"""Password for HTTP basic authentication
"""
self.discard_unknown_keys = discard_unknown_keys
self.disabled_client_side_validations = disabled_client_side_validations
self.logger = {}
"""Logging Settings
"""
self.logger["package_logger"] = logging.getLogger("openapi_client")
self.logger["urllib3_logger"] = logging.getLogger("urllib3")
self.logger_format = '%(asctime)s %(levelname)s %(message)s'
"""Log format
"""
self.logger_stream_handler = None
"""Log stream handler
"""
self.logger_file_handler = None
"""Log file handler
"""
self.logger_file = None
"""Debug file location
"""
self.debug = False
"""Debug switch
"""
self.verify_ssl = True
"""SSL/TLS verification
Set this to false to skip verifying SSL certificate when calling API
from https server.
"""
self.ssl_ca_cert = ssl_ca_cert
"""Set this to customize the certificate file to verify the peer.
"""
self.cert_file = None
"""client certificate file
"""
self.key_file = None
"""client key file
"""
self.assert_hostname = None
"""Set this to True/False to enable/disable SSL hostname verification.
"""
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
"""urllib3 connection pool's maximum number of connections saved
per pool. urllib3 uses 1 connection as default value, but this is
not the best value when you are making a lot of possibly parallel
requests to the same host, which is often the case here.
cpu_count * 5 is used as default value to increase performance.
"""
self.proxy = None
"""Proxy URL
"""
self.no_proxy = None
"""bypass proxy for host in the no_proxy list.
"""
self.proxy_headers = None
"""Proxy headers
"""
self.safe_chars_for_path_param = ''
"""Safe chars for path_param
"""
self.retries = None
"""Adding retries to override urllib3 default value 3
"""
# Enable client side validation
self.client_side_validation = True
# Options to pass down to the underlying urllib3 socket
self.socket_options = None
def __deepcopy__(self, memo):
cls = self.__class__
result = cls.__new__(cls)
memo[id(self)] = result
for k, v in self.__dict__.items():
if k not in ('logger', 'logger_file_handler'):
setattr(result, k, copy.deepcopy(v, memo))
# shallow copy of loggers
result.logger = copy.copy(self.logger)
# use setters to configure loggers
result.logger_file = self.logger_file
result.debug = self.debug
return result
def __setattr__(self, name, value):
object.__setattr__(self, name, value)
if name == 'disabled_client_side_validations':
s = set(filter(None, value.split(',')))
for v in s:
if v not in JSON_SCHEMA_VALIDATION_KEYWORDS:
raise ApiValueError(
"Invalid keyword: '{0}''".format(v))
self._disabled_client_side_validations = s
@classmethod
def set_default(cls, default):
"""Set default instance of configuration.
It stores default configuration, which can be
returned by get_default_copy method.
:param default: object of Configuration
"""
cls._default = copy.deepcopy(default)
@classmethod
def get_default_copy(cls):
"""Return new instance of configuration.
This method returns newly created, based on default constructor,
object of Configuration class or returns a copy of default
configuration passed by the set_default method.
:return: The configuration object.
"""
if cls._default is not None:
return copy.deepcopy(cls._default)
return Configuration()
@property
def logger_file(self):
"""The logger file.
If the logger_file is None, then add stream handler and remove file
handler. Otherwise, add file handler and remove stream handler.
:param value: The logger_file path.
:type: str
"""
return self.__logger_file
@logger_file.setter
def logger_file(self, value):
"""The logger file.
If the logger_file is None, then add stream handler and remove file
handler. Otherwise, add file handler and remove stream handler.
:param value: The logger_file path.
:type: str
"""
self.__logger_file = value
if self.__logger_file:
# If set logging file,
# then add file handler and remove stream handler.
self.logger_file_handler = logging.FileHandler(self.__logger_file)
self.logger_file_handler.setFormatter(self.logger_formatter)
for _, logger in self.logger.items():
logger.addHandler(self.logger_file_handler)
@property
def debug(self):
"""Debug status
:param value: The debug status, True or False.
:type: bool
"""
return self.__debug
@debug.setter
def debug(self, value):
"""Debug status
:param value: The debug status, True or False.
:type: bool
"""
self.__debug = value
if self.__debug:
# if debug status is True, turn on debug logging
for _, logger in self.logger.items():
logger.setLevel(logging.DEBUG)
# turn on http_client debug
http_client.HTTPConnection.debuglevel = 1
else:
# if debug status is False, turn off debug logging,
# setting log level to default `logging.WARNING`
for _, logger in self.logger.items():
logger.setLevel(logging.WARNING)
# turn off http_client debug
http_client.HTTPConnection.debuglevel = 0
@property
def logger_format(self):
"""The logger format.
The logger_formatter will be updated when sets logger_format.
:param value: The format string.
:type: str
"""
return self.__logger_format
@logger_format.setter
def logger_format(self, value):
"""The logger format.
The logger_formatter will be updated when sets logger_format.
:param value: The format string.
:type: str
"""
self.__logger_format = value
self.logger_formatter = logging.Formatter(self.__logger_format)
def get_api_key_with_prefix(self, identifier, alias=None):
"""Gets API key (with prefix if set).
:param identifier: The identifier of apiKey.
:param alias: The alternative identifier of apiKey.
:return: The token for api key authentication.
"""
if self.refresh_api_key_hook is not None:
self.refresh_api_key_hook(self)
key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None)
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
else:
return key
def get_basic_auth_token(self):
"""Gets HTTP basic authentication header (string).
:return: The token for basic HTTP authentication.
"""
username = ""
if self.username is not None:
username = self.username
password = ""
if self.password is not None:
password = self.password
return urllib3.util.make_headers(
basic_auth=username + ':' + password
).get('authorization')
def auth_settings(self):
"""Gets Auth Settings dict for api client.
:return: The Auth Settings information dict.
"""
auth = {}
return auth
def to_debug_report(self):
"""Gets the essential information for debugging.
:return: The report for debugging.
"""
return "Python SDK Debug Report:\n"\
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 0.1\n"\
"SDK Package Version: 1.0.0".\
format(env=sys.platform, pyversion=sys.version)
def get_host_settings(self):
"""Gets an array of host settings
:return: An array of host settings
"""
return [
{
'url': "https://d.pcs.baidu.com",
'description': "No description provided",
},
{
'url': "https://pan.baidu.com",
'description': "No description provided",
},
{
'url': "https://openapi.baidu.com",
'description': "No description provided",
}
]
def get_host_from_settings(self, index, variables=None, servers=None):
"""Gets host URL based on the index and variables
:param index: array index of the host settings
:param variables: hash of variable and the corresponding value
:param servers: an array of host settings or None
:return: URL based on host settings
"""
if index is None:
return self._base_path
variables = {} if variables is None else variables
servers = self.get_host_settings() if servers is None else servers
try:
server = servers[index]
except IndexError:
raise ValueError(
"Invalid index {0} when selecting the host settings. "
"Must be less than {1}".format(index, len(servers)))
url = server['url']
# go through variables and replace placeholders
for variable_name, variable in server.get('variables', {}).items():
used_value = variables.get(
variable_name, variable['default_value'])
if 'enum_values' in variable \
and used_value not in variable['enum_values']:
raise ValueError(
"The variable `{0}` in the host URL has invalid value "
"{1}. Must be {2}.".format(
variable_name, variables[variable_name],
variable['enum_values']))
url = url.replace("{" + variable_name + "}", used_value)
return url
@property
def host(self):
"""Return generated host."""
return self.get_host_from_settings(self.server_index, variables=self.server_variables)
@host.setter
def host(self, value):
"""Fix base path."""
self._base_path = value
self.server_index = None

View File

@ -0,0 +1,197 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
class OpenApiException(Exception):
"""The base exception class for all OpenAPIExceptions"""
class ApiTypeError(OpenApiException, TypeError):
"""
class ApiTypeError
"""
def __init__(self, msg, path_to_item=None, valid_classes=None,
key_type=None):
""" Raises an exception for TypeErrors
Args:
msg (str): the exception message
Keyword Args:
path_to_item (list): a list of keys an indices to get to the
current_item
None if unset
valid_classes (tuple): the primitive classes that current item
should be an instance of
None if unset
key_type (bool): False if our value is a value in a dict
True if it is a key in a dict
False if our item is an item in a list
None if unset
"""
self.path_to_item = path_to_item
self.valid_classes = valid_classes
self.key_type = key_type
full_msg = msg
if path_to_item:
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
super(ApiTypeError, self).__init__(full_msg)
class ApiValueError(OpenApiException, ValueError):
"""
class ApiValueError
"""
def __init__(self, msg, path_to_item=None):
"""
Args:
msg (str): the exception message
Keyword Args:
path_to_item (list) the path to the exception in the
received_data dict. None if unset
"""
self.path_to_item = path_to_item
full_msg = msg
if path_to_item:
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
super(ApiValueError, self).__init__(full_msg)
class ApiAttributeError(OpenApiException, AttributeError):
"""
class ApiAttributeError
"""
def __init__(self, msg, path_to_item=None):
"""
Raised when an attribute reference or assignment fails.
Args:
msg (str): the exception message
Keyword Args:
path_to_item (None/list) the path to the exception in the
received_data dict
"""
self.path_to_item = path_to_item
full_msg = msg
if path_to_item:
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
super(ApiAttributeError, self).__init__(full_msg)
class ApiKeyError(OpenApiException, KeyError):
"""
class ApiKeyError
"""
def __init__(self, msg, path_to_item=None):
"""
Args:
msg (str): the exception message
Keyword Args:
path_to_item (None/list) the path to the exception in the
received_data dict
"""
self.path_to_item = path_to_item
full_msg = msg
if path_to_item:
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
super(ApiKeyError, self).__init__(full_msg)
class ApiException(OpenApiException):
"""
class ApiException
"""
def __init__(self, status=None, reason=None, http_resp=None):
"""
__init__
"""
if http_resp:
self.status = http_resp.status
self.reason = http_resp.reason
self.body = http_resp.data
self.headers = http_resp.getheaders()
else:
self.status = status
self.reason = reason
self.body = None
self.headers = None
def __str__(self):
"""Custom error messages for exception"""
error_message = "({0})\n"\
"Reason: {1}\n".format(self.status, self.reason)
if self.headers:
error_message += "HTTP response headers: {0}\n".format(
self.headers)
if self.body:
error_message += "HTTP response body: {0}\n".format(self.body)
return error_message
class NotFoundException(ApiException):
"""
class NotFoundException
"""
def __init__(self, status=None, reason=None, http_resp=None):
"""
__init__
"""
super(NotFoundException, self).__init__(status, reason, http_resp)
class UnauthorizedException(ApiException):
"""
class UnauthorizedException
"""
def __init__(self, status=None, reason=None, http_resp=None):
"""
__init__
"""
super(UnauthorizedException, self).__init__(status, reason, http_resp)
class ForbiddenException(ApiException):
"""
class ForbiddenException
"""
def __init__(self, status=None, reason=None, http_resp=None):
"""
__init__
"""
super(ForbiddenException, self).__init__(status, reason, http_resp)
class ServiceException(ApiException):
"""
class ServiceException
"""
def __init__(self, status=None, reason=None, http_resp=None):
"""
__init__
"""
super(ServiceException, self).__init__(status, reason, http_resp)
def render_path(path_to_item):
"""Returns a string representation of a path"""
result = ""
for pth in path_to_item:
if isinstance(pth, int):
result += "[{0}]".format(pth)
else:
result += "['{0}']".format(pth)
return result

View File

@ -0,0 +1,5 @@
# we can not import model classes here because that would create a circular
# reference which would not work in python2
# do not import all models into this module because that uses a lot of memory and stack frames
# if you need the ability to import all models from one package, import them with
# from {{packageName}.models import ModelA, ModelB

View File

@ -0,0 +1,276 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from openapi_client.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
OpenApiModel
)
from openapi_client.exceptions import ApiAttributeError
class OauthTokenAuthorizationCodeResponse(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
additional_properties_type (tuple): A tuple of classes accepted
as additional properties values.
"""
allowed_values = {
}
validations = {
}
@cached_property
def additional_properties_type():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@cached_property
def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
return {
'expires_in': (int,), # noqa: E501
'refresh_token': (str,), # noqa: E501
'access_token': (str,), # noqa: E501
'session_secret': (str,), # noqa: E501
'session_key': (str,), # noqa: E501
'scope': (str,), # noqa: E501
}
@cached_property
def discriminator():
return None
attribute_map = {
'expires_in': 'expires_in', # noqa: E501
'refresh_token': 'refresh_token', # noqa: E501
'access_token': 'access_token', # noqa: E501
'session_secret': 'session_secret', # noqa: E501
'session_key': 'session_key', # noqa: E501
'scope': 'scope', # noqa: E501
}
read_only_vars = {
}
_composed_schemas = {}
@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""OauthTokenAuthorizationCodeResponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
expires_in (int): [optional] # noqa: E501
refresh_token (str): [optional] # noqa: E501
access_token (str): [optional] # noqa: E501
session_secret (str): [optional] # noqa: E501
session_key (str): [optional] # noqa: E501
scope (str): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
self = super(OpenApiModel, cls).__new__(cls)
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
return self
required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""OauthTokenAuthorizationCodeResponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
expires_in (int): [optional] # noqa: E501
refresh_token (str): [optional] # noqa: E501
access_token (str): [optional] # noqa: E501
session_secret (str): [optional] # noqa: E501
session_key (str): [optional] # noqa: E501
scope (str): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
if var_name in self.read_only_vars:
raise ApiAttributeError(
f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
f"class with read only attributes.")

View File

@ -0,0 +1,276 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from openapi_client.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
OpenApiModel
)
from openapi_client.exceptions import ApiAttributeError
class OauthTokenDeviceCodeResponse(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
additional_properties_type (tuple): A tuple of classes accepted
as additional properties values.
"""
allowed_values = {
}
validations = {
}
@cached_property
def additional_properties_type():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@cached_property
def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
return {
'device_code': (str,), # noqa: E501
'user_code': (str,), # noqa: E501
'verification_url': (str,), # noqa: E501
'qrcode_url': (str,), # noqa: E501
'expires_in': (int,), # noqa: E501
'interval': (int,), # noqa: E501
}
@cached_property
def discriminator():
return None
attribute_map = {
'device_code': 'device_code', # noqa: E501
'user_code': 'user_code', # noqa: E501
'verification_url': 'verification_url', # noqa: E501
'qrcode_url': 'qrcode_url', # noqa: E501
'expires_in': 'expires_in', # noqa: E501
'interval': 'interval', # noqa: E501
}
read_only_vars = {
}
_composed_schemas = {}
@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""OauthTokenDeviceCodeResponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
device_code (str): [optional] # noqa: E501
user_code (str): [optional] # noqa: E501
verification_url (str): [optional] # noqa: E501
qrcode_url (str): [optional] # noqa: E501
expires_in (int): [optional] # noqa: E501
interval (int): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
self = super(OpenApiModel, cls).__new__(cls)
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
return self
required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""OauthTokenDeviceCodeResponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
device_code (str): [optional] # noqa: E501
user_code (str): [optional] # noqa: E501
verification_url (str): [optional] # noqa: E501
qrcode_url (str): [optional] # noqa: E501
expires_in (int): [optional] # noqa: E501
interval (int): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
if var_name in self.read_only_vars:
raise ApiAttributeError(
f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
f"class with read only attributes.")

View File

@ -0,0 +1,276 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from openapi_client.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
OpenApiModel
)
from openapi_client.exceptions import ApiAttributeError
class OauthTokenDeviceTokenResponse(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
additional_properties_type (tuple): A tuple of classes accepted
as additional properties values.
"""
allowed_values = {
}
validations = {
}
@cached_property
def additional_properties_type():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@cached_property
def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
return {
'expires_in': (int,), # noqa: E501
'refresh_token': (str,), # noqa: E501
'access_token': (str,), # noqa: E501
'session_secret': (str,), # noqa: E501
'session_key': (str,), # noqa: E501
'scope': (str,), # noqa: E501
}
@cached_property
def discriminator():
return None
attribute_map = {
'expires_in': 'expires_in', # noqa: E501
'refresh_token': 'refresh_token', # noqa: E501
'access_token': 'access_token', # noqa: E501
'session_secret': 'session_secret', # noqa: E501
'session_key': 'session_key', # noqa: E501
'scope': 'scope', # noqa: E501
}
read_only_vars = {
}
_composed_schemas = {}
@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""OauthTokenDeviceTokenResponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
expires_in (int): [optional] # noqa: E501
refresh_token (str): [optional] # noqa: E501
access_token (str): [optional] # noqa: E501
session_secret (str): [optional] # noqa: E501
session_key (str): [optional] # noqa: E501
scope (str): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
self = super(OpenApiModel, cls).__new__(cls)
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
return self
required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""OauthTokenDeviceTokenResponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
expires_in (int): [optional] # noqa: E501
refresh_token (str): [optional] # noqa: E501
access_token (str): [optional] # noqa: E501
session_secret (str): [optional] # noqa: E501
session_key (str): [optional] # noqa: E501
scope (str): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
if var_name in self.read_only_vars:
raise ApiAttributeError(
f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
f"class with read only attributes.")

View File

@ -0,0 +1,276 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from openapi_client.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
OpenApiModel
)
from openapi_client.exceptions import ApiAttributeError
class OauthTokenRefreshTokenResponse(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
additional_properties_type (tuple): A tuple of classes accepted
as additional properties values.
"""
allowed_values = {
}
validations = {
}
@cached_property
def additional_properties_type():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@cached_property
def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
return {
'expires_in': (int,), # noqa: E501
'refresh_token': (str,), # noqa: E501
'access_token': (str,), # noqa: E501
'session_secret': (str,), # noqa: E501
'session_key': (str,), # noqa: E501
'scope': (str,), # noqa: E501
}
@cached_property
def discriminator():
return None
attribute_map = {
'expires_in': 'expires_in', # noqa: E501
'refresh_token': 'refresh_token', # noqa: E501
'access_token': 'access_token', # noqa: E501
'session_secret': 'session_secret', # noqa: E501
'session_key': 'session_key', # noqa: E501
'scope': 'scope', # noqa: E501
}
read_only_vars = {
}
_composed_schemas = {}
@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""OauthTokenRefreshTokenResponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
expires_in (int): [optional] # noqa: E501
refresh_token (str): [optional] # noqa: E501
access_token (str): [optional] # noqa: E501
session_secret (str): [optional] # noqa: E501
session_key (str): [optional] # noqa: E501
scope (str): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
self = super(OpenApiModel, cls).__new__(cls)
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
return self
required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""OauthTokenRefreshTokenResponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
expires_in (int): [optional] # noqa: E501
refresh_token (str): [optional] # noqa: E501
access_token (str): [optional] # noqa: E501
session_secret (str): [optional] # noqa: E501
session_key (str): [optional] # noqa: E501
scope (str): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
if var_name in self.read_only_vars:
raise ApiAttributeError(
f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
f"class with read only attributes.")

View File

@ -0,0 +1,276 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from openapi_client.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
OpenApiModel
)
from openapi_client.exceptions import ApiAttributeError
class Quotaresponse(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
additional_properties_type (tuple): A tuple of classes accepted
as additional properties values.
"""
allowed_values = {
}
validations = {
}
@cached_property
def additional_properties_type():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@cached_property
def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
return {
'errno': (int,), # noqa: E501
'total': (int,), # noqa: E501
'free': (int,), # noqa: E501
'request_id': (int,), # noqa: E501
'expire': (bool,), # noqa: E501
'used': (int,), # noqa: E501
}
@cached_property
def discriminator():
return None
attribute_map = {
'errno': 'errno', # noqa: E501
'total': 'total', # noqa: E501
'free': 'free', # noqa: E501
'request_id': 'request_id', # noqa: E501
'expire': 'expire', # noqa: E501
'used': 'used', # noqa: E501
}
read_only_vars = {
}
_composed_schemas = {}
@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""Quotaresponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
errno (int): [optional] # noqa: E501
total (int): [optional] # noqa: E501
free (int): [optional] # noqa: E501
request_id (int): [optional] # noqa: E501
expire (bool): [optional] # noqa: E501
used (int): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
self = super(OpenApiModel, cls).__new__(cls)
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
return self
required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""Quotaresponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
errno (int): [optional] # noqa: E501
total (int): [optional] # noqa: E501
free (int): [optional] # noqa: E501
request_id (int): [optional] # noqa: E501
expire (bool): [optional] # noqa: E501
used (int): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
if var_name in self.read_only_vars:
raise ApiAttributeError(
f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
f"class with read only attributes.")

View File

@ -0,0 +1,284 @@
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from openapi_client.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
OpenApiModel
)
from openapi_client.exceptions import ApiAttributeError
class Uinforesponse(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
additional_properties_type (tuple): A tuple of classes accepted
as additional properties values.
"""
allowed_values = {
}
validations = {
}
@cached_property
def additional_properties_type():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@cached_property
def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
return {
'errno': (int,), # noqa: E501
'errmsg': (str,), # noqa: E501
'uk': (int,), # noqa: E501
'request_id': (str,), # noqa: E501
'avatar_url': (str,), # noqa: E501
'baidu_name': (str,), # noqa: E501
'netdisk_name': (str,), # noqa: E501
'vip_type': (int,), # noqa: E501
}
@cached_property
def discriminator():
return None
attribute_map = {
'errno': 'errno', # noqa: E501
'errmsg': 'errmsg', # noqa: E501
'uk': 'uk', # noqa: E501
'request_id': 'request_id', # noqa: E501
'avatar_url': 'avatar_url', # noqa: E501
'baidu_name': 'baidu_name', # noqa: E501
'netdisk_name': 'netdisk_name', # noqa: E501
'vip_type': 'vip_type', # noqa: E501
}
read_only_vars = {
}
_composed_schemas = {}
@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""Uinforesponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
errno (int): [optional] # noqa: E501
errmsg (str): [optional] # noqa: E501
uk (int): [optional] # noqa: E501
request_id (str): [optional] # noqa: E501
avatar_url (str): [optional] # noqa: E501
baidu_name (str): [optional] # noqa: E501
netdisk_name (str): [optional] # noqa: E501
vip_type (int): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
self = super(OpenApiModel, cls).__new__(cls)
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
return self
required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""Uinforesponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
errno (int): [optional] # noqa: E501
errmsg (str): [optional] # noqa: E501
uk (int): [optional] # noqa: E501
request_id (str): [optional] # noqa: E501
avatar_url (str): [optional] # noqa: E501
baidu_name (str): [optional] # noqa: E501
netdisk_name (str): [optional] # noqa: E501
vip_type (int): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
if var_name in self.read_only_vars:
raise ApiAttributeError(
f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
f"class with read only attributes.")

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,385 @@
# !/usr/bin/env python3
"""
xpan
xpanapi # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import io
import json
import logging
import re
import ssl
from urllib.parse import urlencode
from urllib.parse import urlparse
from urllib.request import proxy_bypass_environment
import urllib3
import ipaddress
from openapi_client.exceptions import ApiException, UnauthorizedException, ForbiddenException
from openapi_client.exceptions import NotFoundException, ServiceException, ApiValueError
logger = logging.getLogger(__name__)
class RESTResponse(io.IOBase):
"""
class RESTResponse
"""
def __init__(self, resp):
"""
init
"""
self.urllib3_response = resp
self.status = resp.status
self.reason = resp.reason
self.data = resp.data
def getheaders(self):
"""Returns a dictionary of the response headers."""
return self.urllib3_response.getheaders()
def getheader(self, name, default=None):
"""Returns a given response header."""
return self.urllib3_response.getheader(name, default)
class RESTClientObject(object):
"""
class RESTClientObject
"""
def __init__(self, configuration, pools_size=4, maxsize=None):
# urllib3.PoolManager will pass all kw parameters to connectionpool
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
# maxsize is the number of requests to host that are allowed in parallel # noqa: E501
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
# cert_reqs
if configuration.verify_ssl:
cert_reqs = ssl.CERT_REQUIRED
else:
cert_reqs = ssl.CERT_NONE
addition_pool_args = {}
if configuration.assert_hostname is not None:
addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501
if configuration.retries is not None:
addition_pool_args['retries'] = configuration.retries
if configuration.socket_options is not None:
addition_pool_args['socket_options'] = configuration.socket_options
if maxsize is None:
if configuration.connection_pool_maxsize is not None:
maxsize = configuration.connection_pool_maxsize
else:
maxsize = 4
# https pool manager
if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''):
self.pool_manager = urllib3.ProxyManager(
num_pools=pools_size,
maxsize=maxsize,
cert_reqs=cert_reqs,
ca_certs=configuration.ssl_ca_cert,
cert_file=configuration.cert_file,
key_file=configuration.key_file,
proxy_url=configuration.proxy,
proxy_headers=configuration.proxy_headers,
**addition_pool_args
)
else:
self.pool_manager = urllib3.PoolManager(
num_pools=pools_size,
maxsize=maxsize,
cert_reqs=cert_reqs,
ca_certs=configuration.ssl_ca_cert,
cert_file=configuration.cert_file,
key_file=configuration.key_file,
**addition_pool_args
)
def request(self, method, url, query_params=None, headers=None,
body=None, post_params=None, _preload_content=True,
_request_timeout=None):
"""Perform requests.
:param method: http request method
:param url: http request url
:param query_params: query parameters in the url
:param headers: http request headers
:param body: request json body, for `application/json`
:param post_params: request post parameters,
`application/x-www-form-urlencoded`
and `multipart/form-data`
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
"""
method = method.upper()
assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT',
'PATCH', 'OPTIONS']
if post_params and body:
raise ApiValueError(
"body parameter cannot be used with post_params parameter."
)
post_params = post_params or {}
headers = headers or {}
timeout = None
if _request_timeout:
if isinstance(_request_timeout, (int, float)): # noqa: E501,F821
timeout = urllib3.Timeout(total=_request_timeout)
elif (isinstance(_request_timeout, tuple) and
len(_request_timeout) == 2):
timeout = urllib3.Timeout(
connect=_request_timeout[0], read=_request_timeout[1])
try:
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
# Only set a default Content-Type for POST, PUT, PATCH and OPTIONS requests
if (method != 'DELETE') and ('Content-Type' not in headers):
headers['Content-Type'] = 'application/json'
if query_params:
url += '&' + urlencode(query_params)
# url += '?' + urlencode(query_params)
if ('Content-Type' not in headers) or (re.search('json', headers['Content-Type'], re.IGNORECASE)):
request_body = None
if body is not None:
request_body = json.dumps(body)
r = self.pool_manager.request(
method, url,
body=request_body,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
r = self.pool_manager.request(
method, url,
fields=post_params,
encode_multipart=False,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
elif headers['Content-Type'] == 'multipart/form-data':
# must del headers['Content-Type'], or the correct
# Content-Type which generated by urllib3 will be
# overwritten.
del headers['Content-Type']
r = self.pool_manager.request(
method, url,
fields=post_params,
encode_multipart=True,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
# Pass a `string` parameter directly in the body to support
# other content types than Json when `body` argument is
# provided in serialized form
elif isinstance(body, str) or isinstance(body, bytes):
request_body = body
r = self.pool_manager.request(
method, url,
body=request_body,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
else:
# Cannot generate the request from given parameters
msg = """Cannot prepare a request message for provided
arguments. Please check that your arguments match
declared content type."""
raise ApiException(status=0, reason=msg)
# For `GET`, `HEAD`
else:
r = self.pool_manager.request(method, url,
# fields=query_params,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
except urllib3.exceptions.SSLError as e:
msg = "{0}\n{1}".format(type(e).__name__, str(e))
raise ApiException(status=0, reason=msg)
if _preload_content:
r = RESTResponse(r)
# log response body
logger.debug("response body: %s", r.data)
if not 200 <= r.status <= 299:
if r.status == 401:
raise UnauthorizedException(http_resp=r)
if r.status == 403:
raise ForbiddenException(http_resp=r)
if r.status == 404:
raise NotFoundException(http_resp=r)
if 500 <= r.status <= 599:
raise ServiceException(http_resp=r)
raise ApiException(http_resp=r)
return r
def GET(self, url, headers=None, query_params=None, _preload_content=True,
_request_timeout=None):
"""
HTTP Get
"""
if query_params:
url += '&' + urlencode(query_params)
# print(url)
return self.request("GET", url,
headers=headers,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
query_params=query_params)
def HEAD(self, url, headers=None, query_params=None, _preload_content=True,
_request_timeout=None):
"""
HTTP HEAD
"""
return self.request("HEAD", url,
headers=headers,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
query_params=query_params)
def OPTIONS(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
"""
HTTP OPTIONS
"""
return self.request("OPTIONS", url,
headers=headers,
query_params=query_params,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
def DELETE(self, url, headers=None, query_params=None, body=None,
_preload_content=True, _request_timeout=None):
"""
HTTP DELETE
"""
return self.request("DELETE", url,
headers=headers,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
def POST(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
"""
HTTP POST
"""
return self.request("POST", url,
headers = headers,
query_params = query_params,
post_params = post_params,
_preload_content = _preload_content,
_request_timeout = _request_timeout,
body = body)
def PUT(self, url, headers = None, query_params = None, post_params = None,
body=None, _preload_content=True, _request_timeout=None):
"""
HTTP PUT
"""
return self.request("PUT", url,
headers=headers,
query_params=query_params,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
def PATCH(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
"""
HTTP PATCH
"""
return self.request("PATCH", url,
headers=headers,
query_params=query_params,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
# end of class RESTClientObject
def is_ipv4(target):
""" Test if IPv4 address or not
"""
try:
chk = ipaddress.IPv4Address(target)
return True
except ipaddress.AddressValueError:
return False
def in_ipv4net(target, net):
""" Test if target belongs to given IPv4 network
"""
try:
nw = ipaddress.IPv4Network(net)
ip = ipaddress.IPv4Address(target)
if ip in nw:
return True
return False
except ipaddress.AddressValueError:
return False
except ipaddress.NetmaskValueError:
return False
def should_bypass_proxies(url, no_proxy=None):
""" Yet another requests.should_bypass_proxies
Test if proxies should not be used for a particular url.
"""
parsed = urlparse(url)
# special cases
if parsed.hostname in [None, '']:
return True
# special cases
if no_proxy in [None ,'']:
return False
if no_proxy == '*':
return True
no_proxy = no_proxy.lower().replace(' ', '');
entries = (
host for host in no_proxy.split(',') if host
)
if is_ipv4(parsed.hostname):
for item in entries:
if in_ipv4net(parsed.hostname, item):
return True
return proxy_bypass_environment(parsed.hostname, {'no': no_proxy})

View File

@ -0,0 +1 @@
urllib3 >= 1.25.3

78
baiduSdk/test.py Normal file
View File

@ -0,0 +1,78 @@
import requests
import urllib.parse
import json
from configToken import ACCESS_TOKEN
from config import CATEGORY_MAP
import os
# 配置
path = "/"
access_token = ACCESS_TOKEN
headers = {'User-Agent': 'pan.baidu.com'}
# 类型映射
# -----------------------------
# 1. 获取目录下所有文件列表
# -----------------------------
list_url = (
"https://pan.baidu.com/rest/2.0/xpan/multimedia?"
f"method=listall&path={urllib.parse.quote(path)}&access_token={access_token}"
"&web=1&recursion=1&start=0&limit=100"
)
response = requests.get(list_url, headers=headers)
data = response.json()
fs_ids = [int(file_info['fs_id']) for file_info in data.get("list", [])]
if not fs_ids:
print("目录下没有文件")
exit()
# -----------------------------
# 2. 分批获取 filemetas
# -----------------------------
def chunks(lst, n):
"""把列表分成每 n 个一组"""
for i in range(0, len(lst), n):
yield lst[i:i + n]
all_file_details = []
for fs_batch in chunks(fs_ids, 100):
fsids_param = urllib.parse.quote(json.dumps(fs_batch, separators=(',', '')))
filemetas_url = (
f"https://pan.baidu.com/rest/2.0/xpan/multimedia?"
f"method=filemetas&access_token={access_token}&fsids={fsids_param}"
"&thumb=1&dlink=1&extra=1&needmedia=1&detail=1"
)
resp = requests.get(filemetas_url, headers=headers)
result = resp.json()
all_file_details.extend(result.get("list", []))
# -----------------------------
# 3. 打印文件信息(支持目录结构和类型)
# -----------------------------
for file_info in all_file_details:
# 文件名处理
server_filename = file_info.get("server_filename")
file_path = file_info.get("path")
if not server_filename:
server_filename = os.path.basename(file_path) # 从路径取最后一段
server_filename = os.path.splitext(server_filename)[0] # 去掉扩展名
size = file_info.get("size", 0)
dlink = file_info.get("dlink") # 下载链接
category = CATEGORY_MAP.get(file_info.get("category", 6), "其他") # 默认其他
is_dir = file_info.get("isdir", 0)
# 打印
print(f"文件名: {server_filename}")
print(f"路径: {file_path}")
print(f"类型: {category}{' (目录)' if is_dir else ''}")
print(f"大小: {size} 字节")
print(f"下载链接: {dlink if dlink else 'None'}")
print("=" * 50)

81
dingdingSdk/.gitignore vendored Normal file
View File

@ -0,0 +1,81 @@
# OS
.DS_Store
# IDE
.idea
.settings
.cache/
.tmp
.vscode/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.coverage
.hypothesis/
.pytest_cache/
pytestdebug.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# pyenv
.python-version
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/

View File

@ -0,0 +1,3 @@
#钉钉配置
APP_KEY="dinguetojbaxvvhzpk3d"
APP_SECRET="lMFqns_ceLIcXvfLL8GKfa3ZiPKHcaZq0VbGtJXJlDuK8AEJ2WV3-PN8zv61ajm3"

13
dingdingSdk/LICENSE Normal file
View File

@ -0,0 +1,13 @@
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1 @@
__version__ = '2.2.27'

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

View File

@ -0,0 +1,259 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.core import TeaCore
from alibabacloud_tea_openapi.client import Client as OpenApiClient
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_gateway_dingtalk.client import Client as GatewayClientClient
from alibabacloud_tea_util.client import Client as UtilClient
from alibabacloud_dingtalk.activity_1_0 import models as dingtalkactivity__1__0_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_openapi_util.client import Client as OpenApiUtilClient
class Client(OpenApiClient):
"""
*\
"""
def __init__(
self,
config: open_api_models.Config,
):
super().__init__(config)
gateway_client = GatewayClientClient()
self._spi = gateway_client
self._endpoint_rule = ''
if UtilClient.empty(self._endpoint):
self._endpoint = 'api.dingtalk.com'
def create_activity_with_options(
self,
request: dingtalkactivity__1__0_models.CreateActivityRequest,
headers: dingtalkactivity__1__0_models.CreateActivityHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkactivity__1__0_models.CreateActivityResponse:
"""
@summary 创建活动
@param request: CreateActivityRequest
@param headers: CreateActivityHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: CreateActivityResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.detail):
body['detail'] = request.detail
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='CreateActivity',
version='activity_1.0',
protocol='HTTP',
pathname=f'/v1.0/activity/meta',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkactivity__1__0_models.CreateActivityResponse(),
self.execute(params, req, runtime)
)
async def create_activity_with_options_async(
self,
request: dingtalkactivity__1__0_models.CreateActivityRequest,
headers: dingtalkactivity__1__0_models.CreateActivityHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkactivity__1__0_models.CreateActivityResponse:
"""
@summary 创建活动
@param request: CreateActivityRequest
@param headers: CreateActivityHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: CreateActivityResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.detail):
body['detail'] = request.detail
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='CreateActivity',
version='activity_1.0',
protocol='HTTP',
pathname=f'/v1.0/activity/meta',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkactivity__1__0_models.CreateActivityResponse(),
await self.execute_async(params, req, runtime)
)
def create_activity(
self,
request: dingtalkactivity__1__0_models.CreateActivityRequest,
) -> dingtalkactivity__1__0_models.CreateActivityResponse:
"""
@summary 创建活动
@param request: CreateActivityRequest
@return: CreateActivityResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkactivity__1__0_models.CreateActivityHeaders()
return self.create_activity_with_options(request, headers, runtime)
async def create_activity_async(
self,
request: dingtalkactivity__1__0_models.CreateActivityRequest,
) -> dingtalkactivity__1__0_models.CreateActivityResponse:
"""
@summary 创建活动
@param request: CreateActivityRequest
@return: CreateActivityResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkactivity__1__0_models.CreateActivityHeaders()
return await self.create_activity_with_options_async(request, headers, runtime)
def list_activity_with_options(
self,
request: dingtalkactivity__1__0_models.ListActivityRequest,
headers: dingtalkactivity__1__0_models.ListActivityHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkactivity__1__0_models.ListActivityResponse:
"""
@summary 查询活动列表
@param request: ListActivityRequest
@param headers: ListActivityHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: ListActivityResponse
"""
UtilClient.validate_model(request)
query = {}
if not UtilClient.is_unset(request.max_results):
query['maxResults'] = request.max_results
if not UtilClient.is_unset(request.next_token):
query['nextToken'] = request.next_token
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
query=OpenApiUtilClient.query(query)
)
params = open_api_models.Params(
action='ListActivity',
version='activity_1.0',
protocol='HTTP',
pathname=f'/v1.0/activity/metaLists',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkactivity__1__0_models.ListActivityResponse(),
self.execute(params, req, runtime)
)
async def list_activity_with_options_async(
self,
request: dingtalkactivity__1__0_models.ListActivityRequest,
headers: dingtalkactivity__1__0_models.ListActivityHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkactivity__1__0_models.ListActivityResponse:
"""
@summary 查询活动列表
@param request: ListActivityRequest
@param headers: ListActivityHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: ListActivityResponse
"""
UtilClient.validate_model(request)
query = {}
if not UtilClient.is_unset(request.max_results):
query['maxResults'] = request.max_results
if not UtilClient.is_unset(request.next_token):
query['nextToken'] = request.next_token
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
query=OpenApiUtilClient.query(query)
)
params = open_api_models.Params(
action='ListActivity',
version='activity_1.0',
protocol='HTTP',
pathname=f'/v1.0/activity/metaLists',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkactivity__1__0_models.ListActivityResponse(),
await self.execute_async(params, req, runtime)
)
def list_activity(
self,
request: dingtalkactivity__1__0_models.ListActivityRequest,
) -> dingtalkactivity__1__0_models.ListActivityResponse:
"""
@summary 查询活动列表
@param request: ListActivityRequest
@return: ListActivityResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkactivity__1__0_models.ListActivityHeaders()
return self.list_activity_with_options(request, headers, runtime)
async def list_activity_async(
self,
request: dingtalkactivity__1__0_models.ListActivityRequest,
) -> dingtalkactivity__1__0_models.ListActivityResponse:
"""
@summary 查询活动列表
@param request: ListActivityRequest
@return: ListActivityResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkactivity__1__0_models.ListActivityHeaders()
return await self.list_activity_with_options_async(request, headers, runtime)

View File

@ -0,0 +1,510 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.model import TeaModel
from typing import Dict, List
class CreateActivityHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class CreateActivityRequestDetailAddress(TeaModel):
def __init__(
self,
district: str = None,
lat: str = None,
lng: str = None,
name: str = None,
):
self.district = district
self.lat = lat
self.lng = lng
self.name = name
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.district is not None:
result['district'] = self.district
if self.lat is not None:
result['lat'] = self.lat
if self.lng is not None:
result['lng'] = self.lng
if self.name is not None:
result['name'] = self.name
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('district') is not None:
self.district = m.get('district')
if m.get('lat') is not None:
self.lat = m.get('lat')
if m.get('lng') is not None:
self.lng = m.get('lng')
if m.get('name') is not None:
self.name = m.get('name')
return self
class CreateActivityRequestDetail(TeaModel):
def __init__(
self,
address: CreateActivityRequestDetailAddress = None,
banner_media_id: str = None,
end_time: int = None,
foreign_id: str = None,
industry: str = None,
role_name: str = None,
source: str = None,
start_time: int = None,
title: str = None,
type: int = None,
url: str = None,
):
self.address = address
# This parameter is required.
self.banner_media_id = banner_media_id
# This parameter is required.
self.end_time = end_time
# This parameter is required.
self.foreign_id = foreign_id
# This parameter is required.
self.industry = industry
# This parameter is required.
self.role_name = role_name
# This parameter is required.
self.source = source
# This parameter is required.
self.start_time = start_time
# This parameter is required.
self.title = title
# This parameter is required.
self.type = type
# This parameter is required.
self.url = url
def validate(self):
if self.address:
self.address.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.address is not None:
result['address'] = self.address.to_map()
if self.banner_media_id is not None:
result['bannerMediaId'] = self.banner_media_id
if self.end_time is not None:
result['endTime'] = self.end_time
if self.foreign_id is not None:
result['foreignId'] = self.foreign_id
if self.industry is not None:
result['industry'] = self.industry
if self.role_name is not None:
result['roleName'] = self.role_name
if self.source is not None:
result['source'] = self.source
if self.start_time is not None:
result['startTime'] = self.start_time
if self.title is not None:
result['title'] = self.title
if self.type is not None:
result['type'] = self.type
if self.url is not None:
result['url'] = self.url
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('address') is not None:
temp_model = CreateActivityRequestDetailAddress()
self.address = temp_model.from_map(m['address'])
if m.get('bannerMediaId') is not None:
self.banner_media_id = m.get('bannerMediaId')
if m.get('endTime') is not None:
self.end_time = m.get('endTime')
if m.get('foreignId') is not None:
self.foreign_id = m.get('foreignId')
if m.get('industry') is not None:
self.industry = m.get('industry')
if m.get('roleName') is not None:
self.role_name = m.get('roleName')
if m.get('source') is not None:
self.source = m.get('source')
if m.get('startTime') is not None:
self.start_time = m.get('startTime')
if m.get('title') is not None:
self.title = m.get('title')
if m.get('type') is not None:
self.type = m.get('type')
if m.get('url') is not None:
self.url = m.get('url')
return self
class CreateActivityRequest(TeaModel):
def __init__(
self,
detail: CreateActivityRequestDetail = None,
):
# This parameter is required.
self.detail = detail
def validate(self):
if self.detail:
self.detail.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.detail is not None:
result['detail'] = self.detail.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('detail') is not None:
temp_model = CreateActivityRequestDetail()
self.detail = temp_model.from_map(m['detail'])
return self
class CreateActivityResponseBody(TeaModel):
def __init__(
self,
activity_id: str = None,
):
self.activity_id = activity_id
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.activity_id is not None:
result['activityId'] = self.activity_id
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('activityId') is not None:
self.activity_id = m.get('activityId')
return self
class CreateActivityResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: CreateActivityResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = CreateActivityResponseBody()
self.body = temp_model.from_map(m['body'])
return self
class ListActivityHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class ListActivityRequest(TeaModel):
def __init__(
self,
max_results: int = None,
next_token: str = None,
):
self.max_results = max_results
self.next_token = next_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.max_results is not None:
result['maxResults'] = self.max_results
if self.next_token is not None:
result['nextToken'] = self.next_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('maxResults') is not None:
self.max_results = m.get('maxResults')
if m.get('nextToken') is not None:
self.next_token = m.get('nextToken')
return self
class ListActivityResponseBodyList(TeaModel):
def __init__(
self,
activity_id: str = None,
banner_media_id: str = None,
end_time: int = None,
foreign_id: str = None,
start_time: int = None,
status: str = None,
title: str = None,
type: str = None,
url: str = None,
):
self.activity_id = activity_id
self.banner_media_id = banner_media_id
self.end_time = end_time
self.foreign_id = foreign_id
self.start_time = start_time
self.status = status
self.title = title
self.type = type
self.url = url
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.activity_id is not None:
result['activityId'] = self.activity_id
if self.banner_media_id is not None:
result['bannerMediaId'] = self.banner_media_id
if self.end_time is not None:
result['endTime'] = self.end_time
if self.foreign_id is not None:
result['foreignId'] = self.foreign_id
if self.start_time is not None:
result['startTime'] = self.start_time
if self.status is not None:
result['status'] = self.status
if self.title is not None:
result['title'] = self.title
if self.type is not None:
result['type'] = self.type
if self.url is not None:
result['url'] = self.url
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('activityId') is not None:
self.activity_id = m.get('activityId')
if m.get('bannerMediaId') is not None:
self.banner_media_id = m.get('bannerMediaId')
if m.get('endTime') is not None:
self.end_time = m.get('endTime')
if m.get('foreignId') is not None:
self.foreign_id = m.get('foreignId')
if m.get('startTime') is not None:
self.start_time = m.get('startTime')
if m.get('status') is not None:
self.status = m.get('status')
if m.get('title') is not None:
self.title = m.get('title')
if m.get('type') is not None:
self.type = m.get('type')
if m.get('url') is not None:
self.url = m.get('url')
return self
class ListActivityResponseBody(TeaModel):
def __init__(
self,
list: List[ListActivityResponseBodyList] = None,
max_results: str = None,
next_token: str = None,
):
self.list = list
self.max_results = max_results
self.next_token = next_token
def validate(self):
if self.list:
for k in self.list:
if k:
k.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
result['list'] = []
if self.list is not None:
for k in self.list:
result['list'].append(k.to_map() if k else None)
if self.max_results is not None:
result['maxResults'] = self.max_results
if self.next_token is not None:
result['nextToken'] = self.next_token
return result
def from_map(self, m: dict = None):
m = m or dict()
self.list = []
if m.get('list') is not None:
for k in m.get('list'):
temp_model = ListActivityResponseBodyList()
self.list.append(temp_model.from_map(k))
if m.get('maxResults') is not None:
self.max_results = m.get('maxResults')
if m.get('nextToken') is not None:
self.next_token = m.get('nextToken')
return self
class ListActivityResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: ListActivityResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = ListActivityResponseBody()
self.body = temp_model.from_map(m['body'])
return self

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

View File

@ -0,0 +1,637 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.core import TeaCore
from alibabacloud_tea_openapi.client import Client as OpenApiClient
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_gateway_dingtalk.client import Client as GatewayClientClient
from alibabacloud_tea_util.client import Client as UtilClient
from alibabacloud_dingtalk.ai_interaction_1_0 import models as dingtalkai_interaction__1__0_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_openapi_util.client import Client as OpenApiUtilClient
class Client(OpenApiClient):
"""
*\
"""
def __init__(
self,
config: open_api_models.Config,
):
super().__init__(config)
gateway_client = GatewayClientClient()
self._spi = gateway_client
self._endpoint_rule = ''
if UtilClient.empty(self._endpoint):
self._endpoint = 'api.dingtalk.com'
def finish_with_options(
self,
request: dingtalkai_interaction__1__0_models.FinishRequest,
headers: dingtalkai_interaction__1__0_models.FinishHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkai_interaction__1__0_models.FinishResponse:
"""
@summary 在主动模式下完结会话框
@param request: FinishRequest
@param headers: FinishHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: FinishResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.conversation_token):
body['conversationToken'] = request.conversation_token
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='Finish',
version='aiInteraction_1.0',
protocol='HTTP',
pathname=f'/v1.0/aiInteraction/finish',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkai_interaction__1__0_models.FinishResponse(),
self.execute(params, req, runtime)
)
async def finish_with_options_async(
self,
request: dingtalkai_interaction__1__0_models.FinishRequest,
headers: dingtalkai_interaction__1__0_models.FinishHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkai_interaction__1__0_models.FinishResponse:
"""
@summary 在主动模式下完结会话框
@param request: FinishRequest
@param headers: FinishHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: FinishResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.conversation_token):
body['conversationToken'] = request.conversation_token
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='Finish',
version='aiInteraction_1.0',
protocol='HTTP',
pathname=f'/v1.0/aiInteraction/finish',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkai_interaction__1__0_models.FinishResponse(),
await self.execute_async(params, req, runtime)
)
def finish(
self,
request: dingtalkai_interaction__1__0_models.FinishRequest,
) -> dingtalkai_interaction__1__0_models.FinishResponse:
"""
@summary 在主动模式下完结会话框
@param request: FinishRequest
@return: FinishResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkai_interaction__1__0_models.FinishHeaders()
return self.finish_with_options(request, headers, runtime)
async def finish_async(
self,
request: dingtalkai_interaction__1__0_models.FinishRequest,
) -> dingtalkai_interaction__1__0_models.FinishResponse:
"""
@summary 在主动模式下完结会话框
@param request: FinishRequest
@return: FinishResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkai_interaction__1__0_models.FinishHeaders()
return await self.finish_with_options_async(request, headers, runtime)
def prepare_with_options(
self,
request: dingtalkai_interaction__1__0_models.PrepareRequest,
headers: dingtalkai_interaction__1__0_models.PrepareHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkai_interaction__1__0_models.PrepareResponse:
"""
@summary 在主动模式下准备会话框
@param request: PrepareRequest
@param headers: PrepareHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: PrepareResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.content):
body['content'] = request.content
if not UtilClient.is_unset(request.content_type):
body['contentType'] = request.content_type
if not UtilClient.is_unset(request.open_conversation_id):
body['openConversationId'] = request.open_conversation_id
if not UtilClient.is_unset(request.union_id):
body['unionId'] = request.union_id
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='Prepare',
version='aiInteraction_1.0',
protocol='HTTP',
pathname=f'/v1.0/aiInteraction/prepare',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkai_interaction__1__0_models.PrepareResponse(),
self.execute(params, req, runtime)
)
async def prepare_with_options_async(
self,
request: dingtalkai_interaction__1__0_models.PrepareRequest,
headers: dingtalkai_interaction__1__0_models.PrepareHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkai_interaction__1__0_models.PrepareResponse:
"""
@summary 在主动模式下准备会话框
@param request: PrepareRequest
@param headers: PrepareHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: PrepareResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.content):
body['content'] = request.content
if not UtilClient.is_unset(request.content_type):
body['contentType'] = request.content_type
if not UtilClient.is_unset(request.open_conversation_id):
body['openConversationId'] = request.open_conversation_id
if not UtilClient.is_unset(request.union_id):
body['unionId'] = request.union_id
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='Prepare',
version='aiInteraction_1.0',
protocol='HTTP',
pathname=f'/v1.0/aiInteraction/prepare',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkai_interaction__1__0_models.PrepareResponse(),
await self.execute_async(params, req, runtime)
)
def prepare(
self,
request: dingtalkai_interaction__1__0_models.PrepareRequest,
) -> dingtalkai_interaction__1__0_models.PrepareResponse:
"""
@summary 在主动模式下准备会话框
@param request: PrepareRequest
@return: PrepareResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkai_interaction__1__0_models.PrepareHeaders()
return self.prepare_with_options(request, headers, runtime)
async def prepare_async(
self,
request: dingtalkai_interaction__1__0_models.PrepareRequest,
) -> dingtalkai_interaction__1__0_models.PrepareResponse:
"""
@summary 在主动模式下准备会话框
@param request: PrepareRequest
@return: PrepareResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkai_interaction__1__0_models.PrepareHeaders()
return await self.prepare_with_options_async(request, headers, runtime)
def reply_with_options(
self,
request: dingtalkai_interaction__1__0_models.ReplyRequest,
headers: dingtalkai_interaction__1__0_models.ReplyHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkai_interaction__1__0_models.ReplyResponse:
"""
@summary 在回复模式下更新会话框
@param request: ReplyRequest
@param headers: ReplyHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: ReplyResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.content):
body['content'] = request.content
if not UtilClient.is_unset(request.content_type):
body['contentType'] = request.content_type
if not UtilClient.is_unset(request.conversation_token):
body['conversationToken'] = request.conversation_token
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='Reply',
version='aiInteraction_1.0',
protocol='HTTP',
pathname=f'/v1.0/aiInteraction/reply',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkai_interaction__1__0_models.ReplyResponse(),
self.execute(params, req, runtime)
)
async def reply_with_options_async(
self,
request: dingtalkai_interaction__1__0_models.ReplyRequest,
headers: dingtalkai_interaction__1__0_models.ReplyHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkai_interaction__1__0_models.ReplyResponse:
"""
@summary 在回复模式下更新会话框
@param request: ReplyRequest
@param headers: ReplyHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: ReplyResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.content):
body['content'] = request.content
if not UtilClient.is_unset(request.content_type):
body['contentType'] = request.content_type
if not UtilClient.is_unset(request.conversation_token):
body['conversationToken'] = request.conversation_token
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='Reply',
version='aiInteraction_1.0',
protocol='HTTP',
pathname=f'/v1.0/aiInteraction/reply',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkai_interaction__1__0_models.ReplyResponse(),
await self.execute_async(params, req, runtime)
)
def reply(
self,
request: dingtalkai_interaction__1__0_models.ReplyRequest,
) -> dingtalkai_interaction__1__0_models.ReplyResponse:
"""
@summary 在回复模式下更新会话框
@param request: ReplyRequest
@return: ReplyResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkai_interaction__1__0_models.ReplyHeaders()
return self.reply_with_options(request, headers, runtime)
async def reply_async(
self,
request: dingtalkai_interaction__1__0_models.ReplyRequest,
) -> dingtalkai_interaction__1__0_models.ReplyResponse:
"""
@summary 在回复模式下更新会话框
@param request: ReplyRequest
@return: ReplyResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkai_interaction__1__0_models.ReplyHeaders()
return await self.reply_with_options_async(request, headers, runtime)
def send_with_options(
self,
request: dingtalkai_interaction__1__0_models.SendRequest,
headers: dingtalkai_interaction__1__0_models.SendHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkai_interaction__1__0_models.SendResponse:
"""
@summary 直接发送消息
@param request: SendRequest
@param headers: SendHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: SendResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.content):
body['content'] = request.content
if not UtilClient.is_unset(request.content_type):
body['contentType'] = request.content_type
if not UtilClient.is_unset(request.open_conversation_id):
body['openConversationId'] = request.open_conversation_id
if not UtilClient.is_unset(request.union_id):
body['unionId'] = request.union_id
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='Send',
version='aiInteraction_1.0',
protocol='HTTP',
pathname=f'/v1.0/aiInteraction/send',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkai_interaction__1__0_models.SendResponse(),
self.execute(params, req, runtime)
)
async def send_with_options_async(
self,
request: dingtalkai_interaction__1__0_models.SendRequest,
headers: dingtalkai_interaction__1__0_models.SendHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkai_interaction__1__0_models.SendResponse:
"""
@summary 直接发送消息
@param request: SendRequest
@param headers: SendHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: SendResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.content):
body['content'] = request.content
if not UtilClient.is_unset(request.content_type):
body['contentType'] = request.content_type
if not UtilClient.is_unset(request.open_conversation_id):
body['openConversationId'] = request.open_conversation_id
if not UtilClient.is_unset(request.union_id):
body['unionId'] = request.union_id
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='Send',
version='aiInteraction_1.0',
protocol='HTTP',
pathname=f'/v1.0/aiInteraction/send',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkai_interaction__1__0_models.SendResponse(),
await self.execute_async(params, req, runtime)
)
def send(
self,
request: dingtalkai_interaction__1__0_models.SendRequest,
) -> dingtalkai_interaction__1__0_models.SendResponse:
"""
@summary 直接发送消息
@param request: SendRequest
@return: SendResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkai_interaction__1__0_models.SendHeaders()
return self.send_with_options(request, headers, runtime)
async def send_async(
self,
request: dingtalkai_interaction__1__0_models.SendRequest,
) -> dingtalkai_interaction__1__0_models.SendResponse:
"""
@summary 直接发送消息
@param request: SendRequest
@return: SendResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkai_interaction__1__0_models.SendHeaders()
return await self.send_with_options_async(request, headers, runtime)
def update_with_options(
self,
request: dingtalkai_interaction__1__0_models.UpdateRequest,
headers: dingtalkai_interaction__1__0_models.UpdateHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkai_interaction__1__0_models.UpdateResponse:
"""
@summary 在主动模式下更新会话框
@param request: UpdateRequest
@param headers: UpdateHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: UpdateResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.content):
body['content'] = request.content
if not UtilClient.is_unset(request.content_type):
body['contentType'] = request.content_type
if not UtilClient.is_unset(request.conversation_token):
body['conversationToken'] = request.conversation_token
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='Update',
version='aiInteraction_1.0',
protocol='HTTP',
pathname=f'/v1.0/aiInteraction/update',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkai_interaction__1__0_models.UpdateResponse(),
self.execute(params, req, runtime)
)
async def update_with_options_async(
self,
request: dingtalkai_interaction__1__0_models.UpdateRequest,
headers: dingtalkai_interaction__1__0_models.UpdateHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkai_interaction__1__0_models.UpdateResponse:
"""
@summary 在主动模式下更新会话框
@param request: UpdateRequest
@param headers: UpdateHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: UpdateResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.content):
body['content'] = request.content
if not UtilClient.is_unset(request.content_type):
body['contentType'] = request.content_type
if not UtilClient.is_unset(request.conversation_token):
body['conversationToken'] = request.conversation_token
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='Update',
version='aiInteraction_1.0',
protocol='HTTP',
pathname=f'/v1.0/aiInteraction/update',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkai_interaction__1__0_models.UpdateResponse(),
await self.execute_async(params, req, runtime)
)
def update(
self,
request: dingtalkai_interaction__1__0_models.UpdateRequest,
) -> dingtalkai_interaction__1__0_models.UpdateResponse:
"""
@summary 在主动模式下更新会话框
@param request: UpdateRequest
@return: UpdateResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkai_interaction__1__0_models.UpdateHeaders()
return self.update_with_options(request, headers, runtime)
async def update_async(
self,
request: dingtalkai_interaction__1__0_models.UpdateRequest,
) -> dingtalkai_interaction__1__0_models.UpdateResponse:
"""
@summary 在主动模式下更新会话框
@param request: UpdateRequest
@return: UpdateResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkai_interaction__1__0_models.UpdateHeaders()
return await self.update_with_options_async(request, headers, runtime)

View File

@ -0,0 +1,831 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.model import TeaModel
from typing import Dict
class FinishHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class FinishRequest(TeaModel):
def __init__(
self,
conversation_token: str = None,
):
# This parameter is required.
self.conversation_token = conversation_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.conversation_token is not None:
result['conversationToken'] = self.conversation_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('conversationToken') is not None:
self.conversation_token = m.get('conversationToken')
return self
class FinishResponseBodyResult(TeaModel):
def __init__(
self,
success: bool = None,
):
self.success = success
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.success is not None:
result['success'] = self.success
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('success') is not None:
self.success = m.get('success')
return self
class FinishResponseBody(TeaModel):
def __init__(
self,
result: FinishResponseBodyResult = None,
):
self.result = result
def validate(self):
if self.result:
self.result.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.result is not None:
result['result'] = self.result.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('result') is not None:
temp_model = FinishResponseBodyResult()
self.result = temp_model.from_map(m['result'])
return self
class FinishResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: FinishResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = FinishResponseBody()
self.body = temp_model.from_map(m['body'])
return self
class PrepareHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class PrepareRequest(TeaModel):
def __init__(
self,
content: str = None,
content_type: str = None,
open_conversation_id: str = None,
union_id: str = None,
):
self.content = content
# This parameter is required.
self.content_type = content_type
self.open_conversation_id = open_conversation_id
self.union_id = union_id
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.content is not None:
result['content'] = self.content
if self.content_type is not None:
result['contentType'] = self.content_type
if self.open_conversation_id is not None:
result['openConversationId'] = self.open_conversation_id
if self.union_id is not None:
result['unionId'] = self.union_id
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('content') is not None:
self.content = m.get('content')
if m.get('contentType') is not None:
self.content_type = m.get('contentType')
if m.get('openConversationId') is not None:
self.open_conversation_id = m.get('openConversationId')
if m.get('unionId') is not None:
self.union_id = m.get('unionId')
return self
class PrepareResponseBodyResult(TeaModel):
def __init__(
self,
conversation_token: str = None,
):
self.conversation_token = conversation_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.conversation_token is not None:
result['conversationToken'] = self.conversation_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('conversationToken') is not None:
self.conversation_token = m.get('conversationToken')
return self
class PrepareResponseBody(TeaModel):
def __init__(
self,
result: PrepareResponseBodyResult = None,
):
self.result = result
def validate(self):
if self.result:
self.result.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.result is not None:
result['result'] = self.result.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('result') is not None:
temp_model = PrepareResponseBodyResult()
self.result = temp_model.from_map(m['result'])
return self
class PrepareResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: PrepareResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = PrepareResponseBody()
self.body = temp_model.from_map(m['body'])
return self
class ReplyHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class ReplyRequest(TeaModel):
def __init__(
self,
content: str = None,
content_type: str = None,
conversation_token: str = None,
):
self.content = content
# This parameter is required.
self.content_type = content_type
# This parameter is required.
self.conversation_token = conversation_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.content is not None:
result['content'] = self.content
if self.content_type is not None:
result['contentType'] = self.content_type
if self.conversation_token is not None:
result['conversationToken'] = self.conversation_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('content') is not None:
self.content = m.get('content')
if m.get('contentType') is not None:
self.content_type = m.get('contentType')
if m.get('conversationToken') is not None:
self.conversation_token = m.get('conversationToken')
return self
class ReplyResponseBodyResult(TeaModel):
def __init__(
self,
success: bool = None,
):
self.success = success
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.success is not None:
result['success'] = self.success
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('success') is not None:
self.success = m.get('success')
return self
class ReplyResponseBody(TeaModel):
def __init__(
self,
result: ReplyResponseBodyResult = None,
):
self.result = result
def validate(self):
if self.result:
self.result.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.result is not None:
result['result'] = self.result.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('result') is not None:
temp_model = ReplyResponseBodyResult()
self.result = temp_model.from_map(m['result'])
return self
class ReplyResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: ReplyResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = ReplyResponseBody()
self.body = temp_model.from_map(m['body'])
return self
class SendHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class SendRequest(TeaModel):
def __init__(
self,
content: str = None,
content_type: str = None,
open_conversation_id: str = None,
union_id: str = None,
):
self.content = content
# This parameter is required.
self.content_type = content_type
self.open_conversation_id = open_conversation_id
self.union_id = union_id
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.content is not None:
result['content'] = self.content
if self.content_type is not None:
result['contentType'] = self.content_type
if self.open_conversation_id is not None:
result['openConversationId'] = self.open_conversation_id
if self.union_id is not None:
result['unionId'] = self.union_id
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('content') is not None:
self.content = m.get('content')
if m.get('contentType') is not None:
self.content_type = m.get('contentType')
if m.get('openConversationId') is not None:
self.open_conversation_id = m.get('openConversationId')
if m.get('unionId') is not None:
self.union_id = m.get('unionId')
return self
class SendResponseBody(TeaModel):
def __init__(
self,
success: bool = None,
):
# This parameter is required.
self.success = success
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.success is not None:
result['success'] = self.success
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('success') is not None:
self.success = m.get('success')
return self
class SendResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: SendResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = SendResponseBody()
self.body = temp_model.from_map(m['body'])
return self
class UpdateHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class UpdateRequest(TeaModel):
def __init__(
self,
content: str = None,
content_type: str = None,
conversation_token: str = None,
):
# This parameter is required.
self.content = content
# This parameter is required.
self.content_type = content_type
# This parameter is required.
self.conversation_token = conversation_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.content is not None:
result['content'] = self.content
if self.content_type is not None:
result['contentType'] = self.content_type
if self.conversation_token is not None:
result['conversationToken'] = self.conversation_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('content') is not None:
self.content = m.get('content')
if m.get('contentType') is not None:
self.content_type = m.get('contentType')
if m.get('conversationToken') is not None:
self.conversation_token = m.get('conversationToken')
return self
class UpdateResponseBodyResult(TeaModel):
def __init__(
self,
success: bool = None,
):
self.success = success
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.success is not None:
result['success'] = self.success
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('success') is not None:
self.success = m.get('success')
return self
class UpdateResponseBody(TeaModel):
def __init__(
self,
result: UpdateResponseBodyResult = None,
):
self.result = result
def validate(self):
if self.result:
self.result.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.result is not None:
result['result'] = self.result.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('result') is not None:
temp_model = UpdateResponseBodyResult()
self.result = temp_model.from_map(m['result'])
return self
class UpdateResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: UpdateResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = UpdateResponseBody()
self.body = temp_model.from_map(m['body'])
return self

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

View File

@ -0,0 +1,283 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.core import TeaCore
from alibabacloud_tea_openapi.client import Client as OpenApiClient
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_gateway_dingtalk.client import Client as GatewayClientClient
from alibabacloud_tea_util.client import Client as UtilClient
from alibabacloud_dingtalk.algo_1_0 import models as dingtalkalgo__1__0_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_openapi_util.client import Client as OpenApiUtilClient
class Client(OpenApiClient):
"""
*\
"""
def __init__(
self,
config: open_api_models.Config,
):
super().__init__(config)
gateway_client = GatewayClientClient()
self._spi = gateway_client
self._endpoint_rule = ''
if UtilClient.empty(self._endpoint):
self._endpoint = 'api.dingtalk.com'
def nlp_word_distinguish_with_options(
self,
request: dingtalkalgo__1__0_models.NlpWordDistinguishRequest,
headers: dingtalkalgo__1__0_models.NlpWordDistinguishHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkalgo__1__0_models.NlpWordDistinguishResponse:
"""
@summary 自然语言处理之关键词识别
@param request: NlpWordDistinguishRequest
@param headers: NlpWordDistinguishHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: NlpWordDistinguishResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.attach_extract_decision_info):
body['attachExtractDecisionInfo'] = request.attach_extract_decision_info
if not UtilClient.is_unset(request.isv_app_id):
body['isvAppId'] = request.isv_app_id
if not UtilClient.is_unset(request.text):
body['text'] = request.text
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='NlpWordDistinguish',
version='algo_1.0',
protocol='HTTP',
pathname=f'/v1.0/algo/okrs/keywords/extract',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkalgo__1__0_models.NlpWordDistinguishResponse(),
self.execute(params, req, runtime)
)
async def nlp_word_distinguish_with_options_async(
self,
request: dingtalkalgo__1__0_models.NlpWordDistinguishRequest,
headers: dingtalkalgo__1__0_models.NlpWordDistinguishHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkalgo__1__0_models.NlpWordDistinguishResponse:
"""
@summary 自然语言处理之关键词识别
@param request: NlpWordDistinguishRequest
@param headers: NlpWordDistinguishHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: NlpWordDistinguishResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.attach_extract_decision_info):
body['attachExtractDecisionInfo'] = request.attach_extract_decision_info
if not UtilClient.is_unset(request.isv_app_id):
body['isvAppId'] = request.isv_app_id
if not UtilClient.is_unset(request.text):
body['text'] = request.text
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='NlpWordDistinguish',
version='algo_1.0',
protocol='HTTP',
pathname=f'/v1.0/algo/okrs/keywords/extract',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkalgo__1__0_models.NlpWordDistinguishResponse(),
await self.execute_async(params, req, runtime)
)
def nlp_word_distinguish(
self,
request: dingtalkalgo__1__0_models.NlpWordDistinguishRequest,
) -> dingtalkalgo__1__0_models.NlpWordDistinguishResponse:
"""
@summary 自然语言处理之关键词识别
@param request: NlpWordDistinguishRequest
@return: NlpWordDistinguishResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkalgo__1__0_models.NlpWordDistinguishHeaders()
return self.nlp_word_distinguish_with_options(request, headers, runtime)
async def nlp_word_distinguish_async(
self,
request: dingtalkalgo__1__0_models.NlpWordDistinguishRequest,
) -> dingtalkalgo__1__0_models.NlpWordDistinguishResponse:
"""
@summary 自然语言处理之关键词识别
@param request: NlpWordDistinguishRequest
@return: NlpWordDistinguishResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkalgo__1__0_models.NlpWordDistinguishHeaders()
return await self.nlp_word_distinguish_with_options_async(request, headers, runtime)
def okr_open_recommend_with_options(
self,
request: dingtalkalgo__1__0_models.OkrOpenRecommendRequest,
headers: dingtalkalgo__1__0_models.OkrOpenRecommendHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkalgo__1__0_models.OkrOpenRecommendResponse:
"""
@summary Okr内容推荐
@param request: OkrOpenRecommendRequest
@param headers: OkrOpenRecommendHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: OkrOpenRecommendResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.candidate_okr_items):
body['candidateOkrItems'] = request.candidate_okr_items
if not UtilClient.is_unset(request.corp_id):
body['corpId'] = request.corp_id
if not UtilClient.is_unset(request.dept_ids):
body['deptIds'] = request.dept_ids
if not UtilClient.is_unset(request.isv_app_id):
body['isvAppId'] = request.isv_app_id
if not UtilClient.is_unset(request.user_id):
body['userId'] = request.user_id
if not UtilClient.is_unset(request.words):
body['words'] = request.words
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='OkrOpenRecommend',
version='algo_1.0',
protocol='HTTP',
pathname=f'/v1.0/algo/okrs/recommend',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkalgo__1__0_models.OkrOpenRecommendResponse(),
self.execute(params, req, runtime)
)
async def okr_open_recommend_with_options_async(
self,
request: dingtalkalgo__1__0_models.OkrOpenRecommendRequest,
headers: dingtalkalgo__1__0_models.OkrOpenRecommendHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkalgo__1__0_models.OkrOpenRecommendResponse:
"""
@summary Okr内容推荐
@param request: OkrOpenRecommendRequest
@param headers: OkrOpenRecommendHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: OkrOpenRecommendResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.candidate_okr_items):
body['candidateOkrItems'] = request.candidate_okr_items
if not UtilClient.is_unset(request.corp_id):
body['corpId'] = request.corp_id
if not UtilClient.is_unset(request.dept_ids):
body['deptIds'] = request.dept_ids
if not UtilClient.is_unset(request.isv_app_id):
body['isvAppId'] = request.isv_app_id
if not UtilClient.is_unset(request.user_id):
body['userId'] = request.user_id
if not UtilClient.is_unset(request.words):
body['words'] = request.words
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='OkrOpenRecommend',
version='algo_1.0',
protocol='HTTP',
pathname=f'/v1.0/algo/okrs/recommend',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkalgo__1__0_models.OkrOpenRecommendResponse(),
await self.execute_async(params, req, runtime)
)
def okr_open_recommend(
self,
request: dingtalkalgo__1__0_models.OkrOpenRecommendRequest,
) -> dingtalkalgo__1__0_models.OkrOpenRecommendResponse:
"""
@summary Okr内容推荐
@param request: OkrOpenRecommendRequest
@return: OkrOpenRecommendResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkalgo__1__0_models.OkrOpenRecommendHeaders()
return self.okr_open_recommend_with_options(request, headers, runtime)
async def okr_open_recommend_async(
self,
request: dingtalkalgo__1__0_models.OkrOpenRecommendRequest,
) -> dingtalkalgo__1__0_models.OkrOpenRecommendResponse:
"""
@summary Okr内容推荐
@param request: OkrOpenRecommendRequest
@return: OkrOpenRecommendResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkalgo__1__0_models.OkrOpenRecommendHeaders()
return await self.okr_open_recommend_with_options_async(request, headers, runtime)

View File

@ -0,0 +1,729 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.model import TeaModel
from typing import Dict, List
class NlpWordDistinguishHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class NlpWordDistinguishRequestAttachExtractDecisionInfo(TeaModel):
def __init__(
self,
black_words: List[str] = None,
candidate_words: List[str] = None,
corp_id: str = None,
dept_ids: List[str] = None,
user_id: str = None,
):
self.black_words = black_words
self.candidate_words = candidate_words
# This parameter is required.
self.corp_id = corp_id
# This parameter is required.
self.dept_ids = dept_ids
# This parameter is required.
self.user_id = user_id
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.black_words is not None:
result['blackWords'] = self.black_words
if self.candidate_words is not None:
result['candidateWords'] = self.candidate_words
if self.corp_id is not None:
result['corpId'] = self.corp_id
if self.dept_ids is not None:
result['deptIds'] = self.dept_ids
if self.user_id is not None:
result['userId'] = self.user_id
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('blackWords') is not None:
self.black_words = m.get('blackWords')
if m.get('candidateWords') is not None:
self.candidate_words = m.get('candidateWords')
if m.get('corpId') is not None:
self.corp_id = m.get('corpId')
if m.get('deptIds') is not None:
self.dept_ids = m.get('deptIds')
if m.get('userId') is not None:
self.user_id = m.get('userId')
return self
class NlpWordDistinguishRequest(TeaModel):
def __init__(
self,
attach_extract_decision_info: NlpWordDistinguishRequestAttachExtractDecisionInfo = None,
isv_app_id: str = None,
text: str = None,
):
# This parameter is required.
self.attach_extract_decision_info = attach_extract_decision_info
# This parameter is required.
self.isv_app_id = isv_app_id
# This parameter is required.
self.text = text
def validate(self):
if self.attach_extract_decision_info:
self.attach_extract_decision_info.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.attach_extract_decision_info is not None:
result['attachExtractDecisionInfo'] = self.attach_extract_decision_info.to_map()
if self.isv_app_id is not None:
result['isvAppId'] = self.isv_app_id
if self.text is not None:
result['text'] = self.text
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('attachExtractDecisionInfo') is not None:
temp_model = NlpWordDistinguishRequestAttachExtractDecisionInfo()
self.attach_extract_decision_info = temp_model.from_map(m['attachExtractDecisionInfo'])
if m.get('isvAppId') is not None:
self.isv_app_id = m.get('isvAppId')
if m.get('text') is not None:
self.text = m.get('text')
return self
class NlpWordDistinguishResponseBodyWordEntities(TeaModel):
def __init__(
self,
word: str = None,
):
self.word = word
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.word is not None:
result['word'] = self.word
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('word') is not None:
self.word = m.get('word')
return self
class NlpWordDistinguishResponseBody(TeaModel):
def __init__(
self,
request_id: str = None,
word_entities: List[NlpWordDistinguishResponseBodyWordEntities] = None,
):
# This parameter is required.
self.request_id = request_id
self.word_entities = word_entities
def validate(self):
if self.word_entities:
for k in self.word_entities:
if k:
k.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.request_id is not None:
result['requestId'] = self.request_id
result['wordEntities'] = []
if self.word_entities is not None:
for k in self.word_entities:
result['wordEntities'].append(k.to_map() if k else None)
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('requestId') is not None:
self.request_id = m.get('requestId')
self.word_entities = []
if m.get('wordEntities') is not None:
for k in m.get('wordEntities'):
temp_model = NlpWordDistinguishResponseBodyWordEntities()
self.word_entities.append(temp_model.from_map(k))
return self
class NlpWordDistinguishResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: NlpWordDistinguishResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = NlpWordDistinguishResponseBody()
self.body = temp_model.from_map(m['body'])
return self
class OkrOpenRecommendHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class OkrOpenRecommendRequestCandidateOkrItemsOkrInfosKeyResultInfos(TeaModel):
def __init__(
self,
kr: str = None,
kr_id: str = None,
words: List[str] = None,
):
self.kr = kr
self.kr_id = kr_id
self.words = words
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.kr is not None:
result['kr'] = self.kr
if self.kr_id is not None:
result['krId'] = self.kr_id
if self.words is not None:
result['words'] = self.words
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('kr') is not None:
self.kr = m.get('kr')
if m.get('krId') is not None:
self.kr_id = m.get('krId')
if m.get('words') is not None:
self.words = m.get('words')
return self
class OkrOpenRecommendRequestCandidateOkrItemsOkrInfos(TeaModel):
def __init__(
self,
key_result_infos: List[OkrOpenRecommendRequestCandidateOkrItemsOkrInfosKeyResultInfos] = None,
objective: str = None,
objective_id: str = None,
words: List[str] = None,
):
self.key_result_infos = key_result_infos
self.objective = objective
self.objective_id = objective_id
self.words = words
def validate(self):
if self.key_result_infos:
for k in self.key_result_infos:
if k:
k.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
result['keyResultInfos'] = []
if self.key_result_infos is not None:
for k in self.key_result_infos:
result['keyResultInfos'].append(k.to_map() if k else None)
if self.objective is not None:
result['objective'] = self.objective
if self.objective_id is not None:
result['objectiveId'] = self.objective_id
if self.words is not None:
result['words'] = self.words
return result
def from_map(self, m: dict = None):
m = m or dict()
self.key_result_infos = []
if m.get('keyResultInfos') is not None:
for k in m.get('keyResultInfos'):
temp_model = OkrOpenRecommendRequestCandidateOkrItemsOkrInfosKeyResultInfos()
self.key_result_infos.append(temp_model.from_map(k))
if m.get('objective') is not None:
self.objective = m.get('objective')
if m.get('objectiveId') is not None:
self.objective_id = m.get('objectiveId')
if m.get('words') is not None:
self.words = m.get('words')
return self
class OkrOpenRecommendRequestCandidateOkrItems(TeaModel):
def __init__(
self,
okr_infos: List[OkrOpenRecommendRequestCandidateOkrItemsOkrInfos] = None,
relation: str = None,
user_id: str = None,
):
self.okr_infos = okr_infos
# This parameter is required.
self.relation = relation
# This parameter is required.
self.user_id = user_id
def validate(self):
if self.okr_infos:
for k in self.okr_infos:
if k:
k.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
result['okrInfos'] = []
if self.okr_infos is not None:
for k in self.okr_infos:
result['okrInfos'].append(k.to_map() if k else None)
if self.relation is not None:
result['relation'] = self.relation
if self.user_id is not None:
result['userId'] = self.user_id
return result
def from_map(self, m: dict = None):
m = m or dict()
self.okr_infos = []
if m.get('okrInfos') is not None:
for k in m.get('okrInfos'):
temp_model = OkrOpenRecommendRequestCandidateOkrItemsOkrInfos()
self.okr_infos.append(temp_model.from_map(k))
if m.get('relation') is not None:
self.relation = m.get('relation')
if m.get('userId') is not None:
self.user_id = m.get('userId')
return self
class OkrOpenRecommendRequest(TeaModel):
def __init__(
self,
candidate_okr_items: List[OkrOpenRecommendRequestCandidateOkrItems] = None,
corp_id: str = None,
dept_ids: List[str] = None,
isv_app_id: str = None,
user_id: str = None,
words: List[str] = None,
):
# This parameter is required.
self.candidate_okr_items = candidate_okr_items
# This parameter is required.
self.corp_id = corp_id
# This parameter is required.
self.dept_ids = dept_ids
# This parameter is required.
self.isv_app_id = isv_app_id
# This parameter is required.
self.user_id = user_id
self.words = words
def validate(self):
if self.candidate_okr_items:
for k in self.candidate_okr_items:
if k:
k.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
result['candidateOkrItems'] = []
if self.candidate_okr_items is not None:
for k in self.candidate_okr_items:
result['candidateOkrItems'].append(k.to_map() if k else None)
if self.corp_id is not None:
result['corpId'] = self.corp_id
if self.dept_ids is not None:
result['deptIds'] = self.dept_ids
if self.isv_app_id is not None:
result['isvAppId'] = self.isv_app_id
if self.user_id is not None:
result['userId'] = self.user_id
if self.words is not None:
result['words'] = self.words
return result
def from_map(self, m: dict = None):
m = m or dict()
self.candidate_okr_items = []
if m.get('candidateOkrItems') is not None:
for k in m.get('candidateOkrItems'):
temp_model = OkrOpenRecommendRequestCandidateOkrItems()
self.candidate_okr_items.append(temp_model.from_map(k))
if m.get('corpId') is not None:
self.corp_id = m.get('corpId')
if m.get('deptIds') is not None:
self.dept_ids = m.get('deptIds')
if m.get('isvAppId') is not None:
self.isv_app_id = m.get('isvAppId')
if m.get('userId') is not None:
self.user_id = m.get('userId')
if m.get('words') is not None:
self.words = m.get('words')
return self
class OkrOpenRecommendResponseBodyOkrRecommendItemsKrResultRelatedResults(TeaModel):
def __init__(
self,
kr_id: str = None,
semantic_level: int = None,
words: List[str] = None,
):
# This parameter is required.
self.kr_id = kr_id
# This parameter is required.
self.semantic_level = semantic_level
# This parameter is required.
self.words = words
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.kr_id is not None:
result['krId'] = self.kr_id
if self.semantic_level is not None:
result['semanticLevel'] = self.semantic_level
if self.words is not None:
result['words'] = self.words
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('krId') is not None:
self.kr_id = m.get('krId')
if m.get('semanticLevel') is not None:
self.semantic_level = m.get('semanticLevel')
if m.get('words') is not None:
self.words = m.get('words')
return self
class OkrOpenRecommendResponseBodyOkrRecommendItemsObjectiveRelatedResults(TeaModel):
def __init__(
self,
objective_id: str = None,
semantic_level: int = None,
words: List[str] = None,
):
# This parameter is required.
self.objective_id = objective_id
# This parameter is required.
self.semantic_level = semantic_level
# This parameter is required.
self.words = words
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.objective_id is not None:
result['objectiveId'] = self.objective_id
if self.semantic_level is not None:
result['semanticLevel'] = self.semantic_level
if self.words is not None:
result['words'] = self.words
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('objectiveId') is not None:
self.objective_id = m.get('objectiveId')
if m.get('semanticLevel') is not None:
self.semantic_level = m.get('semanticLevel')
if m.get('words') is not None:
self.words = m.get('words')
return self
class OkrOpenRecommendResponseBodyOkrRecommendItems(TeaModel):
def __init__(
self,
kr_result_related_results: List[OkrOpenRecommendResponseBodyOkrRecommendItemsKrResultRelatedResults] = None,
objective_related_results: List[OkrOpenRecommendResponseBodyOkrRecommendItemsObjectiveRelatedResults] = None,
related_level: int = None,
semantic_level: int = None,
user_id: str = None,
):
self.kr_result_related_results = kr_result_related_results
self.objective_related_results = objective_related_results
# This parameter is required.
self.related_level = related_level
# This parameter is required.
self.semantic_level = semantic_level
# This parameter is required.
self.user_id = user_id
def validate(self):
if self.kr_result_related_results:
for k in self.kr_result_related_results:
if k:
k.validate()
if self.objective_related_results:
for k in self.objective_related_results:
if k:
k.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
result['krResultRelatedResults'] = []
if self.kr_result_related_results is not None:
for k in self.kr_result_related_results:
result['krResultRelatedResults'].append(k.to_map() if k else None)
result['objectiveRelatedResults'] = []
if self.objective_related_results is not None:
for k in self.objective_related_results:
result['objectiveRelatedResults'].append(k.to_map() if k else None)
if self.related_level is not None:
result['relatedLevel'] = self.related_level
if self.semantic_level is not None:
result['semanticLevel'] = self.semantic_level
if self.user_id is not None:
result['userId'] = self.user_id
return result
def from_map(self, m: dict = None):
m = m or dict()
self.kr_result_related_results = []
if m.get('krResultRelatedResults') is not None:
for k in m.get('krResultRelatedResults'):
temp_model = OkrOpenRecommendResponseBodyOkrRecommendItemsKrResultRelatedResults()
self.kr_result_related_results.append(temp_model.from_map(k))
self.objective_related_results = []
if m.get('objectiveRelatedResults') is not None:
for k in m.get('objectiveRelatedResults'):
temp_model = OkrOpenRecommendResponseBodyOkrRecommendItemsObjectiveRelatedResults()
self.objective_related_results.append(temp_model.from_map(k))
if m.get('relatedLevel') is not None:
self.related_level = m.get('relatedLevel')
if m.get('semanticLevel') is not None:
self.semantic_level = m.get('semanticLevel')
if m.get('userId') is not None:
self.user_id = m.get('userId')
return self
class OkrOpenRecommendResponseBody(TeaModel):
def __init__(
self,
okr_recommend_items: List[OkrOpenRecommendResponseBodyOkrRecommendItems] = None,
request_id: str = None,
):
self.okr_recommend_items = okr_recommend_items
# This parameter is required.
self.request_id = request_id
def validate(self):
if self.okr_recommend_items:
for k in self.okr_recommend_items:
if k:
k.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
result['okrRecommendItems'] = []
if self.okr_recommend_items is not None:
for k in self.okr_recommend_items:
result['okrRecommendItems'].append(k.to_map() if k else None)
if self.request_id is not None:
result['requestId'] = self.request_id
return result
def from_map(self, m: dict = None):
m = m or dict()
self.okr_recommend_items = []
if m.get('okrRecommendItems') is not None:
for k in m.get('okrRecommendItems'):
temp_model = OkrOpenRecommendResponseBodyOkrRecommendItems()
self.okr_recommend_items.append(temp_model.from_map(k))
if m.get('requestId') is not None:
self.request_id = m.get('requestId')
return self
class OkrOpenRecommendResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: OkrOpenRecommendResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = OkrOpenRecommendResponseBody()
self.body = temp_model.from_map(m['body'])
return self

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

View File

@ -0,0 +1,483 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.core import TeaCore
from alibabacloud_tea_openapi.client import Client as OpenApiClient
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_gateway_dingtalk.client import Client as GatewayClientClient
from alibabacloud_tea_util.client import Client as UtilClient
from alibabacloud_dingtalk.amdp_1_0 import models as dingtalkamdp__1__0_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_openapi_util.client import Client as OpenApiUtilClient
class Client(OpenApiClient):
"""
*\
"""
def __init__(
self,
config: open_api_models.Config,
):
super().__init__(config)
gateway_client = GatewayClientClient()
self._spi = gateway_client
self._endpoint_rule = ''
if UtilClient.empty(self._endpoint):
self._endpoint = 'api.dingtalk.com'
def amdp_emp_role_data_push_with_options(
self,
request: dingtalkamdp__1__0_models.AmdpEmpRoleDataPushRequest,
headers: dingtalkamdp__1__0_models.AmdpEmpRoleDataPushHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkamdp__1__0_models.AmdpEmpRoleDataPushResponse:
"""
@summary 人员角色数据推送
@param request: AmdpEmpRoleDataPushRequest
@param headers: AmdpEmpRoleDataPushHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: AmdpEmpRoleDataPushResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.param):
body['param'] = request.param
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='AmdpEmpRoleDataPush',
version='amdp_1.0',
protocol='HTTP',
pathname=f'/v1.0/amdp/employeeRoles/datas/push',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkamdp__1__0_models.AmdpEmpRoleDataPushResponse(),
self.execute(params, req, runtime)
)
async def amdp_emp_role_data_push_with_options_async(
self,
request: dingtalkamdp__1__0_models.AmdpEmpRoleDataPushRequest,
headers: dingtalkamdp__1__0_models.AmdpEmpRoleDataPushHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkamdp__1__0_models.AmdpEmpRoleDataPushResponse:
"""
@summary 人员角色数据推送
@param request: AmdpEmpRoleDataPushRequest
@param headers: AmdpEmpRoleDataPushHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: AmdpEmpRoleDataPushResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.param):
body['param'] = request.param
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='AmdpEmpRoleDataPush',
version='amdp_1.0',
protocol='HTTP',
pathname=f'/v1.0/amdp/employeeRoles/datas/push',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkamdp__1__0_models.AmdpEmpRoleDataPushResponse(),
await self.execute_async(params, req, runtime)
)
def amdp_emp_role_data_push(
self,
request: dingtalkamdp__1__0_models.AmdpEmpRoleDataPushRequest,
) -> dingtalkamdp__1__0_models.AmdpEmpRoleDataPushResponse:
"""
@summary 人员角色数据推送
@param request: AmdpEmpRoleDataPushRequest
@return: AmdpEmpRoleDataPushResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkamdp__1__0_models.AmdpEmpRoleDataPushHeaders()
return self.amdp_emp_role_data_push_with_options(request, headers, runtime)
async def amdp_emp_role_data_push_async(
self,
request: dingtalkamdp__1__0_models.AmdpEmpRoleDataPushRequest,
) -> dingtalkamdp__1__0_models.AmdpEmpRoleDataPushResponse:
"""
@summary 人员角色数据推送
@param request: AmdpEmpRoleDataPushRequest
@return: AmdpEmpRoleDataPushResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkamdp__1__0_models.AmdpEmpRoleDataPushHeaders()
return await self.amdp_emp_role_data_push_with_options_async(request, headers, runtime)
def amdp_employee_data_push_with_options(
self,
request: dingtalkamdp__1__0_models.AmdpEmployeeDataPushRequest,
headers: dingtalkamdp__1__0_models.AmdpEmployeeDataPushHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkamdp__1__0_models.AmdpEmployeeDataPushResponse:
"""
@summary 人员数据推送
@param request: AmdpEmployeeDataPushRequest
@param headers: AmdpEmployeeDataPushHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: AmdpEmployeeDataPushResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.param):
body['param'] = request.param
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='AmdpEmployeeDataPush',
version='amdp_1.0',
protocol='HTTP',
pathname=f'/v1.0/amdp/employees/datas/push',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkamdp__1__0_models.AmdpEmployeeDataPushResponse(),
self.execute(params, req, runtime)
)
async def amdp_employee_data_push_with_options_async(
self,
request: dingtalkamdp__1__0_models.AmdpEmployeeDataPushRequest,
headers: dingtalkamdp__1__0_models.AmdpEmployeeDataPushHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkamdp__1__0_models.AmdpEmployeeDataPushResponse:
"""
@summary 人员数据推送
@param request: AmdpEmployeeDataPushRequest
@param headers: AmdpEmployeeDataPushHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: AmdpEmployeeDataPushResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.param):
body['param'] = request.param
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='AmdpEmployeeDataPush',
version='amdp_1.0',
protocol='HTTP',
pathname=f'/v1.0/amdp/employees/datas/push',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkamdp__1__0_models.AmdpEmployeeDataPushResponse(),
await self.execute_async(params, req, runtime)
)
def amdp_employee_data_push(
self,
request: dingtalkamdp__1__0_models.AmdpEmployeeDataPushRequest,
) -> dingtalkamdp__1__0_models.AmdpEmployeeDataPushResponse:
"""
@summary 人员数据推送
@param request: AmdpEmployeeDataPushRequest
@return: AmdpEmployeeDataPushResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkamdp__1__0_models.AmdpEmployeeDataPushHeaders()
return self.amdp_employee_data_push_with_options(request, headers, runtime)
async def amdp_employee_data_push_async(
self,
request: dingtalkamdp__1__0_models.AmdpEmployeeDataPushRequest,
) -> dingtalkamdp__1__0_models.AmdpEmployeeDataPushResponse:
"""
@summary 人员数据推送
@param request: AmdpEmployeeDataPushRequest
@return: AmdpEmployeeDataPushResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkamdp__1__0_models.AmdpEmployeeDataPushHeaders()
return await self.amdp_employee_data_push_with_options_async(request, headers, runtime)
def amdp_job_position_data_push_with_options(
self,
request: dingtalkamdp__1__0_models.AmdpJobPositionDataPushRequest,
headers: dingtalkamdp__1__0_models.AmdpJobPositionDataPushHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkamdp__1__0_models.AmdpJobPositionDataPushResponse:
"""
@summary 任职数据推送
@param request: AmdpJobPositionDataPushRequest
@param headers: AmdpJobPositionDataPushHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: AmdpJobPositionDataPushResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.param):
body['param'] = request.param
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='AmdpJobPositionDataPush',
version='amdp_1.0',
protocol='HTTP',
pathname=f'/v1.0/amdp/empJobs/datas/push',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkamdp__1__0_models.AmdpJobPositionDataPushResponse(),
self.execute(params, req, runtime)
)
async def amdp_job_position_data_push_with_options_async(
self,
request: dingtalkamdp__1__0_models.AmdpJobPositionDataPushRequest,
headers: dingtalkamdp__1__0_models.AmdpJobPositionDataPushHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkamdp__1__0_models.AmdpJobPositionDataPushResponse:
"""
@summary 任职数据推送
@param request: AmdpJobPositionDataPushRequest
@param headers: AmdpJobPositionDataPushHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: AmdpJobPositionDataPushResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.param):
body['param'] = request.param
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='AmdpJobPositionDataPush',
version='amdp_1.0',
protocol='HTTP',
pathname=f'/v1.0/amdp/empJobs/datas/push',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkamdp__1__0_models.AmdpJobPositionDataPushResponse(),
await self.execute_async(params, req, runtime)
)
def amdp_job_position_data_push(
self,
request: dingtalkamdp__1__0_models.AmdpJobPositionDataPushRequest,
) -> dingtalkamdp__1__0_models.AmdpJobPositionDataPushResponse:
"""
@summary 任职数据推送
@param request: AmdpJobPositionDataPushRequest
@return: AmdpJobPositionDataPushResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkamdp__1__0_models.AmdpJobPositionDataPushHeaders()
return self.amdp_job_position_data_push_with_options(request, headers, runtime)
async def amdp_job_position_data_push_async(
self,
request: dingtalkamdp__1__0_models.AmdpJobPositionDataPushRequest,
) -> dingtalkamdp__1__0_models.AmdpJobPositionDataPushResponse:
"""
@summary 任职数据推送
@param request: AmdpJobPositionDataPushRequest
@return: AmdpJobPositionDataPushResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkamdp__1__0_models.AmdpJobPositionDataPushHeaders()
return await self.amdp_job_position_data_push_with_options_async(request, headers, runtime)
def amdp_organization_data_push_with_options(
self,
request: dingtalkamdp__1__0_models.AmdpOrganizationDataPushRequest,
headers: dingtalkamdp__1__0_models.AmdpOrganizationDataPushHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkamdp__1__0_models.AmdpOrganizationDataPushResponse:
"""
@summary 组织部门数据推送
@param request: AmdpOrganizationDataPushRequest
@param headers: AmdpOrganizationDataPushHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: AmdpOrganizationDataPushResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.param):
body['param'] = request.param
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='AmdpOrganizationDataPush',
version='amdp_1.0',
protocol='HTTP',
pathname=f'/v1.0/amdp/organizations/departments/datas/push',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkamdp__1__0_models.AmdpOrganizationDataPushResponse(),
self.execute(params, req, runtime)
)
async def amdp_organization_data_push_with_options_async(
self,
request: dingtalkamdp__1__0_models.AmdpOrganizationDataPushRequest,
headers: dingtalkamdp__1__0_models.AmdpOrganizationDataPushHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkamdp__1__0_models.AmdpOrganizationDataPushResponse:
"""
@summary 组织部门数据推送
@param request: AmdpOrganizationDataPushRequest
@param headers: AmdpOrganizationDataPushHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: AmdpOrganizationDataPushResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.param):
body['param'] = request.param
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='AmdpOrganizationDataPush',
version='amdp_1.0',
protocol='HTTP',
pathname=f'/v1.0/amdp/organizations/departments/datas/push',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkamdp__1__0_models.AmdpOrganizationDataPushResponse(),
await self.execute_async(params, req, runtime)
)
def amdp_organization_data_push(
self,
request: dingtalkamdp__1__0_models.AmdpOrganizationDataPushRequest,
) -> dingtalkamdp__1__0_models.AmdpOrganizationDataPushResponse:
"""
@summary 组织部门数据推送
@param request: AmdpOrganizationDataPushRequest
@return: AmdpOrganizationDataPushResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkamdp__1__0_models.AmdpOrganizationDataPushHeaders()
return self.amdp_organization_data_push_with_options(request, headers, runtime)
async def amdp_organization_data_push_async(
self,
request: dingtalkamdp__1__0_models.AmdpOrganizationDataPushRequest,
) -> dingtalkamdp__1__0_models.AmdpOrganizationDataPushResponse:
"""
@summary 组织部门数据推送
@param request: AmdpOrganizationDataPushRequest
@return: AmdpOrganizationDataPushResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkamdp__1__0_models.AmdpOrganizationDataPushHeaders()
return await self.amdp_organization_data_push_with_options_async(request, headers, runtime)

View File

@ -0,0 +1,844 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.model import TeaModel
from typing import Dict, List
class AmdpEmpRoleDataPushHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class AmdpEmpRoleDataPushRequestParam(TeaModel):
def __init__(
self,
dept_id: str = None,
is_delete: str = None,
role_code: str = None,
user_id: str = None,
):
self.dept_id = dept_id
self.is_delete = is_delete
self.role_code = role_code
self.user_id = user_id
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.dept_id is not None:
result['deptId'] = self.dept_id
if self.is_delete is not None:
result['isDelete'] = self.is_delete
if self.role_code is not None:
result['roleCode'] = self.role_code
if self.user_id is not None:
result['userId'] = self.user_id
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('deptId') is not None:
self.dept_id = m.get('deptId')
if m.get('isDelete') is not None:
self.is_delete = m.get('isDelete')
if m.get('roleCode') is not None:
self.role_code = m.get('roleCode')
if m.get('userId') is not None:
self.user_id = m.get('userId')
return self
class AmdpEmpRoleDataPushRequest(TeaModel):
def __init__(
self,
param: List[AmdpEmpRoleDataPushRequestParam] = None,
):
self.param = param
def validate(self):
if self.param:
for k in self.param:
if k:
k.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
result['param'] = []
if self.param is not None:
for k in self.param:
result['param'].append(k.to_map() if k else None)
return result
def from_map(self, m: dict = None):
m = m or dict()
self.param = []
if m.get('param') is not None:
for k in m.get('param'):
temp_model = AmdpEmpRoleDataPushRequestParam()
self.param.append(temp_model.from_map(k))
return self
class AmdpEmpRoleDataPushResponseBody(TeaModel):
def __init__(
self,
request_id: str = None,
result: bool = None,
status: str = None,
success: bool = None,
):
self.request_id = request_id
self.result = result
self.status = status
self.success = success
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.request_id is not None:
result['requestId'] = self.request_id
if self.result is not None:
result['result'] = self.result
if self.status is not None:
result['status'] = self.status
if self.success is not None:
result['success'] = self.success
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('requestId') is not None:
self.request_id = m.get('requestId')
if m.get('result') is not None:
self.result = m.get('result')
if m.get('status') is not None:
self.status = m.get('status')
if m.get('success') is not None:
self.success = m.get('success')
return self
class AmdpEmpRoleDataPushResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: AmdpEmpRoleDataPushResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = AmdpEmpRoleDataPushResponseBody()
self.body = temp_model.from_map(m['body'])
return self
class AmdpEmployeeDataPushHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class AmdpEmployeeDataPushRequestParam(TeaModel):
def __init__(
self,
avatar: str = None,
is_delete: str = None,
name: str = None,
union_id: str = None,
user_id: str = None,
work_no: str = None,
):
self.avatar = avatar
self.is_delete = is_delete
self.name = name
self.union_id = union_id
self.user_id = user_id
self.work_no = work_no
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.avatar is not None:
result['avatar'] = self.avatar
if self.is_delete is not None:
result['isDelete'] = self.is_delete
if self.name is not None:
result['name'] = self.name
if self.union_id is not None:
result['unionId'] = self.union_id
if self.user_id is not None:
result['userId'] = self.user_id
if self.work_no is not None:
result['workNo'] = self.work_no
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('avatar') is not None:
self.avatar = m.get('avatar')
if m.get('isDelete') is not None:
self.is_delete = m.get('isDelete')
if m.get('name') is not None:
self.name = m.get('name')
if m.get('unionId') is not None:
self.union_id = m.get('unionId')
if m.get('userId') is not None:
self.user_id = m.get('userId')
if m.get('workNo') is not None:
self.work_no = m.get('workNo')
return self
class AmdpEmployeeDataPushRequest(TeaModel):
def __init__(
self,
param: List[AmdpEmployeeDataPushRequestParam] = None,
):
self.param = param
def validate(self):
if self.param:
for k in self.param:
if k:
k.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
result['param'] = []
if self.param is not None:
for k in self.param:
result['param'].append(k.to_map() if k else None)
return result
def from_map(self, m: dict = None):
m = m or dict()
self.param = []
if m.get('param') is not None:
for k in m.get('param'):
temp_model = AmdpEmployeeDataPushRequestParam()
self.param.append(temp_model.from_map(k))
return self
class AmdpEmployeeDataPushResponseBody(TeaModel):
def __init__(
self,
request_id: str = None,
result: bool = None,
status: str = None,
success: bool = None,
):
self.request_id = request_id
self.result = result
self.status = status
self.success = success
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.request_id is not None:
result['requestId'] = self.request_id
if self.result is not None:
result['result'] = self.result
if self.status is not None:
result['status'] = self.status
if self.success is not None:
result['success'] = self.success
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('requestId') is not None:
self.request_id = m.get('requestId')
if m.get('result') is not None:
self.result = m.get('result')
if m.get('status') is not None:
self.status = m.get('status')
if m.get('success') is not None:
self.success = m.get('success')
return self
class AmdpEmployeeDataPushResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: AmdpEmployeeDataPushResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = AmdpEmployeeDataPushResponseBody()
self.body = temp_model.from_map(m['body'])
return self
class AmdpJobPositionDataPushHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class AmdpJobPositionDataPushRequestParam(TeaModel):
def __init__(
self,
dept_id: str = None,
dept_leader: str = None,
is_delete: str = None,
leader_dept_id: str = None,
order_number: str = None,
user_id: str = None,
):
self.dept_id = dept_id
self.dept_leader = dept_leader
self.is_delete = is_delete
self.leader_dept_id = leader_dept_id
self.order_number = order_number
self.user_id = user_id
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.dept_id is not None:
result['deptId'] = self.dept_id
if self.dept_leader is not None:
result['deptLeader'] = self.dept_leader
if self.is_delete is not None:
result['isDelete'] = self.is_delete
if self.leader_dept_id is not None:
result['leaderDeptId'] = self.leader_dept_id
if self.order_number is not None:
result['orderNumber'] = self.order_number
if self.user_id is not None:
result['userId'] = self.user_id
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('deptId') is not None:
self.dept_id = m.get('deptId')
if m.get('deptLeader') is not None:
self.dept_leader = m.get('deptLeader')
if m.get('isDelete') is not None:
self.is_delete = m.get('isDelete')
if m.get('leaderDeptId') is not None:
self.leader_dept_id = m.get('leaderDeptId')
if m.get('orderNumber') is not None:
self.order_number = m.get('orderNumber')
if m.get('userId') is not None:
self.user_id = m.get('userId')
return self
class AmdpJobPositionDataPushRequest(TeaModel):
def __init__(
self,
param: List[AmdpJobPositionDataPushRequestParam] = None,
):
self.param = param
def validate(self):
if self.param:
for k in self.param:
if k:
k.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
result['param'] = []
if self.param is not None:
for k in self.param:
result['param'].append(k.to_map() if k else None)
return result
def from_map(self, m: dict = None):
m = m or dict()
self.param = []
if m.get('param') is not None:
for k in m.get('param'):
temp_model = AmdpJobPositionDataPushRequestParam()
self.param.append(temp_model.from_map(k))
return self
class AmdpJobPositionDataPushResponseBody(TeaModel):
def __init__(
self,
request_id: str = None,
result: bool = None,
status: str = None,
success: bool = None,
):
self.request_id = request_id
self.result = result
self.status = status
self.success = success
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.request_id is not None:
result['requestId'] = self.request_id
if self.result is not None:
result['result'] = self.result
if self.status is not None:
result['status'] = self.status
if self.success is not None:
result['success'] = self.success
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('requestId') is not None:
self.request_id = m.get('requestId')
if m.get('result') is not None:
self.result = m.get('result')
if m.get('status') is not None:
self.status = m.get('status')
if m.get('success') is not None:
self.success = m.get('success')
return self
class AmdpJobPositionDataPushResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: AmdpJobPositionDataPushResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = AmdpJobPositionDataPushResponseBody()
self.body = temp_model.from_map(m['body'])
return self
class AmdpOrganizationDataPushHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class AmdpOrganizationDataPushRequestParam(TeaModel):
def __init__(
self,
dept_id: str = None,
dept_manager_id_list: List[str] = None,
ding_talk_dept_id: str = None,
ding_talk_parent_id: str = None,
is_delete: str = None,
name: str = None,
parent_id: str = None,
):
self.dept_id = dept_id
self.dept_manager_id_list = dept_manager_id_list
self.ding_talk_dept_id = ding_talk_dept_id
self.ding_talk_parent_id = ding_talk_parent_id
self.is_delete = is_delete
self.name = name
self.parent_id = parent_id
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.dept_id is not None:
result['deptId'] = self.dept_id
if self.dept_manager_id_list is not None:
result['deptManagerIdList'] = self.dept_manager_id_list
if self.ding_talk_dept_id is not None:
result['dingTalkDeptId'] = self.ding_talk_dept_id
if self.ding_talk_parent_id is not None:
result['dingTalkParentId'] = self.ding_talk_parent_id
if self.is_delete is not None:
result['isDelete'] = self.is_delete
if self.name is not None:
result['name'] = self.name
if self.parent_id is not None:
result['parentId'] = self.parent_id
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('deptId') is not None:
self.dept_id = m.get('deptId')
if m.get('deptManagerIdList') is not None:
self.dept_manager_id_list = m.get('deptManagerIdList')
if m.get('dingTalkDeptId') is not None:
self.ding_talk_dept_id = m.get('dingTalkDeptId')
if m.get('dingTalkParentId') is not None:
self.ding_talk_parent_id = m.get('dingTalkParentId')
if m.get('isDelete') is not None:
self.is_delete = m.get('isDelete')
if m.get('name') is not None:
self.name = m.get('name')
if m.get('parentId') is not None:
self.parent_id = m.get('parentId')
return self
class AmdpOrganizationDataPushRequest(TeaModel):
def __init__(
self,
param: List[AmdpOrganizationDataPushRequestParam] = None,
):
self.param = param
def validate(self):
if self.param:
for k in self.param:
if k:
k.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
result['param'] = []
if self.param is not None:
for k in self.param:
result['param'].append(k.to_map() if k else None)
return result
def from_map(self, m: dict = None):
m = m or dict()
self.param = []
if m.get('param') is not None:
for k in m.get('param'):
temp_model = AmdpOrganizationDataPushRequestParam()
self.param.append(temp_model.from_map(k))
return self
class AmdpOrganizationDataPushResponseBody(TeaModel):
def __init__(
self,
request_id: str = None,
result: bool = None,
status: str = None,
success: bool = None,
):
self.request_id = request_id
self.result = result
self.status = status
self.success = success
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.request_id is not None:
result['requestId'] = self.request_id
if self.result is not None:
result['result'] = self.result
if self.status is not None:
result['status'] = self.status
if self.success is not None:
result['success'] = self.success
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('requestId') is not None:
self.request_id = m.get('requestId')
if m.get('result') is not None:
self.result = m.get('result')
if m.get('status') is not None:
self.status = m.get('status')
if m.get('success') is not None:
self.success = m.get('success')
return self
class AmdpOrganizationDataPushResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: AmdpOrganizationDataPushResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = AmdpOrganizationDataPushResponseBody()
self.body = temp_model.from_map(m['body'])
return self

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

View File

@ -0,0 +1,759 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.core import TeaCore
from alibabacloud_tea_openapi.client import Client as OpenApiClient
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_gateway_dingtalk.client import Client as GatewayClientClient
from alibabacloud_tea_util.client import Client as UtilClient
from alibabacloud_dingtalk.apaas_1_0 import models as dingtalkapaas__1__0_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_openapi_util.client import Client as OpenApiUtilClient
class Client(OpenApiClient):
"""
*\
"""
def __init__(
self,
config: open_api_models.Config,
):
super().__init__(config)
gateway_client = GatewayClientClient()
self._spi = gateway_client
self._endpoint_rule = ''
if UtilClient.empty(self._endpoint):
self._endpoint = 'api.dingtalk.com'
def batch_create_template_with_options(
self,
request: dingtalkapaas__1__0_models.BatchCreateTemplateRequest,
headers: dingtalkapaas__1__0_models.BatchCreateTemplateHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.BatchCreateTemplateResponse:
"""
@summary 批量创建模板
@param request: BatchCreateTemplateRequest
@param headers: BatchCreateTemplateHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: BatchCreateTemplateResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.template_list):
body['templateList'] = request.template_list
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='BatchCreateTemplate',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.BatchCreateTemplateResponse(),
self.execute(params, req, runtime)
)
async def batch_create_template_with_options_async(
self,
request: dingtalkapaas__1__0_models.BatchCreateTemplateRequest,
headers: dingtalkapaas__1__0_models.BatchCreateTemplateHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.BatchCreateTemplateResponse:
"""
@summary 批量创建模板
@param request: BatchCreateTemplateRequest
@param headers: BatchCreateTemplateHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: BatchCreateTemplateResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.template_list):
body['templateList'] = request.template_list
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='BatchCreateTemplate',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.BatchCreateTemplateResponse(),
await self.execute_async(params, req, runtime)
)
def batch_create_template(
self,
request: dingtalkapaas__1__0_models.BatchCreateTemplateRequest,
) -> dingtalkapaas__1__0_models.BatchCreateTemplateResponse:
"""
@summary 批量创建模板
@param request: BatchCreateTemplateRequest
@return: BatchCreateTemplateResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.BatchCreateTemplateHeaders()
return self.batch_create_template_with_options(request, headers, runtime)
async def batch_create_template_async(
self,
request: dingtalkapaas__1__0_models.BatchCreateTemplateRequest,
) -> dingtalkapaas__1__0_models.BatchCreateTemplateResponse:
"""
@summary 批量创建模板
@param request: BatchCreateTemplateRequest
@return: BatchCreateTemplateResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.BatchCreateTemplateHeaders()
return await self.batch_create_template_with_options_async(request, headers, runtime)
def batch_query_by_template_key_with_options(
self,
request: dingtalkapaas__1__0_models.BatchQueryByTemplateKeyRequest,
headers: dingtalkapaas__1__0_models.BatchQueryByTemplateKeyHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.BatchQueryByTemplateKeyResponse:
"""
@summary 批量查询模板
@param request: BatchQueryByTemplateKeyRequest
@param headers: BatchQueryByTemplateKeyHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: BatchQueryByTemplateKeyResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.template_keys):
body['templateKeys'] = request.template_keys
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='BatchQueryByTemplateKey',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates/query',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.BatchQueryByTemplateKeyResponse(),
self.execute(params, req, runtime)
)
async def batch_query_by_template_key_with_options_async(
self,
request: dingtalkapaas__1__0_models.BatchQueryByTemplateKeyRequest,
headers: dingtalkapaas__1__0_models.BatchQueryByTemplateKeyHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.BatchQueryByTemplateKeyResponse:
"""
@summary 批量查询模板
@param request: BatchQueryByTemplateKeyRequest
@param headers: BatchQueryByTemplateKeyHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: BatchQueryByTemplateKeyResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.template_keys):
body['templateKeys'] = request.template_keys
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='BatchQueryByTemplateKey',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates/query',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.BatchQueryByTemplateKeyResponse(),
await self.execute_async(params, req, runtime)
)
def batch_query_by_template_key(
self,
request: dingtalkapaas__1__0_models.BatchQueryByTemplateKeyRequest,
) -> dingtalkapaas__1__0_models.BatchQueryByTemplateKeyResponse:
"""
@summary 批量查询模板
@param request: BatchQueryByTemplateKeyRequest
@return: BatchQueryByTemplateKeyResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.BatchQueryByTemplateKeyHeaders()
return self.batch_query_by_template_key_with_options(request, headers, runtime)
async def batch_query_by_template_key_async(
self,
request: dingtalkapaas__1__0_models.BatchQueryByTemplateKeyRequest,
) -> dingtalkapaas__1__0_models.BatchQueryByTemplateKeyResponse:
"""
@summary 批量查询模板
@param request: BatchQueryByTemplateKeyRequest
@return: BatchQueryByTemplateKeyResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.BatchQueryByTemplateKeyHeaders()
return await self.batch_query_by_template_key_with_options_async(request, headers, runtime)
def batch_update_template_with_options(
self,
request: dingtalkapaas__1__0_models.BatchUpdateTemplateRequest,
headers: dingtalkapaas__1__0_models.BatchUpdateTemplateHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.BatchUpdateTemplateResponse:
"""
@summary 批量修改模板
@param request: BatchUpdateTemplateRequest
@param headers: BatchUpdateTemplateHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: BatchUpdateTemplateResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.template_list):
body['templateList'] = request.template_list
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='BatchUpdateTemplate',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates',
method='PUT',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.BatchUpdateTemplateResponse(),
self.execute(params, req, runtime)
)
async def batch_update_template_with_options_async(
self,
request: dingtalkapaas__1__0_models.BatchUpdateTemplateRequest,
headers: dingtalkapaas__1__0_models.BatchUpdateTemplateHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.BatchUpdateTemplateResponse:
"""
@summary 批量修改模板
@param request: BatchUpdateTemplateRequest
@param headers: BatchUpdateTemplateHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: BatchUpdateTemplateResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.template_list):
body['templateList'] = request.template_list
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='BatchUpdateTemplate',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates',
method='PUT',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.BatchUpdateTemplateResponse(),
await self.execute_async(params, req, runtime)
)
def batch_update_template(
self,
request: dingtalkapaas__1__0_models.BatchUpdateTemplateRequest,
) -> dingtalkapaas__1__0_models.BatchUpdateTemplateResponse:
"""
@summary 批量修改模板
@param request: BatchUpdateTemplateRequest
@return: BatchUpdateTemplateResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.BatchUpdateTemplateHeaders()
return self.batch_update_template_with_options(request, headers, runtime)
async def batch_update_template_async(
self,
request: dingtalkapaas__1__0_models.BatchUpdateTemplateRequest,
) -> dingtalkapaas__1__0_models.BatchUpdateTemplateResponse:
"""
@summary 批量修改模板
@param request: BatchUpdateTemplateRequest
@return: BatchUpdateTemplateResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.BatchUpdateTemplateHeaders()
return await self.batch_update_template_with_options_async(request, headers, runtime)
def query_industry_tag_list_with_options(
self,
headers: dingtalkapaas__1__0_models.QueryIndustryTagListHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.QueryIndustryTagListResponse:
"""
@summary 查询行业标签
@param headers: QueryIndustryTagListHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryIndustryTagListResponse
"""
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers
)
params = open_api_models.Params(
action='QueryIndustryTagList',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates/industries',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.QueryIndustryTagListResponse(),
self.execute(params, req, runtime)
)
async def query_industry_tag_list_with_options_async(
self,
headers: dingtalkapaas__1__0_models.QueryIndustryTagListHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.QueryIndustryTagListResponse:
"""
@summary 查询行业标签
@param headers: QueryIndustryTagListHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryIndustryTagListResponse
"""
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers
)
params = open_api_models.Params(
action='QueryIndustryTagList',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates/industries',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.QueryIndustryTagListResponse(),
await self.execute_async(params, req, runtime)
)
def query_industry_tag_list(self) -> dingtalkapaas__1__0_models.QueryIndustryTagListResponse:
"""
@summary 查询行业标签
@return: QueryIndustryTagListResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.QueryIndustryTagListHeaders()
return self.query_industry_tag_list_with_options(headers, runtime)
async def query_industry_tag_list_async(self) -> dingtalkapaas__1__0_models.QueryIndustryTagListResponse:
"""
@summary 查询行业标签
@return: QueryIndustryTagListResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.QueryIndustryTagListHeaders()
return await self.query_industry_tag_list_with_options_async(headers, runtime)
def query_role_tag_list_with_options(
self,
headers: dingtalkapaas__1__0_models.QueryRoleTagListHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.QueryRoleTagListResponse:
"""
@summary 查询角色
@param headers: QueryRoleTagListHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryRoleTagListResponse
"""
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers
)
params = open_api_models.Params(
action='QueryRoleTagList',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates/roles',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.QueryRoleTagListResponse(),
self.execute(params, req, runtime)
)
async def query_role_tag_list_with_options_async(
self,
headers: dingtalkapaas__1__0_models.QueryRoleTagListHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.QueryRoleTagListResponse:
"""
@summary 查询角色
@param headers: QueryRoleTagListHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryRoleTagListResponse
"""
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers
)
params = open_api_models.Params(
action='QueryRoleTagList',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates/roles',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.QueryRoleTagListResponse(),
await self.execute_async(params, req, runtime)
)
def query_role_tag_list(self) -> dingtalkapaas__1__0_models.QueryRoleTagListResponse:
"""
@summary 查询角色
@return: QueryRoleTagListResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.QueryRoleTagListHeaders()
return self.query_role_tag_list_with_options(headers, runtime)
async def query_role_tag_list_async(self) -> dingtalkapaas__1__0_models.QueryRoleTagListResponse:
"""
@summary 查询角色
@return: QueryRoleTagListResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.QueryRoleTagListHeaders()
return await self.query_role_tag_list_with_options_async(headers, runtime)
def query_template_categorys_with_options(
self,
headers: dingtalkapaas__1__0_models.QueryTemplateCategorysHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.QueryTemplateCategorysResponse:
"""
@summary 查询模板分类
@param headers: QueryTemplateCategorysHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryTemplateCategorysResponse
"""
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers
)
params = open_api_models.Params(
action='QueryTemplateCategorys',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates/categories',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.QueryTemplateCategorysResponse(),
self.execute(params, req, runtime)
)
async def query_template_categorys_with_options_async(
self,
headers: dingtalkapaas__1__0_models.QueryTemplateCategorysHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.QueryTemplateCategorysResponse:
"""
@summary 查询模板分类
@param headers: QueryTemplateCategorysHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryTemplateCategorysResponse
"""
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers
)
params = open_api_models.Params(
action='QueryTemplateCategorys',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates/categories',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.QueryTemplateCategorysResponse(),
await self.execute_async(params, req, runtime)
)
def query_template_categorys(self) -> dingtalkapaas__1__0_models.QueryTemplateCategorysResponse:
"""
@summary 查询模板分类
@return: QueryTemplateCategorysResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.QueryTemplateCategorysHeaders()
return self.query_template_categorys_with_options(headers, runtime)
async def query_template_categorys_async(self) -> dingtalkapaas__1__0_models.QueryTemplateCategorysResponse:
"""
@summary 查询模板分类
@return: QueryTemplateCategorysResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.QueryTemplateCategorysHeaders()
return await self.query_template_categorys_with_options_async(headers, runtime)
def recall_audit_template_with_options(
self,
request: dingtalkapaas__1__0_models.RecallAuditTemplateRequest,
headers: dingtalkapaas__1__0_models.RecallAuditTemplateHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.RecallAuditTemplateResponse:
"""
@summary 撤回模板审核
@param request: RecallAuditTemplateRequest
@param headers: RecallAuditTemplateHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: RecallAuditTemplateResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.template_keys):
body['templateKeys'] = request.template_keys
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='RecallAuditTemplate',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates/audits/recall',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.RecallAuditTemplateResponse(),
self.execute(params, req, runtime)
)
async def recall_audit_template_with_options_async(
self,
request: dingtalkapaas__1__0_models.RecallAuditTemplateRequest,
headers: dingtalkapaas__1__0_models.RecallAuditTemplateHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapaas__1__0_models.RecallAuditTemplateResponse:
"""
@summary 撤回模板审核
@param request: RecallAuditTemplateRequest
@param headers: RecallAuditTemplateHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: RecallAuditTemplateResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.template_keys):
body['templateKeys'] = request.template_keys
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='RecallAuditTemplate',
version='apaas_1.0',
protocol='HTTP',
pathname=f'/v1.0/apaas/templates/audits/recall',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapaas__1__0_models.RecallAuditTemplateResponse(),
await self.execute_async(params, req, runtime)
)
def recall_audit_template(
self,
request: dingtalkapaas__1__0_models.RecallAuditTemplateRequest,
) -> dingtalkapaas__1__0_models.RecallAuditTemplateResponse:
"""
@summary 撤回模板审核
@param request: RecallAuditTemplateRequest
@return: RecallAuditTemplateResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.RecallAuditTemplateHeaders()
return self.recall_audit_template_with_options(request, headers, runtime)
async def recall_audit_template_async(
self,
request: dingtalkapaas__1__0_models.RecallAuditTemplateRequest,
) -> dingtalkapaas__1__0_models.RecallAuditTemplateResponse:
"""
@summary 撤回模板审核
@param request: RecallAuditTemplateRequest
@return: RecallAuditTemplateResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapaas__1__0_models.RecallAuditTemplateHeaders()
return await self.recall_audit_template_with_options_async(request, headers, runtime)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

View File

@ -0,0 +1,859 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.core import TeaCore
from alibabacloud_tea_openapi.client import Client as OpenApiClient
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_gateway_dingtalk.client import Client as GatewayClientClient
from alibabacloud_tea_util.client import Client as UtilClient
from alibabacloud_dingtalk.app_market_1_0 import models as dingtalkapp_market__1__0_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_openapi_util.client import Client as OpenApiUtilClient
class Client(OpenApiClient):
"""
*\
"""
def __init__(
self,
config: open_api_models.Config,
):
super().__init__(config)
gateway_client = GatewayClientClient()
self._spi = gateway_client
self._endpoint_rule = ''
if UtilClient.empty(self._endpoint):
self._endpoint = 'api.dingtalk.com'
def create_app_goods_service_conversation_with_options(
self,
request: dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationRequest,
headers: dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationResponse:
"""
@summary 创建应用商品服务群
@param request: CreateAppGoodsServiceConversationRequest
@param headers: CreateAppGoodsServiceConversationHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: CreateAppGoodsServiceConversationResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.isv_user_id):
body['isvUserId'] = request.isv_user_id
if not UtilClient.is_unset(request.order_id):
body['orderId'] = request.order_id
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='CreateAppGoodsServiceConversation',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/orders/serviceGroups',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='json',
body_type='json'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationResponse(),
self.execute(params, req, runtime)
)
async def create_app_goods_service_conversation_with_options_async(
self,
request: dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationRequest,
headers: dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationResponse:
"""
@summary 创建应用商品服务群
@param request: CreateAppGoodsServiceConversationRequest
@param headers: CreateAppGoodsServiceConversationHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: CreateAppGoodsServiceConversationResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.isv_user_id):
body['isvUserId'] = request.isv_user_id
if not UtilClient.is_unset(request.order_id):
body['orderId'] = request.order_id
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='CreateAppGoodsServiceConversation',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/orders/serviceGroups',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='json',
body_type='json'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationResponse(),
await self.execute_async(params, req, runtime)
)
def create_app_goods_service_conversation(
self,
request: dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationRequest,
) -> dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationResponse:
"""
@summary 创建应用商品服务群
@param request: CreateAppGoodsServiceConversationRequest
@return: CreateAppGoodsServiceConversationResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationHeaders()
return self.create_app_goods_service_conversation_with_options(request, headers, runtime)
async def create_app_goods_service_conversation_async(
self,
request: dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationRequest,
) -> dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationResponse:
"""
@summary 创建应用商品服务群
@param request: CreateAppGoodsServiceConversationRequest
@return: CreateAppGoodsServiceConversationResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.CreateAppGoodsServiceConversationHeaders()
return await self.create_app_goods_service_conversation_with_options_async(request, headers, runtime)
def get_cool_app_access_status_with_options(
self,
request: dingtalkapp_market__1__0_models.GetCoolAppAccessStatusRequest,
headers: dingtalkapp_market__1__0_models.GetCoolAppAccessStatusHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.GetCoolAppAccessStatusResponse:
"""
@summary 获取酷应用访问状态
@param request: GetCoolAppAccessStatusRequest
@param headers: GetCoolAppAccessStatusHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: GetCoolAppAccessStatusResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.auth_code):
body['authCode'] = request.auth_code
if not UtilClient.is_unset(request.cool_app_code):
body['coolAppCode'] = request.cool_app_code
if not UtilClient.is_unset(request.enc_field_biz_code):
body['encFieldBizCode'] = request.enc_field_biz_code
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='GetCoolAppAccessStatus',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/coolApps/accessions/statuses/query',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.GetCoolAppAccessStatusResponse(),
self.execute(params, req, runtime)
)
async def get_cool_app_access_status_with_options_async(
self,
request: dingtalkapp_market__1__0_models.GetCoolAppAccessStatusRequest,
headers: dingtalkapp_market__1__0_models.GetCoolAppAccessStatusHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.GetCoolAppAccessStatusResponse:
"""
@summary 获取酷应用访问状态
@param request: GetCoolAppAccessStatusRequest
@param headers: GetCoolAppAccessStatusHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: GetCoolAppAccessStatusResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.auth_code):
body['authCode'] = request.auth_code
if not UtilClient.is_unset(request.cool_app_code):
body['coolAppCode'] = request.cool_app_code
if not UtilClient.is_unset(request.enc_field_biz_code):
body['encFieldBizCode'] = request.enc_field_biz_code
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='GetCoolAppAccessStatus',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/coolApps/accessions/statuses/query',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.GetCoolAppAccessStatusResponse(),
await self.execute_async(params, req, runtime)
)
def get_cool_app_access_status(
self,
request: dingtalkapp_market__1__0_models.GetCoolAppAccessStatusRequest,
) -> dingtalkapp_market__1__0_models.GetCoolAppAccessStatusResponse:
"""
@summary 获取酷应用访问状态
@param request: GetCoolAppAccessStatusRequest
@return: GetCoolAppAccessStatusResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.GetCoolAppAccessStatusHeaders()
return self.get_cool_app_access_status_with_options(request, headers, runtime)
async def get_cool_app_access_status_async(
self,
request: dingtalkapp_market__1__0_models.GetCoolAppAccessStatusRequest,
) -> dingtalkapp_market__1__0_models.GetCoolAppAccessStatusResponse:
"""
@summary 获取酷应用访问状态
@param request: GetCoolAppAccessStatusRequest
@return: GetCoolAppAccessStatusResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.GetCoolAppAccessStatusHeaders()
return await self.get_cool_app_access_status_with_options_async(request, headers, runtime)
def get_in_app_sku_url_with_options(
self,
request: dingtalkapp_market__1__0_models.GetInAppSkuUrlRequest,
headers: dingtalkapp_market__1__0_models.GetInAppSkuUrlHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.GetInAppSkuUrlResponse:
"""
@summary 获取内购商品SKU页面地址
@param request: GetInAppSkuUrlRequest
@param headers: GetInAppSkuUrlHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: GetInAppSkuUrlResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.callback_page):
body['callbackPage'] = request.callback_page
if not UtilClient.is_unset(request.extend_param):
body['extendParam'] = request.extend_param
if not UtilClient.is_unset(request.goods_code):
body['goodsCode'] = request.goods_code
if not UtilClient.is_unset(request.item_code):
body['itemCode'] = request.item_code
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='GetInAppSkuUrl',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/internals/skuPages/query',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.GetInAppSkuUrlResponse(),
self.execute(params, req, runtime)
)
async def get_in_app_sku_url_with_options_async(
self,
request: dingtalkapp_market__1__0_models.GetInAppSkuUrlRequest,
headers: dingtalkapp_market__1__0_models.GetInAppSkuUrlHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.GetInAppSkuUrlResponse:
"""
@summary 获取内购商品SKU页面地址
@param request: GetInAppSkuUrlRequest
@param headers: GetInAppSkuUrlHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: GetInAppSkuUrlResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.callback_page):
body['callbackPage'] = request.callback_page
if not UtilClient.is_unset(request.extend_param):
body['extendParam'] = request.extend_param
if not UtilClient.is_unset(request.goods_code):
body['goodsCode'] = request.goods_code
if not UtilClient.is_unset(request.item_code):
body['itemCode'] = request.item_code
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='GetInAppSkuUrl',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/internals/skuPages/query',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.GetInAppSkuUrlResponse(),
await self.execute_async(params, req, runtime)
)
def get_in_app_sku_url(
self,
request: dingtalkapp_market__1__0_models.GetInAppSkuUrlRequest,
) -> dingtalkapp_market__1__0_models.GetInAppSkuUrlResponse:
"""
@summary 获取内购商品SKU页面地址
@param request: GetInAppSkuUrlRequest
@return: GetInAppSkuUrlResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.GetInAppSkuUrlHeaders()
return self.get_in_app_sku_url_with_options(request, headers, runtime)
async def get_in_app_sku_url_async(
self,
request: dingtalkapp_market__1__0_models.GetInAppSkuUrlRequest,
) -> dingtalkapp_market__1__0_models.GetInAppSkuUrlResponse:
"""
@summary 获取内购商品SKU页面地址
@param request: GetInAppSkuUrlRequest
@return: GetInAppSkuUrlResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.GetInAppSkuUrlHeaders()
return await self.get_in_app_sku_url_with_options_async(request, headers, runtime)
def get_personal_experience_info_with_options(
self,
request: dingtalkapp_market__1__0_models.GetPersonalExperienceInfoRequest,
headers: dingtalkapp_market__1__0_models.GetPersonalExperienceInfoHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.GetPersonalExperienceInfoResponse:
"""
@summary 获取个人体验相关信息
@param request: GetPersonalExperienceInfoRequest
@param headers: GetPersonalExperienceInfoHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: GetPersonalExperienceInfoResponse
"""
UtilClient.validate_model(request)
query = {}
if not UtilClient.is_unset(request.user_id):
query['userId'] = request.user_id
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
query=OpenApiUtilClient.query(query)
)
params = open_api_models.Params(
action='GetPersonalExperienceInfo',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/personalExperiences',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='json',
body_type='json'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.GetPersonalExperienceInfoResponse(),
self.execute(params, req, runtime)
)
async def get_personal_experience_info_with_options_async(
self,
request: dingtalkapp_market__1__0_models.GetPersonalExperienceInfoRequest,
headers: dingtalkapp_market__1__0_models.GetPersonalExperienceInfoHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.GetPersonalExperienceInfoResponse:
"""
@summary 获取个人体验相关信息
@param request: GetPersonalExperienceInfoRequest
@param headers: GetPersonalExperienceInfoHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: GetPersonalExperienceInfoResponse
"""
UtilClient.validate_model(request)
query = {}
if not UtilClient.is_unset(request.user_id):
query['userId'] = request.user_id
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
query=OpenApiUtilClient.query(query)
)
params = open_api_models.Params(
action='GetPersonalExperienceInfo',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/personalExperiences',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='json',
body_type='json'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.GetPersonalExperienceInfoResponse(),
await self.execute_async(params, req, runtime)
)
def get_personal_experience_info(
self,
request: dingtalkapp_market__1__0_models.GetPersonalExperienceInfoRequest,
) -> dingtalkapp_market__1__0_models.GetPersonalExperienceInfoResponse:
"""
@summary 获取个人体验相关信息
@param request: GetPersonalExperienceInfoRequest
@return: GetPersonalExperienceInfoResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.GetPersonalExperienceInfoHeaders()
return self.get_personal_experience_info_with_options(request, headers, runtime)
async def get_personal_experience_info_async(
self,
request: dingtalkapp_market__1__0_models.GetPersonalExperienceInfoRequest,
) -> dingtalkapp_market__1__0_models.GetPersonalExperienceInfoResponse:
"""
@summary 获取个人体验相关信息
@param request: GetPersonalExperienceInfoRequest
@return: GetPersonalExperienceInfoResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.GetPersonalExperienceInfoHeaders()
return await self.get_personal_experience_info_with_options_async(request, headers, runtime)
def notify_on_crm_data_change_with_options(
self,
request: dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeRequest,
headers: dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeResponse:
"""
@summary 销售助理CRM数据变更回调通知
@param request: NotifyOnCrmDataChangeRequest
@param headers: NotifyOnCrmDataChangeHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: NotifyOnCrmDataChangeResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.data_id):
body['dataId'] = request.data_id
if not UtilClient.is_unset(request.extension):
body['extension'] = request.extension
if not UtilClient.is_unset(request.operate):
body['operate'] = request.operate
if not UtilClient.is_unset(request.type):
body['type'] = request.type
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='NotifyOnCrmDataChange',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/saleAssistants/crmDataChanges/notify',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeResponse(),
self.execute(params, req, runtime)
)
async def notify_on_crm_data_change_with_options_async(
self,
request: dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeRequest,
headers: dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeResponse:
"""
@summary 销售助理CRM数据变更回调通知
@param request: NotifyOnCrmDataChangeRequest
@param headers: NotifyOnCrmDataChangeHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: NotifyOnCrmDataChangeResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.data_id):
body['dataId'] = request.data_id
if not UtilClient.is_unset(request.extension):
body['extension'] = request.extension
if not UtilClient.is_unset(request.operate):
body['operate'] = request.operate
if not UtilClient.is_unset(request.type):
body['type'] = request.type
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='NotifyOnCrmDataChange',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/saleAssistants/crmDataChanges/notify',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeResponse(),
await self.execute_async(params, req, runtime)
)
def notify_on_crm_data_change(
self,
request: dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeRequest,
) -> dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeResponse:
"""
@summary 销售助理CRM数据变更回调通知
@param request: NotifyOnCrmDataChangeRequest
@return: NotifyOnCrmDataChangeResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeHeaders()
return self.notify_on_crm_data_change_with_options(request, headers, runtime)
async def notify_on_crm_data_change_async(
self,
request: dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeRequest,
) -> dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeResponse:
"""
@summary 销售助理CRM数据变更回调通知
@param request: NotifyOnCrmDataChangeRequest
@return: NotifyOnCrmDataChangeResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.NotifyOnCrmDataChangeHeaders()
return await self.notify_on_crm_data_change_with_options_async(request, headers, runtime)
def query_market_order_with_options(
self,
order_id: str,
headers: dingtalkapp_market__1__0_models.QueryMarketOrderHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.QueryMarketOrderResponse:
"""
@summary 应用市场订单查询
@param headers: QueryMarketOrderHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryMarketOrderResponse
"""
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers
)
params = open_api_models.Params(
action='QueryMarketOrder',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/orders/{order_id}',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='json',
body_type='json'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.QueryMarketOrderResponse(),
self.execute(params, req, runtime)
)
async def query_market_order_with_options_async(
self,
order_id: str,
headers: dingtalkapp_market__1__0_models.QueryMarketOrderHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.QueryMarketOrderResponse:
"""
@summary 应用市场订单查询
@param headers: QueryMarketOrderHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryMarketOrderResponse
"""
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers
)
params = open_api_models.Params(
action='QueryMarketOrder',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/orders/{order_id}',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='json',
body_type='json'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.QueryMarketOrderResponse(),
await self.execute_async(params, req, runtime)
)
def query_market_order(
self,
order_id: str,
) -> dingtalkapp_market__1__0_models.QueryMarketOrderResponse:
"""
@summary 应用市场订单查询
@return: QueryMarketOrderResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.QueryMarketOrderHeaders()
return self.query_market_order_with_options(order_id, headers, runtime)
async def query_market_order_async(
self,
order_id: str,
) -> dingtalkapp_market__1__0_models.QueryMarketOrderResponse:
"""
@summary 应用市场订单查询
@return: QueryMarketOrderResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.QueryMarketOrderHeaders()
return await self.query_market_order_with_options_async(order_id, headers, runtime)
def user_task_report_with_options(
self,
request: dingtalkapp_market__1__0_models.UserTaskReportRequest,
headers: dingtalkapp_market__1__0_models.UserTaskReportHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.UserTaskReportResponse:
"""
@summary app内用户操作任务同步
@param request: UserTaskReportRequest
@param headers: UserTaskReportHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: UserTaskReportResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.biz_no):
body['bizNo'] = request.biz_no
if not UtilClient.is_unset(request.operate_date):
body['operateDate'] = request.operate_date
if not UtilClient.is_unset(request.task_tag):
body['taskTag'] = request.task_tag
if not UtilClient.is_unset(request.userid):
body['userid'] = request.userid
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='UserTaskReport',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/tasks',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='json',
body_type='boolean'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.UserTaskReportResponse(),
self.execute(params, req, runtime)
)
async def user_task_report_with_options_async(
self,
request: dingtalkapp_market__1__0_models.UserTaskReportRequest,
headers: dingtalkapp_market__1__0_models.UserTaskReportHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkapp_market__1__0_models.UserTaskReportResponse:
"""
@summary app内用户操作任务同步
@param request: UserTaskReportRequest
@param headers: UserTaskReportHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: UserTaskReportResponse
"""
UtilClient.validate_model(request)
body = {}
if not UtilClient.is_unset(request.biz_no):
body['bizNo'] = request.biz_no
if not UtilClient.is_unset(request.operate_date):
body['operateDate'] = request.operate_date
if not UtilClient.is_unset(request.task_tag):
body['taskTag'] = request.task_tag
if not UtilClient.is_unset(request.userid):
body['userid'] = request.userid
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
body=OpenApiUtilClient.parse_to_map(body)
)
params = open_api_models.Params(
action='UserTaskReport',
version='appMarket_1.0',
protocol='HTTP',
pathname=f'/v1.0/appMarket/tasks',
method='POST',
auth_type='AK',
style='ROA',
req_body_type='json',
body_type='boolean'
)
return TeaCore.from_map(
dingtalkapp_market__1__0_models.UserTaskReportResponse(),
await self.execute_async(params, req, runtime)
)
def user_task_report(
self,
request: dingtalkapp_market__1__0_models.UserTaskReportRequest,
) -> dingtalkapp_market__1__0_models.UserTaskReportResponse:
"""
@summary app内用户操作任务同步
@param request: UserTaskReportRequest
@return: UserTaskReportResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.UserTaskReportHeaders()
return self.user_task_report_with_options(request, headers, runtime)
async def user_task_report_async(
self,
request: dingtalkapp_market__1__0_models.UserTaskReportRequest,
) -> dingtalkapp_market__1__0_models.UserTaskReportResponse:
"""
@summary app内用户操作任务同步
@param request: UserTaskReportRequest
@return: UserTaskReportResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkapp_market__1__0_models.UserTaskReportHeaders()
return await self.user_task_report_with_options_async(request, headers, runtime)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

View File

@ -0,0 +1,149 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.core import TeaCore
from alibabacloud_tea_openapi.client import Client as OpenApiClient
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_gateway_dingtalk.client import Client as GatewayClientClient
from alibabacloud_tea_util.client import Client as UtilClient
from alibabacloud_dingtalk.bay_max_1_0 import models as dingtalkbay_max__1__0_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_openapi_util.client import Client as OpenApiUtilClient
class Client(OpenApiClient):
"""
*\
"""
def __init__(
self,
config: open_api_models.Config,
):
super().__init__(config)
gateway_client = GatewayClientClient()
self._spi = gateway_client
self._endpoint_rule = ''
if UtilClient.empty(self._endpoint):
self._endpoint = 'api.dingtalk.com'
def query_baymax_skill_log_with_options(
self,
request: dingtalkbay_max__1__0_models.QueryBaymaxSkillLogRequest,
headers: dingtalkbay_max__1__0_models.QueryBaymaxSkillLogHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkbay_max__1__0_models.QueryBaymaxSkillLogResponse:
"""
@summary Baymax技能执行日志
@param request: QueryBaymaxSkillLogRequest
@param headers: QueryBaymaxSkillLogHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryBaymaxSkillLogResponse
"""
UtilClient.validate_model(request)
query = {}
if not UtilClient.is_unset(request.from_):
query['from'] = request.from_
if not UtilClient.is_unset(request.skill_execute_id):
query['skillExecuteId'] = request.skill_execute_id
if not UtilClient.is_unset(request.to):
query['to'] = request.to
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
query=OpenApiUtilClient.query(query)
)
params = open_api_models.Params(
action='QueryBaymaxSkillLog',
version='bayMax_1.0',
protocol='HTTP',
pathname=f'/v1.0/bayMax/skills/logs',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkbay_max__1__0_models.QueryBaymaxSkillLogResponse(),
self.execute(params, req, runtime)
)
async def query_baymax_skill_log_with_options_async(
self,
request: dingtalkbay_max__1__0_models.QueryBaymaxSkillLogRequest,
headers: dingtalkbay_max__1__0_models.QueryBaymaxSkillLogHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkbay_max__1__0_models.QueryBaymaxSkillLogResponse:
"""
@summary Baymax技能执行日志
@param request: QueryBaymaxSkillLogRequest
@param headers: QueryBaymaxSkillLogHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryBaymaxSkillLogResponse
"""
UtilClient.validate_model(request)
query = {}
if not UtilClient.is_unset(request.from_):
query['from'] = request.from_
if not UtilClient.is_unset(request.skill_execute_id):
query['skillExecuteId'] = request.skill_execute_id
if not UtilClient.is_unset(request.to):
query['to'] = request.to
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
query=OpenApiUtilClient.query(query)
)
params = open_api_models.Params(
action='QueryBaymaxSkillLog',
version='bayMax_1.0',
protocol='HTTP',
pathname=f'/v1.0/bayMax/skills/logs',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkbay_max__1__0_models.QueryBaymaxSkillLogResponse(),
await self.execute_async(params, req, runtime)
)
def query_baymax_skill_log(
self,
request: dingtalkbay_max__1__0_models.QueryBaymaxSkillLogRequest,
) -> dingtalkbay_max__1__0_models.QueryBaymaxSkillLogResponse:
"""
@summary Baymax技能执行日志
@param request: QueryBaymaxSkillLogRequest
@return: QueryBaymaxSkillLogResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkbay_max__1__0_models.QueryBaymaxSkillLogHeaders()
return self.query_baymax_skill_log_with_options(request, headers, runtime)
async def query_baymax_skill_log_async(
self,
request: dingtalkbay_max__1__0_models.QueryBaymaxSkillLogRequest,
) -> dingtalkbay_max__1__0_models.QueryBaymaxSkillLogResponse:
"""
@summary Baymax技能执行日志
@param request: QueryBaymaxSkillLogRequest
@return: QueryBaymaxSkillLogResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkbay_max__1__0_models.QueryBaymaxSkillLogHeaders()
return await self.query_baymax_skill_log_with_options_async(request, headers, runtime)

View File

@ -0,0 +1,148 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.model import TeaModel
from typing import Dict
class QueryBaymaxSkillLogHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class QueryBaymaxSkillLogRequest(TeaModel):
def __init__(
self,
from_: int = None,
skill_execute_id: str = None,
to: int = None,
):
self.from_ = from_
# This parameter is required.
self.skill_execute_id = skill_execute_id
self.to = to
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.from_ is not None:
result['from'] = self.from_
if self.skill_execute_id is not None:
result['skillExecuteId'] = self.skill_execute_id
if self.to is not None:
result['to'] = self.to
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('from') is not None:
self.from_ = m.get('from')
if m.get('skillExecuteId') is not None:
self.skill_execute_id = m.get('skillExecuteId')
if m.get('to') is not None:
self.to = m.get('to')
return self
class QueryBaymaxSkillLogResponseBody(TeaModel):
def __init__(
self,
result: str = None,
):
# This parameter is required.
self.result = result
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.result is not None:
result['result'] = self.result
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('result') is not None:
self.result = m.get('result')
return self
class QueryBaymaxSkillLogResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: QueryBaymaxSkillLogResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = QueryBaymaxSkillLogResponseBody()
self.body = temp_model.from_map(m['body'])
return self

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

View File

@ -0,0 +1,267 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.core import TeaCore
from alibabacloud_tea_openapi.client import Client as OpenApiClient
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_gateway_dingtalk.client import Client as GatewayClientClient
from alibabacloud_tea_util.client import Client as UtilClient
from alibabacloud_dingtalk.blackboard_1_0 import models as dingtalkblackboard__1__0_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_openapi_util.client import Client as OpenApiUtilClient
class Client(OpenApiClient):
"""
*\
"""
def __init__(
self,
config: open_api_models.Config,
):
super().__init__(config)
gateway_client = GatewayClientClient()
self._spi = gateway_client
self._endpoint_rule = ''
if UtilClient.empty(self._endpoint):
self._endpoint = 'api.dingtalk.com'
def query_blackboard_read_un_read_with_options(
self,
request: dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadRequest,
headers: dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadResponse:
"""
@summary 查询公告已读未读人员列表
@param request: QueryBlackboardReadUnReadRequest
@param headers: QueryBlackboardReadUnReadHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryBlackboardReadUnReadResponse
"""
UtilClient.validate_model(request)
query = {}
if not UtilClient.is_unset(request.blackboard_id):
query['blackboardId'] = request.blackboard_id
if not UtilClient.is_unset(request.max_results):
query['maxResults'] = request.max_results
if not UtilClient.is_unset(request.next_token):
query['nextToken'] = request.next_token
if not UtilClient.is_unset(request.operation_user_id):
query['operationUserId'] = request.operation_user_id
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
query=OpenApiUtilClient.query(query)
)
params = open_api_models.Params(
action='QueryBlackboardReadUnRead',
version='blackboard_1.0',
protocol='HTTP',
pathname=f'/v1.0/blackboard/readers',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadResponse(),
self.execute(params, req, runtime)
)
async def query_blackboard_read_un_read_with_options_async(
self,
request: dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadRequest,
headers: dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadResponse:
"""
@summary 查询公告已读未读人员列表
@param request: QueryBlackboardReadUnReadRequest
@param headers: QueryBlackboardReadUnReadHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryBlackboardReadUnReadResponse
"""
UtilClient.validate_model(request)
query = {}
if not UtilClient.is_unset(request.blackboard_id):
query['blackboardId'] = request.blackboard_id
if not UtilClient.is_unset(request.max_results):
query['maxResults'] = request.max_results
if not UtilClient.is_unset(request.next_token):
query['nextToken'] = request.next_token
if not UtilClient.is_unset(request.operation_user_id):
query['operationUserId'] = request.operation_user_id
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
query=OpenApiUtilClient.query(query)
)
params = open_api_models.Params(
action='QueryBlackboardReadUnRead',
version='blackboard_1.0',
protocol='HTTP',
pathname=f'/v1.0/blackboard/readers',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadResponse(),
await self.execute_async(params, req, runtime)
)
def query_blackboard_read_un_read(
self,
request: dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadRequest,
) -> dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadResponse:
"""
@summary 查询公告已读未读人员列表
@param request: QueryBlackboardReadUnReadRequest
@return: QueryBlackboardReadUnReadResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadHeaders()
return self.query_blackboard_read_un_read_with_options(request, headers, runtime)
async def query_blackboard_read_un_read_async(
self,
request: dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadRequest,
) -> dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadResponse:
"""
@summary 查询公告已读未读人员列表
@param request: QueryBlackboardReadUnReadRequest
@return: QueryBlackboardReadUnReadResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkblackboard__1__0_models.QueryBlackboardReadUnReadHeaders()
return await self.query_blackboard_read_un_read_with_options_async(request, headers, runtime)
def query_blackboard_space_with_options(
self,
request: dingtalkblackboard__1__0_models.QueryBlackboardSpaceRequest,
headers: dingtalkblackboard__1__0_models.QueryBlackboardSpaceHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkblackboard__1__0_models.QueryBlackboardSpaceResponse:
"""
@summary 获取公告钉盘空间信息
@param request: QueryBlackboardSpaceRequest
@param headers: QueryBlackboardSpaceHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryBlackboardSpaceResponse
"""
UtilClient.validate_model(request)
query = {}
if not UtilClient.is_unset(request.operation_user_id):
query['operationUserId'] = request.operation_user_id
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
query=OpenApiUtilClient.query(query)
)
params = open_api_models.Params(
action='QueryBlackboardSpace',
version='blackboard_1.0',
protocol='HTTP',
pathname=f'/v1.0/blackboard/spaces',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkblackboard__1__0_models.QueryBlackboardSpaceResponse(),
self.execute(params, req, runtime)
)
async def query_blackboard_space_with_options_async(
self,
request: dingtalkblackboard__1__0_models.QueryBlackboardSpaceRequest,
headers: dingtalkblackboard__1__0_models.QueryBlackboardSpaceHeaders,
runtime: util_models.RuntimeOptions,
) -> dingtalkblackboard__1__0_models.QueryBlackboardSpaceResponse:
"""
@summary 获取公告钉盘空间信息
@param request: QueryBlackboardSpaceRequest
@param headers: QueryBlackboardSpaceHeaders
@param runtime: runtime options for this request RuntimeOptions
@return: QueryBlackboardSpaceResponse
"""
UtilClient.validate_model(request)
query = {}
if not UtilClient.is_unset(request.operation_user_id):
query['operationUserId'] = request.operation_user_id
real_headers = {}
if not UtilClient.is_unset(headers.common_headers):
real_headers = headers.common_headers
if not UtilClient.is_unset(headers.x_acs_dingtalk_access_token):
real_headers['x-acs-dingtalk-access-token'] = UtilClient.to_jsonstring(headers.x_acs_dingtalk_access_token)
req = open_api_models.OpenApiRequest(
headers=real_headers,
query=OpenApiUtilClient.query(query)
)
params = open_api_models.Params(
action='QueryBlackboardSpace',
version='blackboard_1.0',
protocol='HTTP',
pathname=f'/v1.0/blackboard/spaces',
method='GET',
auth_type='AK',
style='ROA',
req_body_type='none',
body_type='json'
)
return TeaCore.from_map(
dingtalkblackboard__1__0_models.QueryBlackboardSpaceResponse(),
await self.execute_async(params, req, runtime)
)
def query_blackboard_space(
self,
request: dingtalkblackboard__1__0_models.QueryBlackboardSpaceRequest,
) -> dingtalkblackboard__1__0_models.QueryBlackboardSpaceResponse:
"""
@summary 获取公告钉盘空间信息
@param request: QueryBlackboardSpaceRequest
@return: QueryBlackboardSpaceResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkblackboard__1__0_models.QueryBlackboardSpaceHeaders()
return self.query_blackboard_space_with_options(request, headers, runtime)
async def query_blackboard_space_async(
self,
request: dingtalkblackboard__1__0_models.QueryBlackboardSpaceRequest,
) -> dingtalkblackboard__1__0_models.QueryBlackboardSpaceResponse:
"""
@summary 获取公告钉盘空间信息
@param request: QueryBlackboardSpaceRequest
@return: QueryBlackboardSpaceResponse
"""
runtime = util_models.RuntimeOptions()
headers = dingtalkblackboard__1__0_models.QueryBlackboardSpaceHeaders()
return await self.query_blackboard_space_with_options_async(request, headers, runtime)

View File

@ -0,0 +1,337 @@
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.model import TeaModel
from typing import Dict, List
class QueryBlackboardReadUnReadHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class QueryBlackboardReadUnReadRequest(TeaModel):
def __init__(
self,
blackboard_id: str = None,
max_results: int = None,
next_token: str = None,
operation_user_id: str = None,
):
# This parameter is required.
self.blackboard_id = blackboard_id
# This parameter is required.
self.max_results = max_results
self.next_token = next_token
# This parameter is required.
self.operation_user_id = operation_user_id
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.blackboard_id is not None:
result['blackboardId'] = self.blackboard_id
if self.max_results is not None:
result['maxResults'] = self.max_results
if self.next_token is not None:
result['nextToken'] = self.next_token
if self.operation_user_id is not None:
result['operationUserId'] = self.operation_user_id
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('blackboardId') is not None:
self.blackboard_id = m.get('blackboardId')
if m.get('maxResults') is not None:
self.max_results = m.get('maxResults')
if m.get('nextToken') is not None:
self.next_token = m.get('nextToken')
if m.get('operationUserId') is not None:
self.operation_user_id = m.get('operationUserId')
return self
class QueryBlackboardReadUnReadResponseBodyUsers(TeaModel):
def __init__(
self,
read: str = None,
read_timestamp: int = None,
user_id: str = None,
):
self.read = read
self.read_timestamp = read_timestamp
self.user_id = user_id
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.read is not None:
result['read'] = self.read
if self.read_timestamp is not None:
result['readTimestamp'] = self.read_timestamp
if self.user_id is not None:
result['userId'] = self.user_id
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('read') is not None:
self.read = m.get('read')
if m.get('readTimestamp') is not None:
self.read_timestamp = m.get('readTimestamp')
if m.get('userId') is not None:
self.user_id = m.get('userId')
return self
class QueryBlackboardReadUnReadResponseBody(TeaModel):
def __init__(
self,
next_token: str = None,
users: List[QueryBlackboardReadUnReadResponseBodyUsers] = None,
):
self.next_token = next_token
self.users = users
def validate(self):
if self.users:
for k in self.users:
if k:
k.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.next_token is not None:
result['nextToken'] = self.next_token
result['users'] = []
if self.users is not None:
for k in self.users:
result['users'].append(k.to_map() if k else None)
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('nextToken') is not None:
self.next_token = m.get('nextToken')
self.users = []
if m.get('users') is not None:
for k in m.get('users'):
temp_model = QueryBlackboardReadUnReadResponseBodyUsers()
self.users.append(temp_model.from_map(k))
return self
class QueryBlackboardReadUnReadResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: QueryBlackboardReadUnReadResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = QueryBlackboardReadUnReadResponseBody()
self.body = temp_model.from_map(m['body'])
return self
class QueryBlackboardSpaceHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_token: str = None,
):
self.common_headers = common_headers
self.x_acs_dingtalk_access_token = x_acs_dingtalk_access_token
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.common_headers is not None:
result['commonHeaders'] = self.common_headers
if self.x_acs_dingtalk_access_token is not None:
result['x-acs-dingtalk-access-token'] = self.x_acs_dingtalk_access_token
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('commonHeaders') is not None:
self.common_headers = m.get('commonHeaders')
if m.get('x-acs-dingtalk-access-token') is not None:
self.x_acs_dingtalk_access_token = m.get('x-acs-dingtalk-access-token')
return self
class QueryBlackboardSpaceRequest(TeaModel):
def __init__(
self,
operation_user_id: str = None,
):
# This parameter is required.
self.operation_user_id = operation_user_id
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.operation_user_id is not None:
result['operationUserId'] = self.operation_user_id
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('operationUserId') is not None:
self.operation_user_id = m.get('operationUserId')
return self
class QueryBlackboardSpaceResponseBody(TeaModel):
def __init__(
self,
space_id: str = None,
):
self.space_id = space_id
def validate(self):
pass
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.space_id is not None:
result['spaceId'] = self.space_id
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('spaceId') is not None:
self.space_id = m.get('spaceId')
return self
class QueryBlackboardSpaceResponse(TeaModel):
def __init__(
self,
headers: Dict[str, str] = None,
status_code: int = None,
body: QueryBlackboardSpaceResponseBody = None,
):
self.headers = headers
self.status_code = status_code
self.body = body
def validate(self):
if self.body:
self.body.validate()
def to_map(self):
_map = super().to_map()
if _map is not None:
return _map
result = dict()
if self.headers is not None:
result['headers'] = self.headers
if self.status_code is not None:
result['statusCode'] = self.status_code
if self.body is not None:
result['body'] = self.body.to_map()
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('headers') is not None:
self.headers = m.get('headers')
if m.get('statusCode') is not None:
self.status_code = m.get('statusCode')
if m.get('body') is not None:
temp_model = QueryBlackboardSpaceResponseBody()
self.body = temp_model.from_map(m['body'])
return self

View File

@ -0,0 +1 @@
__version__ = "1.0.0"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More