# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys
from typing import List
from alibabacloud_dingtalk.storage_1_0.client import Client as dingtalkstorage_1_0Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_dingtalk.storage_1_0 import models as dingtalkstorage__1__0_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient
class Sample:
def __init__(self):
pass
@staticmethod
def create_client() -> dingtalkstorage_1_0Client:
"""
Initialize the account Client with the Token
@return: Client
@throws Exception
"""
config = open_api_models.Config()
config.protocol = 'https'
config.region_id = 'central'
return dingtalkstorage_1_0Client(config)
@staticmethod
def main(
args: List[str],
) -> None:
client = Sample.create_client()
add_folder_headers = dingtalkstorage__1__0_models.AddFolderHeaders()
add_folder_headers.x_acs_dingtalk_access_token = '<your access token>'
option_app_properties_0 = dingtalkstorage__1__0_models.AddFolderRequestOptionAppProperties(
name='Attribute1',
value='AttributeValue1',
visibility='PUBLIC'
)
option = dingtalkstorage__1__0_models.AddFolderRequestOption(
conflict_strategy='AUTO_RENAME',
app_properties=[
option_app_properties_0
]
)
add_folder_request = dingtalkstorage__1__0_models.AddFolderRequest(
union_id='cHtUxxxxx',
name='Test folder',
option=option
)
try:
client.add_folder_with_options('833xxxxx', '0', add_folder_request, add_folder_headers, util_models.RuntimeOptions())
except Exception as err:
if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
# err contains code and message properties to help you troubleshoot
pass
@staticmethod
async def main_async(
args: List[str],
) -> None:
client = Sample.create_client()
add_folder_headers = dingtalkstorage__1__0_models.AddFolderHeaders()
add_folder_headers.x_acs_dingtalk_access_token = '<your access token>'
option_app_properties_0 = dingtalkstorage__1__0_models.AddFolderRequestOptionAppProperties(
name='Attribute1',
value='AttributeValue1',
visibility='PUBLIC'
)
option = dingtalkstorage__1__0_models.AddFolderRequestOption(
conflict_strategy='AUTO_RENAME',
app_properties=[
option_app_properties_0
]
)
add_folder_request = dingtalkstorage__1__0_models.AddFolderRequest(
union_id='cHtUxxxxx',
name='Test folder',
option=option
)
try:
await client.add_folder_with_options_async('833xxxxx', '0', add_folder_request, add_folder_headers, util_models.RuntimeOptions())
except Exception as err:
if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
# err contains code and message properties to help you troubleshoot
pass
if __name__ == '__main__':
Sample.main(sys.argv[1:])