# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys
from typing import List
from alibabacloud_dingtalk.wiki_2_0.client import Client as dingtalkwiki_2_0Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_dingtalk.wiki_2_0 import models as dingtalkwiki__2__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() -> dingtalkwiki_2_0Client:
"""
Initialize the account Client using a Token
@return: Client
@throws Exception
"""
config = open_api_models.Config()
config.protocol = 'https'
config.region_id = 'central'
return dingtalkwiki_2_0Client(config)
@staticmethod
def main(
args: List[str],
) -> None:
client = Sample.create_client()
list_nodes_headers = dingtalkwiki__2__0_models.ListNodesHeaders()
list_nodes_headers.x_acs_dingtalk_access_token = '<your access token>'
list_nodes_request = dingtalkwiki__2__0_models.ListNodesRequest(
parent_node_id='MNDoBb60VLBPraakI1Ywxyyn8lemrZQ3',
next_token='next_token',
max_results=30,
with_permission_role=False,
operator_id='tXguN309iPhE4roSKPlLURAiEiE'
)
try:
client.list_nodes_with_options(list_nodes_request, list_nodes_headers, util_models.RuntimeOptions())
except Exception as err:
if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
# The err object contains the code and message properties, which help locate the issue.
pass
@staticmethod
async def main_async(
args: List[str],
) -> None:
client = Sample.create_client()
list_nodes_headers = dingtalkwiki__2__0_models.ListNodesHeaders()
list_nodes_headers.x_acs_dingtalk_access_token = '<your access token>'
list_nodes_request = dingtalkwiki__2__0_models.ListNodesRequest(
parent_node_id='MNDoBb60VLBPraakI1Ywxyyn8lemrZQ3',
next_token='next_token',
max_results=30,
with_permission_role=False,
operator_id='tXguN309iPhE4roSKPlLURAiEiE'
)
try:
await client.list_nodes_with_options_async(list_nodes_request, list_nodes_headers, util_models.RuntimeOptions())
except Exception as err:
if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
# The err object contains the code and message properties, which help locate the issue.
pass
if __name__ == '__main__':
Sample.main(sys.argv[1:])